quarto-dev/quarto-python

Add feature to install quarto

jcheng5 opened this issue · 3 comments

@jjallaire Here are some thoughts on how we might enable Python users to more easily install quarto.

How to invoke command

This would work if you think of it as the Python package just bootstrapping the installation process for you.

pip install quarto
python -m quarto install-cli [--version=<latest|prerelease|1.3.450>]

Or if we're literally bundling the quarto binaries into packages hosted on pip, it might be more like:

# Doesn't install quarto cli
pip install quarto

# Installs for Windows
pip install quarto[cli-windows]

# etc.
pip install quarto[cli-mac]
pip install quarto[cli-linux-x64]
pip install quarto[cli-linux-arm64]

# Or maybe automatically??
pip install quarto[cli]

Installation methods

Both methods below will need to discover the latest current (or prerelease, optionally?) quarto version so it knows what to download. Also should be able to let the user specify the desired version.

Untar (for virtualenvs)

Download a platform-specific tarball from https://quarto.org/docs/download/ and unpack it somewhere within sysconfig.get_path("data"). Set up a quarto alias or passthrough script and put it in sysconfig.get_path("scripts").

Package installer (for system python)

For system Python, I think there's not a reason to do a tarball and it's better just to install from the normal installer. Otherwise we're trying to untar stuff into /usr/local/bin or whatever, which both feels aggressive and also would require the user to retry the command with sudo.

In this case, we'd just download the installer to a temp directory and invoke it, I guess?

Resources

Detecting whether in a venv/virtualenv/pyvenv/pipenv or conda env

I think we might want something that provides stronger affinity to the version actually installed (i.e. no logical separation of pip install and python -m quarto install-cli). That way when someone installs a given version of the quarto package they know they will reproducibly get the same version of quarto-cli.

So I am thinking of something like:

  1. The PyPI package version carries the version of the released quarto-cli (e.g. 1.3.202)

  2. During setup.py or on first use it downloads exactly that version of the quarto-cli

  3. Pre-releases of quarto can be installed directly from git tags (and behave the same way).

I am thinking that if we don't do this then pip install quarto doesn't actually "pin" a version of quarto in requirements.txt.

Does that make sense?

Yeah, that makes sense. Also, if pip install quarto is enough to fully install the quarto-cli then that's good for Connect/ShinyApps.io/Docker as it will do the download at build time rather than while the user is waiting.