Gr1N / setup-poetry

Set up your GitHub Actions workflow with a specific version of Poetry
MIT License
86 stars 14 forks source link

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

Closed brechtm closed 3 years ago

brechtm commented 3 years ago

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?

tueda commented 3 years ago

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 commented 3 years ago

For now, I'm doing some thing similar:

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 commented 3 years ago

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.