Skip to main content

requirements.txt

The requirements.txt file is used to list custom Python packages required for script execution.

For more details, please refer to Python Packages.

Syntax

To specify the version of a Python package in the requirements.txt file, you can use the following syntax:

package == version       # Installs the exact version specified
package > version # Installs a version greater than the specified version
package >= version # Installs a version greater than or equal to the specified version
package < version # Installs a version less than the specified version
package <= version # Installs a version less than or equal to the specified version
package != version # Installs a version other than the specified version
package ~= version # Installs a compatible release of the specified version

You can also specify multiple conditions for a package by separating them with a comma, like this:

package >= 1.0, <= 2.0    # Installs a version between 1.0 and 2.0, inclusive

Example

###### Requirements without Version Specifiers ######
nose
nose-cov
beautifulsoup4

###### Requirements with Version Specifiers ######
docopt == 0.6.1 # Version Matching. Must be version 0.6.1
keyring >= 4.1.1 # Minimum version 4.1.1
coverage != 3.5 # Version Exclusion. Anything except version 3.5
Mopidy-Dirble ~= 1.1 # Compatible release. Same as >= 1.1, == 1.*