|
| 1 | +python-inspector - inspect Python packages dependencies and metadata |
| 2 | +===================================================================== |
| 3 | + |
| 4 | +Copyright (c) nexB Inc. and others. |
| 5 | +SPDX-License-Identifier: Apache-2.0 |
| 6 | +Homepage: https://github.com/aboutcode-org/python-inspector and https://www.aboutcode.org/ |
| 7 | + |
| 8 | +``python-inspector`` is a collection of utilities to: |
| 9 | + |
| 10 | +- resolve PyPI packages dependencies |
| 11 | + |
| 12 | +- parse various requirements.txt files and setup.py files as input |
| 13 | + for resolving dependencies. |
| 14 | + |
| 15 | +- parse additionally various manifests and packages files such as |
| 16 | + Pipfile, pyproject.toml, poetry.lock and setup.cfg and legacy and |
| 17 | + current metadata file formats for eggs, wheels and sdist. These |
| 18 | + have not been wired with the command line yet. |
| 19 | + |
| 20 | +- query PyPI JSON and simple APIs for package information |
| 21 | + |
| 22 | +It grew out of ScanCode toolkit to find and analyze PyPI archives and |
| 23 | +installed Python packages and their files. |
| 24 | + |
| 25 | +The goal of python-inspector is to be a comprehensive library |
| 26 | +that can handle every style of Python package layouts, manifests and lockfiles. |
| 27 | + |
| 28 | +Developing |
| 29 | +---------- |
| 30 | + |
| 31 | +- [Install Astral Uv](https://docs.astral.sh/uv/getting-started/installation/). For convenience: |
| 32 | + |
| 33 | + - Isolated: `pipx install uv` |
| 34 | + - Regular: `pip install uv` |
| 35 | + |
| 36 | +- (Optional) Configure pre-commit for commit linter checks: |
| 37 | + |
| 38 | +```bash |
| 39 | + pre-commit install |
| 40 | + pre-commit install --hook-type commit-msg |
| 41 | +``` |
| 42 | + |
| 43 | +- Run from development. A virtual .venv will be created if you not have one |
| 44 | + |
| 45 | +```bash |
| 46 | +uv run python-inspector --help |
| 47 | +``` |
| 48 | + |
| 49 | +Testing |
| 50 | +-------- |
| 51 | + |
| 52 | +- Run the tests. Tests have a special dependency group with their requirements for text exclusively: |
| 53 | + |
| 54 | +```bash |
| 55 | +uv sync --group=test |
| 56 | +uv pytest -vvs |
| 57 | +``` |
| 58 | + |
| 59 | +- These are live tests to regenrate the tests with updated data run:: |
| 60 | + |
| 61 | +```bash |
| 62 | +uv sync |
| 63 | +PYINSP_REGEN_TEST_FIXTURES=yes uv run pytest -vvs |
| 64 | +``` |
| 65 | + |
| 66 | +Documentation |
| 67 | +------------- |
| 68 | + |
| 69 | +```bash |
| 70 | +uv sync --all-groups |
| 71 | +hatch run validate-docs |
| 72 | +``` |
| 73 | + |
| 74 | +Usage |
| 75 | +-------- |
| 76 | + |
| 77 | +- Install with pip: |
| 78 | + |
| 79 | + ```bash |
| 80 | + pip install git+https://github.com/aboutcode-org/python-inspector |
| 81 | + ``` |
| 82 | + |
| 83 | +- Run the command line utility with:: |
| 84 | + |
| 85 | +```bash |
| 86 | +python-inspector --help |
| 87 | +``` |
| 88 | + |
| 89 | +Its companion libraries are: |
| 90 | + |
| 91 | +- ``pip-requirements-parser``, a mostly correct pip requirements parsing |
| 92 | + library extracted from pip. |
| 93 | + |
| 94 | +- ``pkginfo2``, a safer fork of pkginfo to parse various installed and extracted |
| 95 | + package layouts and their metadata files. |
| 96 | + |
| 97 | +- ``dparse2``, a safer fork of dparse to parse various package manifests |
| 98 | + |
| 99 | +- ``resolvelib``, the library used by pip for dependency resolution |
| 100 | + |
| 101 | +- ``packaging``, the official Python packaging utility library to process |
| 102 | + versions, specifiers, markers and other packaging data formats. |
| 103 | + |
| 104 | +- ``importlib_metadata``, the official Python utility library to process |
| 105 | + installed site-packages and their metadata formats. |
| 106 | + |
| 107 | +- ``packageurl-python`` to use Package URL to reference Python packages |
| 108 | + |
| 109 | +Acknowledgements, Funding, Support and Sponsoring |
| 110 | +-------------------------------------------------------- |
| 111 | + |
| 112 | +This project is funded, supported and sponsored by: |
| 113 | + |
| 114 | +- Generous support and contributions from users like you! |
| 115 | +- the European Commission NGI programme |
| 116 | +- the NLnet Foundation |
| 117 | +- the Swiss State Secretariat for Education, Research and Innovation (SERI) |
| 118 | +- Google, including the Google Summer of Code and the Google Seasons of Doc programmes |
| 119 | +- Mercedes-Benz Group |
| 120 | +- Microsoft and Microsoft Azure |
| 121 | +- AboutCode ASBL |
| 122 | +- nexB Inc. |
| 123 | +- Cariad SE |
| 124 | + |
| 125 | +<p align="left"> |
| 126 | + <a href="http://ec.europa.eu/index_en.htm" target="_blank"><img src="https://ngi.eu/wp-content/uploads/sites/77/2017/10/bandiera_stelle.png" height="40" alt="Europa logo"></a> |
| 127 | + |
| 128 | + <a href="https://commission.europa.eu/about-european-commission/departments-and-executive-agencies/communications-networks-content-and-technology_en" target="_blank"><img src="https://commission.europa.eu/themes/contrib/oe_theme/dist/ec/images/logo/positive/logo-ec--en.svg" height="40" alt="EC DG Connect logo"></a> |
| 129 | +</p> |
| 130 | + |
| 131 | +<p align="left"> |
| 132 | + <a href="https://ngi.eu35" target="_blank"><img src="https://ngi.eu/wp-content/uploads/thegem-logos/logo_8269bc6efcf731d34b6385775d76511d_1x.png" height="50" alt="NGI logo"></a> |
| 133 | + |
| 134 | + <a href="https://nlnet.nl" target="_blank"><img src="https://nlnet.nl/logo/banner.png" height="50" alt="NLnet foundation logo"></a> |
| 135 | +</p> |
| 136 | + |
| 137 | +<p align="left"> |
| 138 | + <a href="https://aboutcode.org/" target="_blank"><img src="https://aboutcode.org/wp-content/uploads/2023/10/AboutCode.svg" height="30" alt="AboutCode logo"></a> |
| 139 | + |
| 140 | + <a href="https://nexb.com" target="_blank"><img src="https://nexb.com/wp-content/uploads/2022/04/nexB.svg" height="30" alt="nexB logo"></a> |
| 141 | +</p> |
| 142 | + |
| 143 | +This project was funded through the NGI0 Discovery Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 825322. |
| 144 | + |
| 145 | +<p align="left"> |
| 146 | + <a href="https://nlnet.nl/project/vulnerabilitydatabase/" target="_blank"><img src="https://nlnet.nl/image/logos/NGI0Discovery_tag.svg" height="40" alt="NGI Discovery logo"></a> |
| 147 | +</p> |
| 148 | + |
| 149 | +This project was funded through the NGI0 Core Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 101092990. |
| 150 | + |
| 151 | +<p align="left"> |
| 152 | + <a href="https://nlnet.nl/project/Back2source-next/" target="_blank"><img src="https://nlnet.nl/image/logos/NGI0_tag.svg" height="40" alt="NGI Zero Core Logo"></a> |
| 153 | +</p> |
0 commit comments