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
Metadata
Release files for minimum-dependencies 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| minimum_dependencies-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / minimum_dependencies-0.1.0-py3-none-any.whl
| Download URL | minimum_dependencies-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1aeec019c8dd1d430246633eb519665335f2bd24340ec9976c87e74a6ff5abd8
|
|
BLAKE2b-256 checksum How to use checksums |
e04f1a10a5cefe1b36e9a3b80d8ce6d88cb80645ac2168615f8602e83fe5d52f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|