Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running Poetry with a non-default Python version #8

Closed
brechtm opened this issue Jan 22, 2021 · 3 comments
Closed

Allow running Poetry with a non-default Python version #8

brechtm opened this issue Jan 22, 2021 · 3 comments
Labels
wontfix This will not be worked on

Comments

@brechtm
Copy link

brechtm commented Jan 22, 2021

I'm trying to run my tests with Python 3.10. However, Poetry doesn't support 3.10 yet and crashes.

Locally, I can run Poetry using another Python version than the one used for the virtualenv set up by Poetry. Is the same possible somehow with setupoetry?

brechtm added a commit to brechtm/rinohtype that referenced this issue Jan 22, 2021
brechtm added a commit to brechtm/rinohtype that referenced this issue Jan 22, 2021
@tueda
Copy link

tueda commented Jan 30, 2021

This feature will be also useful for testing old Python versions.

For now, the following hack seems to work:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-python@v2
      - id: python-path
        run: echo "::set-output name=path::$(command -v python)"
      - uses: Gr1N/setup-poetry@v4
      - id: poetry-path
        run: echo "::set-output name=path::$(command -v poetry)"
      - uses: actions/setup-python@v2
        with:
          python-version: 3.10-dev
      - run: sed -i '1i#!${{ steps.python-path.outputs.path }}' '${{ steps.poetry-path.outputs.path }}'
      - run: poetry env use 3.10

      - run: poetry run python --version
      - run: poetry install

@brechtm
Copy link
Author

brechtm commented Jan 30, 2021

For now, I'm doing some thing similar:

  • install the latest stable Python version (3.9 at the time of writing)
  • install poetry using pip (pip3.9 install poetry)
  • install the Python version I want to test against (e.g. 3.10)

This way, poetry is executed using the first-installed Python.

See my workflow for an example. In my case I just need tox and poetry anyway, and not all of the other dev dependencies listed in my pyproject.toml.

@Gr1N Gr1N added the wontfix This will not be worked on label Feb 20, 2021
@Gr1N
Copy link
Owner

Gr1N commented Feb 20, 2021

Hi, sorry for the delay with the answer. setup-poetry action is just a simple wrapper around get-poetry.py installation script and I want to keep it as simple as possible. So I'm sorry but unfortunately, I'm going to close this issue as won't fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants