What is the standard sort order for Python version / version numbers?

Python pipand easy_installfollow some rules for sorting packages by release numbers. What are the rules for numbering beta / release / fix releases so that these tools know what is the newest?

+3
source share
3 answers

This is a sore point for many people. setuptoolsand easy_installhave some pretty weird rules trying to play with everyone. You can read the full rules in the method setuptools parse_version, but here's a summary:

  • . 4.5.6.7 , ("4", "5", "6", "7").

  • - . 2.4.0 - , 2.4; 2.4.05 2.4.5.

  • - . 2.4.a5 2.4.A5.

  • , , "" , , 2.4.5b , , 2.4.5.

  • , "pre", "preview" "rc" , "c". "dev" "@", . x.y.z-dev x.y.z.

, , , PEP 386.

+8

: doc string pkg_resources.py function parse_version().

+2

Source: https://habr.com/ru/post/1725624/


All Articles