Install with package manager
Description:
Currently, if we use poetry, we have to write two steps:
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ...
cache: poetry
I hope this can be easier:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ...
package-manager: poetry@{version}
cache: poetry
Hello @Cologler. Thank you for your feature request. We'll take a look on it.
There is a "cart before the horse" issue here depending on the OS.
MacOS can install pipx with brew, but Linux and Windows must use python (see the docs here). Hence, you have to install python to install pipx and then poetry all before you can run actions/setup-python, by which point you've already installed python...?
I believe the action should install poetry as a post-step if cache: poetry is used and set up the cache.
There is a "cart before the horse" issue here depending on the OS.
Oops, I forgot about pre-installed software on each runner, and they all have python and pipx. My mistake...
There's a more general use-case here that would be very useful to me, where setup-poetry could install a list of global/system tools via pipx, such as: Poetry, Tox, PDM, Invoke, Poe, etc. The idea being for a way to express pipx-installable tools (and their versions) that setup-python would then take care of installing, including caching the respective virtualenvs (eg /opt/pipx/venvs/) and command (eg /opt/pipx_bin/).
An extra bonus would be a way to express this in the pyproject.toml (as an alternative to passing as input) through a field like [tool.setup-python.pipx] or something like that.
I intend to write a stand-alone action as a proof-of-concept and will report back.
Here is an action I've published to fill this need: https://github.com/BrandonLWhite/pipx-install-action
I do envision that one day this functionality is incorporated directly in actions/setup-python, but until then, please try out my action and see if it meets your needs!
Hello @Cologler. Thank you for your feature request. We'll take a look on it.
Will you accept a PR with this feature? With one more input: "cache-packet-manager: BOOL".