-
Notifications
You must be signed in to change notification settings - Fork 44
Export Poetry's lockfile as pip requirements.txt #1269
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
Export Poetry's lockfile as pip requirements.txt #1269
Conversation
I feel like maybe this should be discussed, so I keep it as draft for a bit. In particular it feels like attempts at using some of those Poetry pre-commit hooks have been made in the past, and I can assume it was not entirely successful, so maybe there is some background info that I am missing. |
Hm, yes. I suspect so as well |
I am wondering how we could move this forward... What could be an issue here? Updates to Maybe I could document this a bit... |
@oldfielj-ansto If I am not mistaken, you were the one to introduce pre-commit hooks and Poetry. Maybe you have some opinion on this... |
rev: 1.8.3 | ||
hooks: | ||
- id: poetry-check | ||
args: |
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.
What does this hook do, does it check if the lock file is up to date or does it also update and commit it ?
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.
As far as I can tell it runs poetry check --lock
. The documentation is not super clear on what this does, I assume there is an issue in the documentation, because the behavior does not match the documentation.
Anyway what actually happens in this hook is that it checks that:
- the content of
pyproject.toml
is valid (from the point of view of Poetry) - there is a
poetry.lock
file - the content of
poetry.lock
is in sync withpyproject.toml
The next hook runs poetry lock --no-update
, which does syncs the lock file. The hook will fail if the hook changes the file, this is important to have on the CI side, for the case when someone commits without running the hooks locally.
Then the third hook does the export to requirements.txt
. The hook will fail if the hook changes the file, this is important to have on the CI side, for the case when someone commits without running the hooks locally.
There is some redundancy between the first two steps, and I assume we can simplify over time, depending on how things go.
It would probably nice with some documentation :) |
09cd803
to
da74f7f
Compare
I added a bit of documentation. Mostly in comments in |
da74f7f
to
4686d7a
Compare
4686d7a
to
935c2d5
Compare
935c2d5
to
bb49ef0
Compare
bb49ef0
to
785cf90
Compare
How come that the status checks are pending for such a long time ? |
Merging #1289 broke the GitHub Actions workflows completely. See mxcube/mxcubecore#960 |
785cf90
to
8ce28bc
Compare
@fabcor-maxiv: Yes, I think its fixed now. Seems like the poetry-export hook reacts to something I guess its the update of |
8ce28bc
to
98129aa
Compare
Oh, nice! That is very good that the issue is caught, that is what we want. : ) I forced the pre-commit hook to regenerate the exported |
bde2d5b
to
32b6b30
Compare
This will let the pre-commit hooks ensure that Poetry's lockfile is kept up-to-date and that it is exported to a pip `requirements.txt` file. GitHub: fix mxcube#1268
32b6b30
to
4c4a544
Compare
This is now rebased, it takes into account the newly added dependency ( |
This will let the pre-commit hooks ensure that Poetry's lockfile is kept up-to-date and that it is exported to a pip
requirements.txt
file.GitHub: fix #1268