Skip to content

Use packaging.version instead of pkg_resources.parse_version by default#180

Closed
felixonmars wants to merge 1 commit intolilydjwg:masterfrom
felixonmars:packaging-version
Closed

Use packaging.version instead of pkg_resources.parse_version by default#180
felixonmars wants to merge 1 commit intolilydjwg:masterfrom
felixonmars:packaging-version

Conversation

@felixonmars
Copy link
Copy Markdown
Contributor

packaging.version is the new standard and should be preferred now. It
reduces startup time significantly too as pkg_resources is expensive to
import.

parse_version is only kept for compatibility here, perhaps consider
removing it in the future.

packaging.version is the new standard and should be preferred now. It
reduces startup time significantly too as pkg_resources is expensive to
import.

parse_version is only kept for compatibility here, perhaps consider
removing it in the future.
@felixonmars
Copy link
Copy Markdown
Contributor Author

The test failures are irrelevant.

@lilydjwg
Copy link
Copy Markdown
Owner

lilydjwg commented May 6, 2021

The issue with packaging.version is that, it's designed to work with Python packages' versions only. Something like R2020 or 1.1.1.k will fall back to LegacyVersion which is going to be removed soon.

We may need to implement a loose version comparison algorithm ourselves.

@yan12125
Copy link
Copy Markdown
Contributor

yan12125 commented May 6, 2021

Test failures are addressed in #181

@felixonmars
Copy link
Copy Markdown
Contributor Author

Something like R2020 or 1.1.1.k will fall back to LegacyVersion which is going to be removed soon.

pkg_resources.parse_version uses the same code here, IIRC. (The LegacyVersion warning is also present in current test implementation.)

@lilydjwg lilydjwg closed this in 606b3f6 Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants