Skip to main content

pymin_reqs

This module attempt to make a minimal requirements.txt file based on the imports are used inside of the code of your project, .py files. These requirements are a subset of what would be given using pip freeze or conda list --export as these commands give everything that is used inside of the Python environment. This is useful if a project is used inside of a shared environment or if you want a cleaner requirements.txt that only has your imported modules but not the dependencies, and sub-dependencies, of those modules.

Install With Pip

python3 -m pip install pymin-reqs

Usage

usage: pymin_reqs [-h] [-d DIRECTORY] [--conda] [--pip] [-f] [-s] [-v] [-e] [-o OUTFILE]

optional arguments:
  -h, --help            show this help message and exit
  -d DIRECTORY, --directory DIRECTORY
                        Specify the input directory. Default: '.'
  --conda               Output conda requirements instead of pip. Use --pip --conda to show both
  --pip                 Show pip requirements. not required by default unless --conda is also specified
  -f, --force           Force overwrite of the given file in --outfile
  -s, --stats           Show import locations and count of imported modules.
  -v, --verbose         Verbose mode
  -e, --ignore-errors   Ignore errors when possible
  -o OUTFILE, --outfile OUTFILE
                        Specify the output file. Default 'requirements.txt'

Examples

Show requirements on command line

pymin_reqs

Output requirements to a file "requirements.txt"

pymin_reqs -o requirements.txt

Output requirements to a file "requirements.txt" and force overwrite

pymin_reqs -f -o requirements.txt

This module uses the abstract syntax tree(ast module) to find imports. If there are invalid python file this might cause errors in parsing. To get around this you can specify --ignore-errors

pymin_reqs --ignore-errors

Example output from commands

pip==20.2.4
setuptools==50.3.1

Release files for pymin-reqs 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymin-reqs 1.0.2
File Size Uploaded
pymin-reqs-1.0.2.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymin-reqs 1.0.2
File Interpreter ABI Platform
pymin_reqs-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / pymin-reqs-1.0.2.tar.gz

Download URL pymin-reqs-1.0.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c13e193cc94d1d618bdd0025a5ac49d90ad1da42c487c6c222d5dd664c64741a
BLAKE2b-256 checksum
How to use checksums
e6a50b3865a236818c1ef7376a5fd43328aabf3752611f042bbb1d8294b09051
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.6.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release files / pymin_reqs-1.0.2-py3-none-any.whl

Download URL pymin_reqs-1.0.2-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b4684c6f407be94f0ac00da76b7e60b87c0b3372bcbed4149efd6b15ced09f2
BLAKE2b-256 checksum
How to use checksums
ca3abd430a4910269f043b8fea0410d17755097f53e84694a0fd54633a62d8c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.6.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page