-
Notifications
You must be signed in to change notification settings - Fork 9
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
ci: precommit checks for poetry TOML and lock #526
Conversation
@@ -99,3 +102,10 @@ repos: | |||
rev: 0.4.1 | |||
hooks: | |||
- id: pydoclint | |||
|
|||
- repo: https://github.com/python-poetry/poetry | |||
rev: "1.8.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we hardcode the poetry version anywhere. The devcontainer (branch) does specify a version but in our local environments, we might all have different versions of poetry with different behaviours. This is not good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this long living thread about enforcing Poetry versions, still unsolved.
We could specify it in install_dependencies.sh
, which is what we trigger when we do make setup-dev
:
$ curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.2 python3 -
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recommended way of installing poetry these days is using pipx
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice, thanks again!
@@ -99,3 +102,10 @@ repos: | |||
rev: 0.4.1 | |||
hooks: | |||
- id: pydoclint | |||
|
|||
- repo: https://github.com/python-poetry/poetry | |||
rev: "1.8.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this long living thread about enforcing Poetry versions, still unsolved.
We could specify it in install_dependencies.sh
, which is what we trigger when we do make setup-dev
:
$ curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.2 python3 -
✨ Context
At the moment, nothing ensures that the project TOML is valid and in agreement with the poetry.lock in the repository. It would be great to ensure the sanity of these files, especially in the context of CI/CD and merging different branches with conflicting locks.
🛠 What does this PR implement
It implements the official poetry pre-commit hooks to perform
poetry check
andpoetry lock --no-update
in the files.I ran
poetry run pre-commit run --all-files
to ensure checks are passing.Update:
poetry lock --no-update
takes a bit of time. The CI throws a timeout, so I had to switch it off in CI. It would still run locally. If we see it slows down commits we will need to switch it off. It's very often skipped so it should not damage the overall experience.Update 2: The pre-commit.ci now supports more modern python versions which tries to use by default. So I had to configure that it keeps using 3.10
🙈 Missing
🚦 Before submitting
dev
branch?make test
)?poetry run pre-commit run --all-files
)?