-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Method for enforcing a minimum version of Poetry #3316
Comments
At present, root@cc2fc2786035:/foobar# cat poetry.lock | grep lock-version
lock-version = "1.1"
root@cc2fc2786035:/foobar# pip install -q --force poetry==1.0.10
root@cc2fc2786035:/foobar# poetry install
The lock file might not be compatible with the current version of Poetry.
Upgrade Poetry to ensure the lock file is read properly or, alternatively, regenerate the lock file with the `poetry lock` command.
... That said, the lock version is the closest thing we have at the moment. As you can see above, lock files generated since Lock file generated using As for |
Right, it is the format of the lock file and possibly the virtualenv that is the issue. But alright, it makes upgrading from 1.0 to 1.1 harder but not impossible. I have found that if the system version of poetry is 1.0 and 1.1 is added as a dep into the pyproject.toml, the newer version will be used for the project from that point on. That feels a bit nonstandard though. |
Probably not a good idea if you are adding it as a dependnecy as this will affect your dependency graph. |
I agree. It would be a dev dependency and for an internal project but I am not looking for creative solutions here. :-) |
Would be great to make somehow sure that every team member has recent enough poetry. In future poetry may add (more) non-backwords compatible features. Is it possible run bash in https://python-poetry.org/docs/pyproject/#scripts ? And if there would be some "preinstall" hooks (like in Node's package.json) then it would be possible to create a simple bash script to do the version checking. Or maybe just add something like
to pyproject.toml |
Adding a "plus 1" to this problem. The Node world seems to have solved this problem by specifying node versions with the |
With the addition of dependency groups in poetry v1.2+, this issue again seems to be relevant. Updating
|
Dependency groups are now a thing, and the old `dev-dependencies` section will soon be deprecated according to the poetry docs. So, this updates pyproject.toml to use the new format. Please note that poetry v1.2+ is now required for this project, but there's currently no way to specify or enforce that in poetry, so the contributing docs have been updated to get that point across. see: https://python-poetry.org/docs/master/managing-dependencies/#dependency-groups see: python-poetry/poetry#3316
Configuration like this should be enforced and not permitted to run when poetry doesn't meet the minimum required version.
When 1.1 runs against a 1.2 lock file it causes more changes in the diff than are necessary and vice versa. |
The
If you want to avoid said diffs, you should enforce a consistent version amongst your team. Currently that is a social and not a technical problem; this issue is an ask that we make it a technical one. |
@neersighted Sorry, but these dependency managers (and more) version themselves, and warn if you're using an out-of-date version:
Perhaps you should consider the use-case of a developer who supports more than one project? |
@ashirazi2 I think you misunderstand my comments, and I suggest you read the full discussion before jumping in. I am referring to the fact that
This feature is not rejected, it's still something we want to add but no one has worked on it yet. This is merely a summary of the status quo -- currently this is a social problem, and we want to make it a technical problem. If you need to juggle multiple versions of Poetry, because you are working on a project that has not updated:
|
Thanks for the clarification, and the work-around! |
I am also running into this issue moving from poetry 1.4.2 to poetry 1.51. I like @kimmoahola 's proposed solution to this: #3316 (comment) Full reproduction stepsPoetry version: $ poetry --version
Poetry (version 1.4.2) Issue: $ poetry install
The Poetry configuration is invalid:
- [source.0] Additional properties are not allowed ('priority' was unexpected) Due to this part of my pyproject.toml file: [[tool.poetry.source]]
name = "foo"
url = "https://blablabla"
priority = "explicit" Updating my poetry version solves this issue:
Now poetry install works:
|
I don't mind the suggestion above. Another suggestion would be to make it part of the configuration. For instance: |
Agreed that using multiple versions of poetry with pipx is helpful. But, it would still be useful to library developers if they could specific a version constraint for poetry when developing that library. Both for the reason mentioned above ( |
To further clarify why this would be a useful feature, I'd like to give an example. I tried to set up one of my projects in an IDE. I got this error:
It's not that hard to figure out what the problem is by googling "poetry package-mode" and stumbling onto the release notes, but it requires some cognitive load and digging into the project build internals. I knew what the problem was immediately because I wrote the It would be nice if instead the error could have been:
(at least for versions of poetry going forward) This kind of problem doesn't come up for all the other development dependencies because they have enforced minimum versions (by poetry of course). |
i'd like an option to force the |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Poetry 1.1 is not compatible with 1.0, so we need to enforce Poetry version for our development team one way or another.
There is this Stack Overflow question: https://stackoverflow.com/questions/64003868/how-to-enforce-a-minimum-python-poetry-version which currently is unanswered.
Is there a way of specifying a version of Poetry in pyproject.toml that will fail if the executing version of poetry does not match? What effect does
[build-system] requires
have?The text was updated successfully, but these errors were encountered: