-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add Python 3.10 support #36
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/br3ndonland/inboard/7yDAzjvQKWR2tA7jWXhBuS6jFGPL |
c0acd4a
to
1779080
Compare
#36 #44 PR #44 introduced version tests for Poetry. The GitHub Actions workflow builds.yml was matching the version number as a substring anywhere in the output of `poetry -V`, but the hooks.yml and tests.yml workflows were matching the version number at the end of the `poetry -V` output. This would have become an issue if the format of the output was changed, and sure enough, Poetry 1.2.0 changes the format to have parentheses around the version number. This commit will update the hooks.yml and tests.yml workflows to match the version number as a substring anywhere in the output of `poetry -V`.
1779080
to
d84ef21
Compare
d84ef21
to
d5092cb
Compare
d5092cb
to
1294f0e
Compare
1294f0e
to
24ba375
Compare
28d9f9b
to
4c91833
Compare
387f230
to
521998e
Compare
521998e
to
7a12747
Compare
7a12747
to
b3b4e73
Compare
1d8eee0 884d475 Poetry has a new install script, install-poetry.py, which alters the requirements for adding Poetry to `$PATH`. `$HOME/.local/bin` was already on `$PATH` for pipx, so it seemed like a good option. Commits 1d8eee0 and 884d475 updated `.zshrc` and `script/strap-after-setup` for install-poetry.py and `POETRY_HOME=$HOME/.local`. This made sense initially, because Poetry installs its binaries into `$POETRY_HOME/bin`, and because Poetry doesn't have a `$POETRY_BIN_DIR` configuration variable like pipx does (`$PIPX_BIN_DIR`). Unfortunately, `POETRY_HOME=$HOME/.local` ended up being problematic, because Poetry takes over `$POETRY_HOME`, and doesn't consider other applications installed there. For example, if the get-poetry.py or install-poetry.py scripts were used to install Poetry, they can also be used to uninstall Poetry. Uninstalling with `python install-poetry.py --uninstall` or `python get-poetry.py --uninstall` deletes the entire `$POETRY_HOME` directory, which means it deletes `$HOME/.local`, causing problems for other applications that use `$HOME/.local` (python-poetry/poetry#4625). There have been many other issues with the Poetry custom install scripts get-poetry.py and install-poetry.py (br3ndonland/inboard#36), so other installation methods are be welcome. Poetry is now available through Homebrew, but Homebrew installation is not supported by the Poetry maintainers. Homebrew installation also requires its own custom install script, which creates its own issues. python-poetry/poetry#941 python-poetry/poetry#1765 Homebrew/homebrew-core#48883 Homebrew/homebrew-core#86776 pipx (https://pypa.github.io/pipx/) can also be used to install Poetry. The pipx installation method is suggested in the Poetry docs and GitHub, and pipx is already in use in this repo. python-poetry/poetry#677 python-poetry/poetry#3360 This commit will remove `export POETRY_HOME=$HOME/.local` from `.zshrc`, and will install Poetry with pipx.
br3ndonland/fastenv#7 br3ndonland/inboard#36 Python versions must now be quoted in YAML. `3.10` (without quotes) is interpreted as a float and becomes `3.1`. `"3.10"` will be used instead.
b3b4e73
to
f9d76cf
Compare
f9d76cf
to
6d78578
Compare
Codecov Report
@@ Coverage Diff @@
## develop python-poetry/poetry#36 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 281 264 -17
=========================================
- Hits 281 264 -17
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
afbcd1b
to
0957b2f
Compare
0957b2f
to
363a2ff
Compare
363a2ff
to
a1f7241
Compare
Beta releases of Python 3.10 were installed with `"3.10.0-beta - 3.10"`. Python 3.10 is now stable, so beta versions are no longer needed. Python versions in YAML must now be quoted. `3.10` is interpreted as a float and becomes `3.1`, so `"3.10"` must be used instead.
The Python version can be customized by using a Docker build argument, such as `--build-arg PYTHON_VERSION=3.9`.
This commit will update type annotation syntax for Python 3.10. The project currently also supports Python 3.8 and 3.9, so the annotations are imported with `from __future__ import annotations`. The Python 3.10 union operator (the pipe, like `str | None`) will not be used on pydantic models. If running Python 3.9 or below, pydantic is not compatible with the union operator, even if annotations are imported with `from __future__ import annotations`. https://peps.python.org/pep-0604/ https://docs.python.org/3/whatsnew/3.10.html pydantic/pydantic#2597 (comment) pydantic/pydantic#2609 (comment) pydantic/pydantic#3300 (comment)
Sourcery Code Quality ReportMerging this PR leaves code quality unchanged.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
inboard is finally ready to support Python 3.10. Thanks to everyone for their patience over the past nine months. |
#36 Type annotations were updated for Python 3.10 in #36. This `from typing import Set` was added in #49 prior to merging #36, and was overlooked when merging the PR. This commit will replace `typing.Set` with a parametrized generic. https://peps.python.org/pep-0585/ https://docs.python.org/3/whatsnew/3.9.html
After creating numerous problems for maintainers by cramming breaking changes into patch releases, Poetry finally released a minor version, 1.2, which should probably have been a major version. In order to upgrade, each project will need to update its pyproject.toml (to support groups), update any references to the install script (which has been moved twice), and make several other associated changes. This commit will set an upper bound on the `pipx install poetry` command to avoid upgrading to Poetry 1.2. br3ndonland/inboard#36 br3ndonland/inboard#44 br3ndonland/inboard#47 https://python-poetry.org/blog/announcing-poetry-1.2.0/
Description
This PR will add Python 3.10 support to inboard.
Changes
GitHub Actions
3.10
(without quotes) is interpreted as a float and becomes3.1
, so"3.10"
must be used instead.Poetry
pipx
instead of get-poetry.py or its replacement install-poetry.py. This change eliminated all of the issues seen with get-poetry.py and install-poetry.py.pipx
(Install Poetry with pipx #47) eliminated the issues seen when installing dependencies with Python 3.10.Expand this details element for details on some of the problems seen with get-poetry.py and install-poetry.py on Python 3.10.
The previous get-poetry.py install script is not compatible with Python 3.10. Attempts to install Poetry with Python 3.10 and get-poetry.py may raise
ModuleNotFoundError
(python-poetry/poetry#3071, python-poetry/poetry#3345) and other errors:Poetry 1.1.11 claimed to resolve Python 3.10 issues, but it did not.
The new install-poetry.py script (added in python-poetry/poetry#3706) must therefore be used, but it was problematic when it was introduced.
install-poetry.py did not respect
POETRY_VIRTUALENVS_CREATE
As of Poetry 1.1.7, there may be complications when using install-poetry.py without a virtualenv (
POETRY_VIRTUALENVS_CREATE=false
). When installing dependencies, the following error is frequently seen:In some situations, Poetry uninstalls its own dependencies. The
OSError
above occurs because Poetry uninstallsrequests
andcertifi
, then complains that it can't find them. See:install --no-dev
when it manages the environment it is installed in python-poetry/poetry#3957Poetry may have also been incorrectly attempting to read from its virtualenv (instead of
site-packages
) if it was not respectingPOETRY_VIRTUALENVS_CREATE
. Downstream steps also did not appear to respectPOETRY_VIRTUALENVS_CREATE
, so the application did not run. See:install-poetry.py
does not install packages to system Python even withPOETRY_VIRTUALENVS_CREATE=0
python-poetry/poetry#3870Poetry did not install packages correctly with install-poetry.py,
POETRY_VIRTUALENVS_CREATE
, and Python 3.10Poetry errored out with a
JSONDecodeError
when attempting to install packages with Python 3.10. See python-poetry/poetry#4210. This appeared to be resolved as of Poetry 1.2.0a2.There were also errors with Poetry's own virtualenv when using install-poetry.py,
POETRY_VIRTUALENVS_CREATE
, and multiple versions of Python, including 3.8 and 3.9. Error tracebacks typically reported a traceback sequence ofCalledProcessError
->EnvCommandError
->PoetryException
for each package, and appeared to involvevirtualenv
andpip
. These errors may have been related to Poetry's "new installer", which can be disabled with the commandpoetry config experimental.new-installer false
or the environment variablePOETRY_EXPERIMENTAL_NEW_INSTALLER=false
.Example traceback from a GitHub Actions run:
May be somewhat related to:
install-poetry.py
: ModuleNotFoundError: No module named 'virtualenv' python-poetry/poetry#4463install-poetry.py was not present in stable releases
Poetry 1.1 releases did not include install-poetry.py in their source tree. This could be a problem for projects that fetch install-poetry.py from a specific Git tag, as this project does (#44).
For example:
404
pydantic and typing
str | None
) will not be used on pydantic models. This project still supports Python 3.8 and 3.9. If running Python 3.9 or below, pydantic is not compatible with the union operator, even if annotations are imported withfrom __future__ import annotations
.X | Y
Optional[str]
withstr | None
pydantic/pydantic#2597 (comment)Related
GitHub Actions
Poetry
install-poetry.py
does not install packages to system Python even withPOETRY_VIRTUALENVS_CREATE=0
python-poetry/poetry#3870install --no-dev
when it manages the environment it is installed in python-poetry/poetry#3957install-poetry.py
: ModuleNotFoundError: No module named 'virtualenv' python-poetry/poetry#4463pydantic and typing
Optional[str]
withstr | None
pydantic/pydantic#2597X | Y