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 `pip install`
{'pygetimportables'}
To get the top-level importable names from an already built wheel:
(.venv) $ python -m build
...
(.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
pygetimportables-0.2.1.tar.gz
(6.0 kB
view hashes)
Built Distribution
Close
Hashes for pygetimportables-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f678719de673c27de4c96dacc8d09168b8c2a73dd7b04debae623326aff47a83 |
|
MD5 | 8032f5588e77ff4c2931406410de5fe2 |
|
BLAKE2b-256 | d10e8b375e3b00df1e0155d4ce889516e4539862cd54b036c6589836781b14b8 |