Python functions to get top-level importables names
0

Configure Feed

Select the types of activity you want to include in your feed.

8 1 0

Clone this repository

https://tangled.org/juanlu.space/pygetimportables https://tangled.org/did:plc:noxxczvs3ftk2phlds2v2edr
git@knot.juanlu.space:juanlu.space/pygetimportables git@knot.juanlu.space:did:plc:noxxczvs3ftk2phlds2v2edr

For self-hosted knots, clone URLs may differ based on your setup.



README.md

pygetpackages#

Documentation Status Code style: ruff-format PyPI

Python functions to get packages from a source tree and an already built wheel.

See https://discuss.python.org/t/script-to-get-top-level-packages-from-source-tree/40232?u=astrojuanlu

Installation#

To install, run

(.venv) $ pip install pygetpackages

Usage#

To get the packages directly from a source tree:

>>> from pygetpackages import get_packages
>>> get_packages(".")  # Wait a few seconds, requires working `pip install`
{'pygetpackages'}

To get packages from an already built wheel:

(.venv) $ python -m build
...
(.venv) $ python -q
>>> from pygetpackages import get_packages_from_wheel
>>> get_packages_from_wheel("dist/pygetpackages-0.1.0+d20231204-py3-none-any.whl")  # Fast
{'pygetpackages'}

Development#

To run style checks:

(.venv) $ pip install pre-commit
(.venv) $ pre-commit -a