A constraint on a package version.
Parameters: |
|
---|
Constraint has a convenient parse static method to parse constrints strings into Constraint objects.
Constraint strings are composed of a constraint operator, followed by a valid version string.
Valid constraint operators: ==, !=, <, >, <= and >=.
Examples:
>>> from versions import Constraint, Version
>>> Constraint.parse('>1').match('2')
True
>>> Constraint.parse('<2').match(Version.parse('1'))
True
>>> '1.5' in Constraint.parse('== 1.0')
False
>>> Version(1, 5) in Constraint.parse('> 1.0')
True
>>> Version(1) in Constraint.parse('>= 2.0.0')
False