Gr1N / setup-poetry

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

Gr1N/setup-poetry fails on Python 3.11 beta 1 (with current version of install-poetry.py) #28

Closed davidfstr closed 2 years ago

davidfstr commented 2 years ago

Repro Steps:

Inside a fresh GitHub repository, commit the following file:

# .github/workflows/push-github-action.yml
name: push-github-action
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.11.0-beta.1"]
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v3
        with:
          python-version: ${{ matrix.python-version }}

      - name: Display Python version
        run: python -c "import sys; print(sys.version)"

      - name: Install Poetry
        uses: Gr1N/setup-poetry@v7

      - name: Display Poetry version
        run: poetry --version

The workflow run will fail with something like:

/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/bin/python /home/runner/work/_temp/b7a7c2df-9a21-46c1-8265-024461c7bc9c --yes
The canonical source for Poetry's installation script is now https://install.python-poetry.org. Please update your usage to reflect this.
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

/home/runner/.local/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.1.13)
Installing Poetry (1.1.13): Creating environment
Traceback (most recent call last):
  File "/home/runner/work/_temp/b7a7c2df-9a21-46c1-[8](https://github.com/davidfstr/trycast/runs/6389446306?check_suite_focus=true#step:5:8)265-024461c7bc[9](https://github.com/davidfstr/trycast/runs/6389446306?check_suite_focus=true#step:5:9)c", line 908, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/runner/work/_temp/b7a7c2df-9a21-46c1-8265-024461c7bc9c", line 876, in main
    return installer.run()
           ^^^^^^^^^^^^^^^
  File "/home/runner/work/_temp/b7a7c2df-9a21-46c1-8265-024461c7bc9c", line 507, in run
    self.install(version)
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/_temp/b7a7c2df-9a21-46c1-8265-024461c7bc9c", line 528, in install
    with self.make_env(version) as env:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.[11](https://github.com/davidfstr/trycast/runs/6389446306?check_suite_focus=true#step:5:11).0-beta.1/x64/lib/python3.11/contextlib.py", line [13](https://github.com/davidfstr/trycast/runs/6389446306?check_suite_focus=true#step:5:13)7, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/runner/work/_temp/b7a7c2df-9a21-46c1-8265-024461c7bc9c", line 600, in make_env
    raise e
    ^^^^^^^
  File "/home/runner/work/_temp/b7a7c2df-9a21-46c1-8265-024461c7bc9c", line 586, in make_env
    yield VirtualEnvironment.make(env_path)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/_temp/b7a7c2df-9a21-46c1-8265-024461c7bc9c", line 292, in make
    builder.ensure_directories(target)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/venv/__init__.py", line 1[19](https://github.com/davidfstr/trycast/runs/6389446306?check_suite_focus=true#step:5:19), in ensure_directories
    if os.pathsep in env_dir:
       ^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'PosixPath' is not iterable
Error: The process '/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/bin/python' failed with exit code 1

The problem is that install-poetry.py currently crashes on Python 3.11 beta 1.

I'm shepherding a fix to upstream install-poetry.py: https://github.com/python-poetry/poetry/issues/5597

davidfstr commented 2 years ago

Upstream install-poetry.py should now be fixed on Python 3.11 beta 2, once that beta is released around 2022-05-30.