Get the minimum dependencies of a Python package
Project description
Generate the minimum dependencies for a Python project based on the lower pins.
Installation
This package is available on PyPI. You can install it with pip:
$ pip install minimum_dependencies
Usage
minumum_dependencies can be used as a command line tool or as a library.
CLI
The manpage for the CLI tool is below:
$ minimum_dependencies --help
usage: minimum_deps [-h] [--filename FILENAME] [--extras [EXTRAS ...]] package
Generate the minimum requirements for a package based on the lower pins of its dependencies.
positional arguments:
package Name of the package to generate requirements for
options:
-h, --help show this help message and exit
--filename FILENAME, -f FILENAME
Name of the file to write out
--extras [EXTRAS ...], -e [EXTRAS ...]
List of optional dependency sets to include
For example, to generate the minimum dependencies for minimum_dependencies:
$ minimum_dependencies requests
importlib-metadata==4.11.4
packaging==23.0
requests==2.25.0
Similarly, to generate this with some of its optional dependencies (test and other):
$ minimum_dependencies minimum_dependencies --extras test other
importlib-metadata==4.11.4
packaging==23.0
requests==2.25.0
astropy[all]==5.0
pytest==6.0.0
pytest-doctestplus==0.12.0
Library Usage
- The library provides two public functions:
create: takes a package name and returns a list of requirement strings.
write: takes a package name and a filename and writes the requirements to the file.
For example, to generate the minimum dependencies for minimum_dependencies:
>>> import minimum_dependencies
>>> minimum_dependencies.create("minimum_dependencies")
['importlib-metadata==4.11.4\n', 'packaging==23.0\n', 'requests==2.25.0\n']
>>> minimum_dependencies.write(
... "minimum_dependencies", "requirements.txt"
... ) # writes the requirements to requirements.txt
One can also pass these methods a list of extras (optional installs for the package) to include in the requirements. For example, to generate the minimum dependencies for minimum_dependencies with all its optional dependencies:
>>> import minimum_dependencies
>>> minimum_dependencies.create("minimum_dependencies", extras=["test", "other"])
['importlib-metadata==4.11.4\n', 'packaging==23.0\n', 'requests==2.25.0\n',
'astropy[all]==5.0\n', 'pytest==6.0.0\n', 'pytest-doctestplus==0.12.0\n']
>>> minimum_dependencies.write(
... "minimum_dependencies", "requirements.txt", extras=["test", "other"]
... ) # writes the requirements to requirements.txt
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file minimum_dependencies-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: minimum_dependencies-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aeec019c8dd1d430246633eb519665335f2bd24340ec9976c87e74a6ff5abd8 |
|
MD5 | 4c3640f0971c24c47c36f95c349b86df |
|
BLAKE2b-256 | e04f1a10a5cefe1b36e9a3b80d8ce6d88cb80645ac2168615f8602e83fe5d52f |