Skip to content

mottosso/iscompatible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python versioning with requirements.txt syntax

Build Status PyPI version Coverage Status

iscompatible gives you the power of the pip requirements.txt syntax for everyday python packages, modules, classes or arbitrary functions. Supports Python 2.6-2.7 and Python 3.2-3.3, licensed under MIT.


Install

iscompatible can be found via PyPI.

$ pip install iscompatible

Usage

The module contains a single function called iscompatible.

>>> from iscompatible import iscompatible
>>> iscompatible("foo>=5", (5, 6, 1))
True
>>> iscompatible("foo>=5.6.1, <5.7", (5, 0, 0))
False
>>> MyPlugin = type("MyPlugin", (), {'version': (5, 6, 1)})
>>> iscompatible("foo==5.6.1", MyPlugin.version)
True

Example

The requirements.txt syntax allows you to specify inexact matches between a set of requirements and a version. For example, let's assume that the single package foo-5.6.1 exists on disk. The following requirements are all compatible with foo-5.6.1.

Requirement Description
foo any version of foo
foo>=5 any version of foo, above or equal to 5
foo>=5.6 any version of foo, above or equal to 5.6
foo==5.6.1 exact match
foo>5 foo-5 or greater, including minor and patch
foo>5, <5.7 foo-5 or greater, but less than foo-5.7
foo>0, <5.7 any foo version less than foo-5.7

About

Python versioning with PyPI requirements.txt syntax

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages