Python functions to get top-level importable names
Project description
pygetimportables
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
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file pygetimportables-0.3.0.tar.gz
.
File metadata
- Download URL: pygetimportables-0.3.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cd28d18ad37a3be7fdd65db67097d59ae56ad66dd93f8b2fc533bb2e70eab6a |
|
MD5 | 954d8f6c40a2b0db892be4ea964ddc2d |
|
BLAKE2b-256 | c2d95a0d6f2f28b25ff0337b39df3b2198b0487ef31338e4a607f64b40cf189f |
File details
Details for the file pygetimportables-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pygetimportables-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e12468b0d3c8599550c2923aa44a249c671d2488f3c6ed0b3dc1933b2b82424a |
|
MD5 | dedf3dc96917d0cb0749093093f8f696 |
|
BLAKE2b-256 | 49d3408ec9840abe977d0a1f001d2bf6910b4a78ce790ec2943cd1b9b340b76e |