Skip to main content

Package discovery based on Setuptools.

Project description

Package Discovery

Test CodeQL Code Coverage Maintainability Dependabot PyPI - Python Version Twitter URL

Package discovery based on Setuptools.

Advantage

  1. Debug packages that Setuptools discovered
  2. 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

packagediscovery-0.3.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

packagediscovery-0.3.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file packagediscovery-0.3.0.tar.gz.

File metadata

  • Download URL: packagediscovery-0.3.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for packagediscovery-0.3.0.tar.gz
Algorithm Hash digest
SHA256 58ade07927f126dc0354ac677a39178869921a81279c29193395fb9a6d0adf24
MD5 477b15a61cba1043e792701351e96e8d
BLAKE2b-256 dc44d10dae339f8949a2f5d51bc338c31ea457721710315821f22dfd46228039

See more details on using hashes here.

File details

Details for the file packagediscovery-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for packagediscovery-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef218a2d3052309290ca66362cbc0923a0cbc42199a3b0730bd4f19b61140c05
MD5 b7d8a971cee01ca9f8780a5a7e77d30e
BLAKE2b-256 39add6558d90c0c953400197c2382df3f000b87220e103a8745dc4c6248cad27

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