Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Store python_requires information instead of guessing it #449
Store python_requires information instead of guessing it #449
Changes from 1 commit
69bac17
aeeae51
929620a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 understand why you think setting a
python_requires
is even necessary in theansible
package. pip already inspectspython_requires
of dependencies likeansible-core
as a part of its dependency resolution process and acts accordingly.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.
Do old versions of pip (that handle
python_requires
at all) also do that?Anyway, I think this information is useful even if it can be indirectly derived, since https://pypi.org/project/ansible/ also shows that information (in
Meta
), and I'm not sure whether it would do that when the package wouldn't explicitly declare it. Also it makes this value available in https://pypi.org/pypi/ansible/json, which other programs might find useful.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.
Yes, that's the idea.
python_requires
is treated similarly to other constraints, like dependency restrictions. Unless there's a bug, that is. But assuming that it's buggy upfront w/o testing seems like a premature optimization to me.https://packaging.python.org/en/latest/specifications/core-metadata/#requires-python
The idea of this metadata field is to declare that a given package itself has restrictions of the Python runtime. But what you're doing is trying to guess whether the dependency is compatible. That dependency is what should have this declaration. OTOH, since
ansible
bundles the code from collections, it could derive its value from them and specify whatever the collections declare (well, the common denominator, I guess), since those collections are the actual content of the distribution being shipped.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 disagree. Ansible is tightly coupled to ansible-core, so it exposing the same
python_requires
as ansible-core is not a premature optimization.That would be totally wrong from my POV. Just because one collection requires Python 3.10 it doesn't mean that other collections cannot work with Python 3.9. Besides collections cannot declare their supported Pyton version, so this discussion is moot anyway.
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.
Coupled, yes. But does not bundle it. Which is why it has its own metadata (name, version, deps). And
Requires-Python
is just one of those dependency declarations.Okay, the right solution would be the lowest supported by any collection, then.
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 agree with @felixfontein here. The only reasonable
python_requires
for ansible is the same one as ansible-core. It wouldn't make sense to include Python 2.7 in the version range even though most modules still support that. Modules aren't run by the ansible controller. The requirement for controller plugins is that they support and interface with the ansible bundle's ansible-core version. Sure, in isolation, many controller plugins will work with older ansible-core/Python versions, but that's not relevant to the ansible bundle. Controller plugins in ansible 6 by definition aren't compatible with Python 3.6, because the controller, ansible-core 2.13, doesn't support that. Setting this to the same value as ansible-core is the most reasonable approach, and it provides a stronger defence against dependency issues, even if pip is supposed to figure this out on its own.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 never talked about modules that execute on remote targets, though. You're right, only what executes on the controller should influence the metadata.
But, with my PyPA hat on, my argument is that this is a premature attempt to solve a non-existing problem by declaring unnecessary metadata. If you think that this theoretical problem with ansible-core is actually possible, would you mind demonstrating 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.
The controller-side plugins in community.general still support Python 2.7. (The libraries that some of these require might not, though.)
I still don't see why we should remove this value, even if it would be a premature optimization (which I disagree it is).
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 think that the argument about copying the restriction from ansible-core is weak because it's already there in the dependency. By doing so, we'd just be providing inaccurate metadata. But if the argument is that "we think that this bundle of collections should work in certain runtimes", maybe it'd be reasonable for as long as it's decided based on the collections being included and factors that influence the project directly.
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.
It is not inaccurate, it is very accurate. Ansible (the Python package) is ansible-core of a very specific version (which has a very specific Python requirement) combined with the content of collections.