Python functions to get top-level importables names
0

Configure Feed

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

Python 99.6%
Other 0.4%
32 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

pygetimportables#

Documentation Status Code style: ruff-format PyPI

Python functions to get top-level importable names from a source tree or 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 pygetimportables

Usage#

To get the top-level importable names directly from a source tree:

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

To get the top-level importable names from an already built wheel:

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

Development#

To run style checks:

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