Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/astrojuanlu/pygetimportables
Python functions to get top-level importables names
https://github.com/astrojuanlu/pygetimportables
Last synced: 17 days ago
JSON representation
Python functions to get top-level importables names
- Host: GitHub
- URL: https://github.com/astrojuanlu/pygetimportables
- Owner: astrojuanlu
- License: bsd-2-clause
- Created: 2023-12-03T17:54:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-24T09:26:30.000Z (6 months ago)
- Last Synced: 2024-12-09T00:01:01.471Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# pygetimportables
[![Documentation Status](https://readthedocs.org/projects/pygetimportables/badge/?version=latest)](https://pygetimportables.readthedocs.io/en/latest/?badge=latest)
[![Code style: ruff-format](https://img.shields.io/badge/code%20style-ruff_format-6340ac.svg)](https://github.com/astral-sh/ruff)
[![PyPI](https://img.shields.io/pypi/v/pygetimportables)](https://pypi.org/project/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
```