···44[](https://github.com/astral-sh/ruff)
55[](https://pypi.org/project/pygetpackages)
6677-Python function that gets packages from a source tree
77+Python functions to get packages from a source tree and an already built wheel.
88+99+See https://discuss.python.org/t/script-to-get-top-level-packages-from-source-tree/40232?u=astrojuanlu
810911## Installation
1012···1416(.venv) $ pip install pygetpackages
1517```
16181919+## Usage
2020+2121+To get the packages directly from a source tree:
2222+2323+```
2424+>>> from pygetpackages import get_packages
2525+>>> get_packages(".") # Wait a few seconds, requires working `pip install`
2626+{'pygetpackages'}
2727+```
2828+2929+To get packages from an already built wheel:
3030+3131+```
3232+(.venv) $ python -m build
3333+...
3434+(.venv) $ python -q
3535+>>> from pygetpackages import get_packages_from_wheel
3636+>>> get_packages_from_wheel("dist/pygetpackages-0.1.0+d20231204-py3-none-any.whl") # Fast
3737+{'pygetpackages'}
3838+```
3939+1740## Development
18411942To run style checks:
···2245(.venv) $ pip install pre-commit
2346(.venv) $ pre-commit -a
2447```
2525-2626-## Overview
2727-2828-Add a longer description here.