Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The requires_python attribute is optional. This attribute allows the extension to specify the versions of Python it can work with.   A The requires_python value The syntax and semantics are a subset of PEP 440 version specifiers. Its value consists of one or more version specifier clauses delimited by commas. A specifier clause consists of a comparison operator and a version number. if not specified, a default value of >=2.7 will be used.  Valid comparison operators are as follows:

OperatorMeaning
==Equal to
!=Not equal to
<Less than to
<=Less than or equal to
>Greater than
>=Greater than or equal to

A single version specifier consists of one of the above operators, followed by a version which must use one of these formats.

Major
Minor
PatchNote
Number



Equivalent to

...

Number.0.0
Number.Number

Equivalent to Number.Number.0
Number.Number.Number
Number.*


Number*


Equivalent to Number.*
Number.Number.*
Number.Number*
Equivalent to Number.Number.*

The wildcard * is used in place of the minor number to mean that any version with a matching major number matches the specifier; or in place of the patch number to mean that any version with a matching major and minor number matches the specifier.

For example:

!=2*,!=3.9.*No 2 version, and no 3.9 version<2,>=3,<3.9,>=4Less than 2.0.0, and greater or equal to 3.0.0, and less than 3.9.0 and greater or equal to 4.0.0!=2*,!=3.*No 2 version, and no 3 version
==2.7.*,>=3.5Any 2.7 version, and greater than or equal to 3.5.0>=2.7.0,<=2.8Greater than or equal to 2.7.0, and less than or equal to 2.8.0==3.11.2Equal to 3.11.2
>=3.6Greater than or equal to 3.6.0==2.8.*Any 2.8 version>3.6.*Greater than any 3.6 version

The comparison algorithm is as follows: given Python versions A and B,

  1. If A.major > B.major, A > B
  2. If A.major < B.major, A < B

  3. If either A.minor or B.minor is a wildcard, A == B

  4. If A.minor > B.minor, A > B

  5. If A.minor < B.minor, A < B

  6. If either A.patch or B.patch is a wildcard, A == B

  7. If A.patch > B.patch, A > B

  8. If A.patch < B.patch, A < B

  9. A == B

python_extra_paths

The python_extra_paths attribute is optional.  This attribute provides a means for the extension developer to specify additional paths that will be included in the Python runtime environment in which the extension runs. Since it is impossible for the extension developer to know the path to the deployed extension at runtime, a special token is provided that will resolve to the deployed extension path at runtime: ${extension_zip}.

...