# Dependente: Inspect Python package dependencies
Part of the [Fatiando a Terra][fatiando] project
[![Latest release on PyPI](https://img.shields.io/pypi/v/dependente.svg?style=flat-square)][pypi]
[![Latest release on conda-forge](https://img.shields.io/conda/vn/conda-forge/dependente.svg?style=flat-square)][conda-forge]
[![Test coverage report](https://img.shields.io/codecov/c/github/fatiando/dependente/main?style=flat-square)][coverage]
[![Compatible Python versions](https://img.shields.io/pypi/pyversions/dependente.svg?style=flat-square)][pypi]
## 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.
> This project was inspired by some of the GitHub Actions configuration of the
> [MetPy](https://github.com/Unidata/MetPy) project.
## Installing
*Dependente* is available from PyPI:
```
python -m pip install dependente
```
and conda-forge:
```
conda install dependente -c conda-forge
```
## Using
> In these examples, we'll parse the dependencies from
> [Pooch](https://github.com/fatiando/pooch).
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 standard output
Done!
$ cat requirements.txt
# Install (run-time) dependencies from setup.cfg
appdirs>=1.3.0
packaging>=20.0
requests>=2.19.0
```
Also read the build dependencies from `pyproject.toml` and extra dependencies
from `setup.cfg`:
```
$ dependente --source install,build,extras > requirements-all.txt
Extracting dependencies: install,build,extras
Parsing setup.cfg
- 6 dependencies found
Parsing pyproject.toml
- 3 dependencies found
Printing 9 dependencies to standard output
Done!
$ cat requirements-all.txt
# Extra (optional) dependencies from setup.cfg
# extra: progress
tqdm>=4.41.0,<5.0.0
# extra: sftp
paramiko>=2.7.0
# extra: xxhash
xxhash>=1.4.3
# Install (run-time) dependencies from setup.cfg
appdirs>=1.3.0
packaging>=20.0
requests>=2.19.0
# Build dependencies from pyproject.toml
setuptools>=45
wheel
setuptools_scm[toml]>=6.2
```
Pin the dependencies to their oldest supported version (useful for testing
in CI):
```
$ dependente --source install,extras --oldest > requirements-oldest.txt
Extracting dependencies: install,extras
Parsing setup.cfg
- 6 dependencies found
Pinning dependencies to their oldest versions
Printing 6 dependencies to standard output
Done!
$ cat requirements-oldest.txt
# Extra (optional) dependencies from setup.cfg
# extra: progress
tqdm==4.41.0
# extra: sftp
paramiko==2.7.0
# extra: xxhash
xxhash==1.4.3
# Install (run-time) dependencies from setup.cfg
appdirs==1.3.0
packaging==20.0
requests==2.19.0
```
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!
## Dependencies
We use the following dependencies (see `setup.cfg` for specific version
constraints):
* [click](https://click.palletsprojects.com) for building the command-line
interface.
* [tomli](https://github.com/hukkin/tomli) to parse the TOML configuration
files.
## Contacting Us
Find out more about how to reach us at
[fatiando.org/contact][contact]
## Contributing
### Code of conduct
Please note that this project is released with a [Code of Conduct][coc].
By participating in this project you agree to abide by its terms.
### Contributing Guidelines
Please read our
[Contributing Guide][contrib]
to see how you can help and give feedback.
## License
Dependente is free and open-source software distributed under the
[MIT License][license].
[pypi]: https://pypi.org/project/dependente/
[conda-forge]: https://github.com/conda-forge/dependente-feedstock
[coverage]: https://app.codecov.io/gh/fatiando/dependente
[license]: https://github.com/fatiando/dependente/blob/main/LICENSE.txt
[contrib]: https://github.com/fatiando/dependente/blob/main/CONTRIBUTING.md
[coc]: https://github.com/fatiando/community/blob/main/CODE_OF_CONDUCT.md
[fatiando]: https://www.fatiando.org
[contact]: https://www.fatiando.org/contact
Raw data
{
"_id": null,
"home_page": "https://github.com/fatiando/dependente",
"name": "dependente",
"maintainer": "\"Leonardo Uieda\"",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "leouieda@gmail.com",
"keywords": "dependencies,pyproject,setuptools",
"author": "The Dependente Developers",
"author_email": "fatiandoaterra@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/0a/ad/f36b245cd3d7af4071845323ab7a08970070bbd859a0cc3c7163cd93a7eb/dependente-0.3.0.tar.gz",
"platform": "any",
"description": "# Dependente: Inspect Python package dependencies\n\nPart of the [Fatiando a Terra][fatiando] project\n\n[![Latest release on PyPI](https://img.shields.io/pypi/v/dependente.svg?style=flat-square)][pypi]\n[![Latest release on conda-forge](https://img.shields.io/conda/vn/conda-forge/dependente.svg?style=flat-square)][conda-forge]\n[![Test coverage report](https://img.shields.io/codecov/c/github/fatiando/dependente/main?style=flat-square)][coverage]\n[![Compatible Python versions](https://img.shields.io/pypi/pyversions/dependente.svg?style=flat-square)][pypi]\n\n## About\n\n*Dependente* is a small command-line program for extracting\ndependencies from Python project files (`pyproject.toml` and `setup.cfg`)\nand converting them into `requirements.txt`-type files for use with\n`pip` and `conda`.\n\nThe main reason to do so is to control and customize the testing\nenvironment on continuous integration (CI) while avoiding repeating\nthe list of dependencies in multiple places.\n\n> This project was inspired by some of the GitHub Actions configuration of the\n> [MetPy](https://github.com/Unidata/MetPy) project.\n\n## Installing\n\n*Dependente* is available from PyPI:\n\n```\npython -m pip install dependente\n```\n\nand conda-forge:\n\n```\nconda install dependente -c conda-forge\n```\n\n## Using\n\n> In these examples, we'll parse the dependencies from\n> [Pooch](https://github.com/fatiando/pooch).\n\nParse the install (run-time) dependencies from `setup.cfg`:\n\n```\n$ dependente > requirements.txt\nExtracting dependencies: install\nParsing setup.cfg\n - 3 dependencies found\nPrinting 3 dependencies to standard output\nDone!\n\n$ cat requirements.txt\n# Install (run-time) dependencies from setup.cfg\nappdirs>=1.3.0\npackaging>=20.0\nrequests>=2.19.0\n```\n\nAlso read the build dependencies from `pyproject.toml` and extra dependencies\nfrom `setup.cfg`:\n\n```\n$ dependente --source install,build,extras > requirements-all.txt\nExtracting dependencies: install,build,extras\nParsing setup.cfg\n - 6 dependencies found\nParsing pyproject.toml\n - 3 dependencies found\nPrinting 9 dependencies to standard output\nDone!\n\n$ cat requirements-all.txt\n# Extra (optional) dependencies from setup.cfg\n# extra: progress\ntqdm>=4.41.0,<5.0.0\n# extra: sftp\nparamiko>=2.7.0\n# extra: xxhash\nxxhash>=1.4.3\n# Install (run-time) dependencies from setup.cfg\nappdirs>=1.3.0\npackaging>=20.0\nrequests>=2.19.0\n# Build dependencies from pyproject.toml\nsetuptools>=45\nwheel\nsetuptools_scm[toml]>=6.2\n```\n\nPin the dependencies to their oldest supported version (useful for testing\nin CI):\n\n```\n$ dependente --source install,extras --oldest > requirements-oldest.txt\nExtracting dependencies: install,extras\nParsing setup.cfg\n - 6 dependencies found\nPinning dependencies to their oldest versions\nPrinting 6 dependencies to standard output\nDone!\n\n$ cat requirements-oldest.txt\n# Extra (optional) dependencies from setup.cfg\n# extra: progress\ntqdm==4.41.0\n# extra: sftp\nparamiko==2.7.0\n# extra: xxhash\nxxhash==1.4.3\n# Install (run-time) dependencies from setup.cfg\nappdirs==1.3.0\npackaging==20.0\nrequests==2.19.0\n```\n\nSee a full list of options:\n\n```\n$ dependente --help\nUsage: dependente [OPTIONS]\n\n Dependente: Inspect Python package dependencies\n\n Reads from the configuration files in the current directory and outputs to\n stdout a list of dependencies into a format accepted by pip.\n\n Supported formats:\n\n * pyproject.toml (only build-system > requires)\n\n * setup.cfg (install_requires and options.extras_require)\n\nOptions:\n -s, --source TEXT Which sources of dependency information to\n extract. Can be any combination of\n 'install,extras,build'. [default: install]\n -o, --oldest If enabled, will pin dependencies to the oldest\n accepted version. [default: False]\n -v, --verbose / -q, --quiet Print information during execution / Don't\n print [default: verbose]\n --version Show the version and exit.\n -h, --help Show this message and exit.\n```\n\n### Limitations\n\nThe current implementation is a proof-of-concept and has some limitations:\n\n* Input files must be in the current working directory.\n* Reads all extra dependencies simultaneously (can't separate between different\n `option.extras_requires` fields).\n* Only supports reading from `setup.cfg` and `pyproject.toml` (build\n dependencies only).\n\nOf course, all of these could be addressed if there is enough interest.\nIssues and PRs are welcome!\n\n## Dependencies\n\nWe use the following dependencies (see `setup.cfg` for specific version\nconstraints):\n\n* [click](https://click.palletsprojects.com) for building the command-line\n interface.\n* [tomli](https://github.com/hukkin/tomli) to parse the TOML configuration\n files.\n\n## Contacting Us\n\nFind out more about how to reach us at\n[fatiando.org/contact][contact]\n\n## Contributing\n\n### Code of conduct\n\nPlease note that this project is released with a [Code of Conduct][coc].\nBy participating in this project you agree to abide by its terms.\n\n### Contributing Guidelines\n\nPlease read our\n[Contributing Guide][contrib]\nto see how you can help and give feedback.\n\n## License\n\nDependente is free and open-source software distributed under the\n[MIT License][license].\n\n[pypi]: https://pypi.org/project/dependente/\n[conda-forge]: https://github.com/conda-forge/dependente-feedstock\n[coverage]: https://app.codecov.io/gh/fatiando/dependente\n[license]: https://github.com/fatiando/dependente/blob/main/LICENSE.txt\n[contrib]: https://github.com/fatiando/dependente/blob/main/CONTRIBUTING.md\n[coc]: https://github.com/fatiando/community/blob/main/CODE_OF_CONDUCT.md\n[fatiando]: https://www.fatiando.org\n[contact]: https://www.fatiando.org/contact\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Inspect Python package dependencies",
"version": "0.3.0",
"project_urls": {
"Bug Tracker": "https://github.com/fatiando/dependente/issues",
"Homepage": "https://github.com/fatiando/dependente",
"Release Notes": "https://github.com/fatiando/dependente/releases",
"Source Code": "https://github.com/fatiando/dependente"
},
"split_keywords": [
"dependencies",
"pyproject",
"setuptools"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c56cb80a6ca08cc0d37f80e26cca6988a32355492218c3e43673964e7524ae0d",
"md5": "2d40d27967e5bb6040ad17c3c72ed0f9",
"sha256": "51f592688508c0cc9df98240619f76d269cc1761bc4b6a6cbfe54301fffb9421"
},
"downloads": -1,
"filename": "dependente-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2d40d27967e5bb6040ad17c3c72ed0f9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 14532,
"upload_time": "2023-10-06T23:51:45",
"upload_time_iso_8601": "2023-10-06T23:51:45.632393Z",
"url": "https://files.pythonhosted.org/packages/c5/6c/b80a6ca08cc0d37f80e26cca6988a32355492218c3e43673964e7524ae0d/dependente-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0aadf36b245cd3d7af4071845323ab7a08970070bbd859a0cc3c7163cd93a7eb",
"md5": "5c1a3aa19eda697f969d24f2b71c05f0",
"sha256": "3478cd56ece9b9afbe33c4da132e65305ea0ef474b1a906b2d6d79c934cc2452"
},
"downloads": -1,
"filename": "dependente-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "5c1a3aa19eda697f969d24f2b71c05f0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 14635,
"upload_time": "2023-10-06T23:51:47",
"upload_time_iso_8601": "2023-10-06T23:51:47.305319Z",
"url": "https://files.pythonhosted.org/packages/0a/ad/f36b245cd3d7af4071845323ab7a08970070bbd859a0cc3c7163cd93a7eb/dependente-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-06 23:51:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fatiando",
"github_project": "dependente",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "dependente"
}