Python's pip
and easy_install
follow some rules to sort packages by their release numbers. What are the rules for numbering beta/release/bugfix releases so these tools will know which is the newest?
This is a sore point for many folks. setuptools
and easy_install
have some rather bizarre rules in an attempt to play nice with everybody. You can read the full rules in setuptools
's parse_version
method, but here's the summary:
Version numbers are broken up by dots into a tuple of that many segments. 4.5.6.7 is parsed into a tuple equal to ("4", "5", "6", "7")
.
Trailing zeroes between dashes or alphanumerics are suppressed. 2.4.0 is the same as 2.4; 2.4.05 is the same as 2.4.5.
Alphanumeric parts are downcased. 2.4.a5 is equal to 2.4.A5.
Strings that come before "final" alphabetically are assumed to be pre-release versions, so 2.4.5b comes before, not after, 2.4.5.
Finally, "pre", "preview", and "rc" are treated as if they were "c". The word "dev" is replaced with "@", so that it comes before anything else with the same version. That is, xyz-dev
is guaranteed to come before any other xyz
version.
There are a number of proposals to organize things a bit more, of which the most popular is probably PEP 386 .
请参阅文档或查看pkg_resources.py函数parse_version()中的source:doc字符串。
Use 1.0a1 and 1.0b2 before 1.0.
The upcoming standard:
Current setuptools: http://peak.telecommunity.com/DevCenter/setuptools#specifying-your-project-s-version
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.