Skip to main content

Inspect Python package dependencies

Project description

Dependente: Inspect Python package dependencies

Part of the Fatiando a Terra project

Latest release on PyPI Latest release on conda-forge Test coverage report Compatible Python versions

About

Dependente is a small command-line program for extracting dependencies from Python project files (pyproject.toml and setup.cfg) and converting them into requirements.txt-type files for use with pip and conda.

The main reason to do so is to control and customize the testing environment on continuous integration (CI) while avoiding repeating the list of dependencies in multiple places.

Installing

Dependente is available from PyPI:

python -m pip install dependente

and conda-forge:

conda install dependente -c conda-forge

Using

Parse the install (run-time) dependencies from setup.cfg:

$ dependente > requirements.txt
🚀 Extracting dependencies: install
🔎 Parsing setup.cfg
   - 3 dependencies found
🖨  Printing 3 dependencies to the standard output stream
🥳 Done! 🥳

$ cat requirements.txt
# Install (run-time) dependencies from setup.cfg
click>=8.0.0,<9.0.0
rich>=9.6.0,<11.0.0
tomli>=1.1.0,<3.0.0

Pin the dependencies to their oldest supported version (useful for testing in CI):

$ dependente --oldest > requirements-oldest.txt
🚀 Extracting dependencies: install
🔎 Parsing setup.cfg
   - 3 dependencies found
🕰  Pinning dependencies to their oldest versions
🖨  Printing 3 dependencies to the standard output stream
🥳 Done! 🥳

$ cat requirements-oldest.txt
# Install (run-time) dependencies from setup.cfg
click==8.0.0
rich==9.6.0
tomli==1.1.0

Read build dependencies from pyproject.toml:

$ dependente --source build > requirements-build.txt
🚀 Extracting dependencies: build
🔎 Parsing pyproject.toml
   - 3 dependencies found
🖨  Printing 3 dependencies to the standard output stream
🥳 Done! 🥳

$ cat requirements-build.txt
# Build dependencies from pyproject.toml
setuptools>=45
setuptools_scm[toml]>=6.2
wheel

See a full list of options:

$ dependente --help
Usage: dependente [OPTIONS]

  Dependente: Inspect Python package dependencies

  Reads from the configuration files in the current directory and outputs to
  stdout a list of dependencies into a format accepted by pip.

  Supported formats:

  * pyproject.toml (only build-system > requires)

  * setup.cfg (install_requires and options.extras_require)

Options:
  -s, --source TEXT            Which sources of dependency information to
                               extract. Can be any combination of
                               'install,extras,build'.  [default: install]
  -o, --oldest                 If enabled, will pin dependencies to the oldest
                               accepted version.  [default: False]
  -v, --verbose / -q, --quiet  Print information during execution / Don't
                               print  [default: verbose]
  --version                    Show the version and exit.
  -h, --help                   Show this message and exit.

Limitations

The current implementation is a proof-of-concept and has some limitations:

  • Input files must be in the current working directory.
  • Reads all extra dependencies simultaneously (can't separate between different option.extras_requires fields).
  • Only supports reading from setup.cfg and pyproject.toml (build dependencies only).

Of course, all of these could be addressed if there is enough interest. Issues and PRs are welcome!

Contacting Us

Find out more about how to reach us at fatiando.org/contact

Contributing

Code of conduct

Please note that this project is released with a Code of Conduct. By participating in this project you agree to abide by its terms.

Contributing Guidelines

Please read our Contributing Guide to see how you can help and give feedback.

License

Dependente is free and open-source software distributed under the MIT License.

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

dependente-0.1.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dependente-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file dependente-0.1.0.tar.gz.

File metadata

  • Download URL: dependente-0.1.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for dependente-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f768e037d8cbaf58fd9ba6378058f593a8db962836ba498f9c0612c1afb48ec0
MD5 de138e1eb7625eff18e0411ac95921f5
BLAKE2b-256 bc6cff2645ca2d40109f550f78339ef3927201a89d48d446248c6fc1e80d3df8

See more details on using hashes here.

File details

Details for the file dependente-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dependente-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for dependente-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfa1572880f564f835365b6e77a4b496d23d23dd3cce292685fff1cd79113a15
MD5 c9dfbd1786a9c749bfb48316da795d52
BLAKE2b-256 a64ce0c6bf758685ad4a82d49caedbfc1be7e8c5f59c87ffa314cc7033e8bc66

See more details on using hashes here.

Supported by

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