GithubHelp home page GithubHelp logo

Comments (10)

evilhamsterman avatar evilhamsterman commented on June 19, 2024 1

It's always struck me as a bad chicken/egg problem that poetry is the only cache type that requires the environment manager to be installed before it can be used. Even pipenv is not required to be installed

// because pipenv is not preinstalled on hosted images and virtualenv is not created:
it just uses the default pipenv location.

The Poetry default cache location is well known and I bet in CI the vase majority of projects are using that case. The big difference appears to be that the Poetry option is trying to support the fact that Poetry can install virtual environments in the project. Pipenv can also do this but it's just ignored for that option. I'd recommend just caching the default location like Pipenv, or you could have an option for enabling caching in project virtual environments it people use it.

from setup-python.

HarithaVattikuti avatar HarithaVattikuti commented on June 19, 2024

Hello @sdb9696
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

from setup-python.

andwaredev avatar andwaredev commented on June 19, 2024

Hello @sdb9696 – my team ran into this same issue recently. We solved it by pinning the python version in our pyproject.toml file, under [tool.poetry.dependencies]. See example below.

[tool.poetry.dependencies]
python = "3.11.4"

from setup-python.

sdb9696 avatar sdb9696 commented on June 19, 2024

Thanks @andwaredev but we run our CI against all supported python versions to check there are no issues so not sure this workaround will help.

from setup-python.

silverwind avatar silverwind commented on June 19, 2024

I find it highly concerning that the recommend and only working solution for caching poetry venvs is to install poetry before setup-python. It can not be assumed that python is present before setup-python has run because some runner images will not have python pre-installed.

This is what I would like to see working:

- uses: actions/setup-python@v5
  with:
    python-version: '3.12'
    cache: 'poetry'
- run: pipx install poetry

from setup-python.

evilhamsterman avatar evilhamsterman commented on June 19, 2024

@silverwind You can tell poetry to use a specific version of python prior to running install poetry env use <python executable> then run poetry install

https://python-poetry.org/docs/managing-environments#switching-between-environments

from setup-python.

silverwind avatar silverwind commented on June 19, 2024

@evilhamsterman doesn't really help me if there is simply no python installed before setup-python ran. Of course one could do workarounds by running setup-python twice, but I rather skip on enabling cache than doing such hacks.

from setup-python.

adminy avatar adminy commented on June 19, 2024

I find it highly concerning that the recommend and only working solution for caching poetry venvs is to install poetry before setup-python. It can not be assumed that python is present before setup-python has run because some runner images will not have python pre-installed.

This is what I would like to see working:

- uses: actions/setup-python@v5
  with:
    python-version: '3.12'
    cache: 'poetry'
- run: pipx install poetry

This also makes the assumtion that you have pipx which I do not :)

I'd highly recommend to install poetry as part of this python version fetching if cache is set to poetry.

Chances are everyone is going to need poetry if they are using poetry cache, so maybe get the specific python version with poetry pre-installed. This seems to be the only viable solution.

from setup-python.

silverwind avatar silverwind commented on June 19, 2024

This also makes the assumtion that you have pipx which I do not :)

I think setup-python does install pip and its variants currently, right?

from setup-python.

silverwind avatar silverwind commented on June 19, 2024

This also makes the assumtion that you have pipx which I do not :)

I think setup-python does install pip and its variants currently, right?

Apparently, it doesn't so to install poetry without pip and having a poetry cache, this would be the ideal:

- uses: actions/setup-python@v5
  with:
    python-version: '3.12'
    cache: 'poetry'
- uses: snok/install-poetry@v1

from setup-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.