Skip to content

Commit

Permalink
Update Poetry installs for install-poetry.py
Browse files Browse the repository at this point in the history
python-poetry/poetry#3706
python-poetry/poetry#3870
python-poetry/poetry#4056

Poetry has a new install script, added in python-poetry/poetry#3706.
The old get-poetry.py install script is not compatible with Python 3.10.
This commit will update the GitHub Actions workflow to use the new
install-poetry.py script, with `POETRY_HOME=/opt/poetry` for consistent
installs independent of user account, and will also update the workflow
to use a virtualenv and run commands with `poetry run` to avoid issues
with `POETRY_VIRTUALENVS_CREATE=false`.

As of Poetry 1.1.7, there may be complications with install-poetry.py
run without venvs (`POETRY_VIRTUALENVS_CREATE=false`). An error is seen:

```text
OSError

Could not find a suitable TLS CA certificate bundle, invalid path:
/opt/poetry/venv/lib/python3.9/site-packages/certifi/cacert.pem

at /opt/poetry/venv/lib/python3.9/site-packages/requests/adapters.py:227
in cert_verify
```

Poetry may be incorrectly attempting to read from its virtualenv if it's
not respecting `POETRY_VIRTUALENVS_CREATE` (python-poetry/poetry#3870).
Downstream steps also do not respect `POETRY_VIRTUALENVS_CREATE`, so the
application does not run. To avoid these issues, `poetry run` can be
prepended to commands to prompt Poetry to use its virtualenv.

Additionally, Poetry errors out with a `JSONDecodeError` when attempting
to install packages with Python 3.10 (python-poetry/poetry#4210). Python
3.10 support will be postponed until Poetry is compatible.
  • Loading branch information
br3ndonland committed Jul 6, 2021
1 parent f982106 commit 6521198
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python-version: [3.8, 3.9]
env:
CODECOV_UPLOAD: true
POETRY_VIRTUALENVS_CREATE: false
POETRY_HOME: /opt/poetry
PYPI_PUBLISH: true
steps:
- uses: actions/checkout@v2
Expand All @@ -39,16 +39,16 @@ jobs:
restore-keys: ${{ runner.os }}-pre-commit-
- name: Install Poetry
run: |
curl -fsS -o get-poetry.py \
https://raw.githubusercontent.com/python-poetry/poetry/HEAD/get-poetry.py
python get-poetry.py -y
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
curl -fsS -o install-poetry.py \
https://raw.githubusercontent.com/python-poetry/poetry/HEAD/install-poetry.py
python install-poetry.py -y
echo "$POETRY_HOME/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install --no-interaction
- name: Run pre-commit hooks
run: pre-commit run --all-files
run: poetry run pre-commit run --all-files
- name: Run unit tests
run: pytest --cov-report=xml
run: poetry run pytest --cov-report=xml
- name: Upload test coverage report to Codecov
uses: codecov/codecov-action@v1
if: env.CODECOV_UPLOAD == 'true'
Expand Down

0 comments on commit 6521198

Please sign in to comment.