Package discovery based on Setuptools.
Project description
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 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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file packagediscovery-0.2.0.tar.gz.
File metadata
- Download URL: packagediscovery-0.2.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e386efd44b7899d373857004eacc5a5c0f6b2da3884e8ce21bd733f51d093b00
|
|
| MD5 |
e3f1fbcb274c5d70ec32fe2a935cb4b6
|
|
| BLAKE2b-256 |
62149406f2d96299bd2540755977cf1ade8d7e8071f0f911a2b0ac9f4f89f87d
|
File details
Details for the file packagediscovery-0.2.0-py3-none-any.whl.
File metadata
- Download URL: packagediscovery-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
012ab032a936314862bf94dce49fffcbea3fd2ffb47192e7e5084598cdf71c10
|
|
| MD5 |
abfa6778f14f248bc11e6447ee1fae93
|
|
| BLAKE2b-256 |
ef772d015bc6c8df50b37ee5df6236d17d57ea4f4f4c3e2b6ae0c46751014989
|