-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Version parsing/ordering in conda #2071
Comments
Unifying with PyPA would be very good, and I also like getting rid of code that we are maintaining. We should do rigorous regression testing, but overall I support this idea. |
👍 |
This seems like an interesting idea. Generally, I think I am in favor. I just wonder how this will affect some other cases conda tries to address like build numbers, build strings, or cases where we allow 4 numbers in the version string. Some of these can only be known by having a POC to look at. Though the 4th version number is something I am a little worried about. Personally, adding pure Python dependencies don't feel like a bad idea to me. As long as they all get packaged in the miniconda and anaconda install, then it seems fine. These particular ones could be useful at solving other issues that we might have (simplifying Python 2/3 compat, working with grammars more simply in versioning, and other things possibly on the build side). |
@stuarteberg, might be of interest. @ukoethe, I think you would be pretty interested in this and how it shakes out given your existing use cases. |
This is a nice idea, but we should approach it with extreme caution, as you've noted.
That code isn't as old as you might think. Last fall, @ukoethe did a ton of work to fix issues in conda's version ordering scheme. He and @asmeurer hashed out most of the details in #1601, but if you really want to catch up, you should probably read everything in this list. (Have fun...)
See the above-mentioned #1601 for discussion of conda's compliance with PEP440. In particular, this comment and this comment. (But there is no mention of PEP508, as far as I can tell.)
Indeed, these are laudable motivations. If an externally managed library from a reliable source really does cover all of our use-cases, then I guess we must admit that the amount of previous effort that's been sunk into this issue is not so relevant (even if it would be frustrating to discard it).
Of course, it is critical to keep in mind that conda supports multiple languages, and therefore has slightly different requirements than PyPA. For instance, #1652 was implemented specifically for compatibility with R's silly versioning scheme. PS -- PyPA? I might be biased, but as far as I'm concerned, the "authority" on packaging python packages at this point is the Anaconda project. Maybe they should be using our code, not the other way around... :-P |
This is a great discussion. I'm right now not opposed to using some of this same code. I wouldn't want to make it an external dependency, but in this case explicitly vendored in so we can have tight control over it. @stuarteberg Thanks for all of those back references. They're especially useful for me. @groutr Correct me if I'm wrong, but I think creating this ticket was in part motivated by our discussion about conda needing better data modeling. If that's the core of this issue, than it's something I also feel strongly about being critically important. Conda's needs have several layers of generalization beyond PyPA's though, so I'm leery about using |
@stuarteberg thanks for the reminder about conda being more general than the ecosystem that the PyPA oversees. I forget that sometimes, but we definitely need to keep that in mind. Conda is more than pip, in concept and in actuality. |
As @stuarteberg said, I thoroughly revised conda's version comparison just a few months ago. It is clean, carefully tested and well documented code that mostly conforms to PEP 440 and gives good error messages for syntactically incorrect version strings. The remaining differences to PEP 440 are deliberate:
A small omission of conda's code is that Regarding PEP 508: According to the documentation, conda does not currently support the operators |
I'd also like to suggest that work on build string syntax and semantics shoud be a much higher priority than work on version comparison. This would vastly improve conda's ability to reason about binary compatibilty of compiled packages. Observe that version numbers are an attribute of the source code. While version numbers have implications on binary compatibility (especially when semantic versioning is used), neither concept completely covers the other. Conda already recognizes this by encoding important binary properties of a package into the build string, e.g. Even build number comparison (the secondary criterion) is affected by poor build string standardization, because build number parsing fails in certain situations: If the code has not changed in the meantime, the build number 2 is correctly extracted from a build string consisting of a number and a git hash like I propose to define syntax and semantics of build strings with comparable expressivity (but different meaning) as version numbers, and to implement build string comparison with the same sophistication as version comparison. This would empower recipe designers to express constraints on binary package properties as precisely as is already possible with version numbers for source properties. |
I can't agree, @ukoethe, with regard to builds strings. I don't believe build strings should be used for anything but disambiguation of filenames---and we should not be using filenames at all to determine the information about a package. I think the problems that you're seeking to address with regards to binary compatibility are best addressed through dependencies and perhaps through a |
On the question of version numbers, though, I appreciate everyone's education about the history and intent of the current VersionOrder class. I am relatively new to the conda project and rely on on the knowledge of those who have come before me. We agreed yesterday we should tread very carefully on any major revisions to version ordering. In that sense, it might be best if we close this issue to reassure everyone that we're not going to be stepping on toes. That said, one idea we thought of---for the long term, mind you---is to move to a plugin architecture for version ordering. That is to say, we should make it easy to support multiple version ordering schemes in the code, and augment the metadata to allow packages to specify which version ordering scheme they require. |
That's very reasonable as long as the desired functionality is achieved in a different way. But then the build string should be eliminated from version comparison entirely, because the code at I'm also not sure about the future role of the build number (technically a part of the build string). Are higher build numbers simply shadowing lower ones, or is the rule more complex? For example, if build 1 defines a feature, but build 2 doesn't, which one will version resolution consider if the feature is being tracked? If build numbers are to remain a part of the build string and continue to take part in version resolution (which I think will be the case), there should at least be an unambiguous syntax to indetify the build number in the build string, and improved documentation.
This is a good idea, although I'm not sure if a full fledged plugin architecture is necessary. Probably it will be sufficient to provide a small and fixed set of schemes to pick from. Plugins always imply the possibility that a users doesn't have the plugin, which worsens the installation experience. |
Indeed, build strings are being removed from comparison. |
The removal of file name information from the logic is a work in progress. |
I think I agree that build strings should be removed from comparison. It isn't clear to me how a comparison should work in the case of build strings so until we understand what that should be, if any, simple removal looks like the right path. |
I'm glad to see the lively discussion here. I learned a lot from this discussion. @kalefranz, I agree that conda desperately needs to coalesce its ways of internally representing bits of data. The idea that @mcg1969 has about a pluggable interface for version comparisons is interesting. Are there formal versioning schemes the majority of software follows, or is it more per project preferences? I'm already aware of PEP440 for Python, SemVer, and even/odd releases. I imagine each language community has a common "best practice" versioning scheme. Are there others? |
Something to consider (though a bit off topic), we may want more than just pluggable versions systems. In particular, we may want pluggable languages. Versioning is one aspect. Though there are others like integrating with the language's package manager (if it has one). Also, the ability to generate a simple recipe using On these points, I think @alexbw would provide valuable input to this conversation given that he has recently worked on adding Lua support to |
fyi, required by this ticket; |
Hi there, thank you for your contribution to Conda! This issue has been automatically locked since it has not had recent activity after it was closed. Please open a new issue if needed. |
Currently, version parsing and ordering are accomplished in conda via the MatchSpec, VersionSpec, VersionOrder, and Package classes.
I thought I would open discussion on using PyPA's
packaging
module to handle parsing/ordering/comparing versions in conda. There are a few pros and cons that need to be considered though.Documentation: https://packaging.pypa.io/en/latest/
Repository: https://github.com/pypa/packaging
Pros:
packaging
implements PEP440 and PEP508. The current versioning classes in conda seem to implement the older PEP380.Cons:
packaging
depends onsix
andpyparsing
. Conda strives to have as few external dependencies as it can.This issue is for discussion. Is this a desirable change for the conda community? Why or why not? There are also a few other libraries that handle version parsing and ordering, though none seem to be as mature as
packaging
.The text was updated successfully, but these errors were encountered: