Skip to main content

Find packages that should be in requirements for a project

Project description

It happens: you start using a module in your project and it works and you don’t realise that it’s only being included in your virtualenv because it’s a dependency of a package you’re using. This tool finds those modules so you can include them in the requirements.txt for the project.

Assuming your project follows a layout like the suggested sample project:

setup.py
setup.cfg
requirements.txt
sample/__init__.py
sample/sample.py
sample/tests/test_sample.py

Basic usage, running in your project directory:

<activate virtualenv for your project>
pip-missing-reqs --ignore-files=sample/tests/* sample

This will find all imports in the code in “sample” and check that the packages those modules belong to are in the requirements.txt file.

Sample tox.ini configuration

To make your life easier, copy something like this into your tox.ini:

[pip-missing-reqs]
deps=-rrequirements.txt
commands=pip-missing-reqs --ignore-files=sample/tests/* sample

Excluding test files (or others) from this check

Your test files will sometimes be present in the same directory as your application source (“sample” in the above examples). The requirements for those tests generally should not be in the requirements.txt file, and you don’t want this tool to generate false hits for those.

You may exclude those test files from your check using the –ignore-files option.

Excluding modules from the check

If your project has modules which are conditionally imported, or requirements which are conditionally included, you may exclude certain modules from the check by name (or glob pattern) using –ignore-mods:

# ignore the module spam
pip-missing-reqs --ignore-mods=spam sample
# ignore the whole package spam as well
pip-missing-reqs --ignore-mods=spam --ignore-mods=spam.* sample

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pip_missing_reqs-1.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

pip_missing_reqs-1.1.0-py2.py3-none-any.whl (19.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pip_missing_reqs-1.1.0.tar.gz.

File metadata

File hashes

Hashes for pip_missing_reqs-1.1.0.tar.gz
Algorithm Hash digest
SHA256 eb76ad5ac764ac92b307a051ebdb89285c0aa8af1c0d5edd64aa29d7c6a9fca0
MD5 44f7020eb04d0c0dd8bc88de5b0053b1
BLAKE2b-256 4d8d0c6ae7b024f23ba8fcfa03c6f5185f90ee95534947bfa98ba0882f007c26

See more details on using hashes here.

File details

Details for the file pip_missing_reqs-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pip_missing_reqs-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d7e3f0d1d422a86635b758f900458692fb3dcd7050f9c3c6fb68fa822ce00302
MD5 d1275e5e007d9ff53f710e3bafe7ef3c
BLAKE2b-256 06b9b29cef2d9f1520d0341ec013ad289a8b26cf2bb42646c728f6a6993e279b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page