Package Discovery
Package discovery based on Setuptools.
Advantage
- Debug packages that Setuptools discovered
- Easy to filter packages to root packages only
1. Debug packages that Setuptools discovered
You can check the discovered packages by running the following Python code.
print_packages.py:
from packagediscovery import Setuptools
print(Setuptools().packages)
$ python print_packages.py
['packagediscovery']
Since Package Discovery settings of Setuptools is a bit complicated so that we may want to know what packages Setuptools are discovering now.
cf. Package Discovery and Namespace Packages - setuptools documentation
2. Easy to filter packages to root packages only
You can filter the discovered packages to only include root packages by using the root_packages property.
filter_packages.py:
from packagediscovery import Packages, Setuptools
setuptools = Setuptools()
print(f"Packages = {setuptools.packages}")
print(f"Root packages = {Packages(setuptools.packages).list_roots_only}")
$ python filter_packages.py
Packages = ['pyvelocity', 'pyvelocity.checks', 'pyvelocity.configurations', 'pyvelocity.configurations.files', 'pyvelocity.configurations.files.sections', 'pyvelocity.configurations.files.sections.pylint', 'pyvelocity.configurations.tools', 'pyvelocity.configurations.files.sections.pylint', 'pyvelocity.configurations.files.sections', 'pyvelocity.configurations.files', 'pyvelocity.checks', 'pyvelocity.configurations.tools', 'pyvelocity.configurations']
Root packages = ['pyvelocity']
Quickstart
Install the package
$ pip install packagediscovery
How do I...
Discover packages
from packagediscovery import Setuptools
setuptools = Setuptools()
print(f"Packages = {setuptools.packages}")
Discover py modules
from packagediscovery import Setuptools
setuptools = Setuptools()
print(f"Py modules = {setuptools.py_modules}")
Discover project root
from packagediscovery import Setuptools
setuptools = Setuptools()
print(f"Project root = {setuptools.project_root}")
Filter packages to root packages only
from packagediscovery import Packages, Setuptools
setuptools = Setuptools()
print(f"Packages = {setuptools.packages}")
print(f"Root packages = {Packages(setuptools.packages).list_roots_only}")
Credits
This package was created with Cookiecutter and the yukihiko-shinoda/cookiecutter-pypackage project template.
Metadata
Release files for packagediscovery 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| packagediscovery-0.3.0.tar.gz | 11.6 kB | Without provenance | Details for packagediscovery-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| packagediscovery-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for packagediscovery-0.3.0-py3-none-any.whl |
Total release size: 17.8 kB
Release files / packagediscovery-0.3.0.tar.gz
| Download URL | packagediscovery-0.3.0.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58ade07927f126dc0354ac677a39178869921a81279c29193395fb9a6d0adf24
|
|
BLAKE2b-256 checksum How to use checksums |
dc44d10dae339f8949a2f5d51bc338c31ea457721710315821f22dfd46228039
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / packagediscovery-0.3.0-py3-none-any.whl
| Download URL | packagediscovery-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef218a2d3052309290ca66362cbc0923a0cbc42199a3b0730bd4f19b61140c05
|
|
BLAKE2b-256 checksum How to use checksums |
39add6558d90c0c953400197c2382df3f000b87220e103a8745dc4c6248cad27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for packagediscovery 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.