Use packaging.version for comparing versions
See original GitHub issueBecause distutils.Version
is deprecated, we have our own _compare_version
function (https://github.com/mne-tools/mne-python/blob/main/mne/fixes.py#L32-L55). However, I was wondering (1) why this is in fixes and (2) why we do not use packaging.version.Version
instead (which according to the DeprecationWarning
is the recommended replacement). I’m happy to implement the changes (and probably move it back to utils
?) if you think it makes sense. @hoechenberger WDYT?
Edit: Then we could also remove the corresponding warning filter.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:18 (18 by maintainers)
Top Results From Across the Web
How do I compare version numbers in Python? - Stack Overflow
Use packaging.version.parse . >>> # pip install packaging >>> from packaging import version >>> version.parse("2.3.1") ...
Read more >Version Handling - Packaging
This class abstracts handling of a project's versions. A Version instance is comparison aware and can be compared and sorted using the standard...
Read more >Compare two Version numbers - GeeksforGeeks
Implement a method to compare the two versions. If there are more than two versions, then the below versionCompare method can be used...
Read more >Comparing package versions | Puppet Cookbook - Third Edition
Package version numbers are odd things. ... Comparing package versions ... And a numeric comparison won't work because they're not valid numbers.
Read more >compare-versions - npm
Compare semver version strings to find greater, equal or lesser. Runs in the browser as well as Node.js/React Native etc. Has no dependencies ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, we should require a comment for every new filter warning! Maybe someone has the time to check which of these filters are not even necessary anymore?
I’d also try to vendor as few packages as possible, especially when we’re talking about core packages provided by pypa.
no opinion