https://github.com/edgarrmondragon/pep610
PEP 610 Direct URL data parser
https://github.com/edgarrmondragon/pep610
packaging pep python
Last synced: about 2 months ago
JSON representation
PEP 610 Direct URL data parser
- Host: GitHub
- URL: https://github.com/edgarrmondragon/pep610
- Owner: edgarrmondragon
- License: apache-2.0
- Created: 2023-09-06T05:05:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-01T23:29:12.000Z (2 months ago)
- Last Synced: 2025-04-01T23:30:58.928Z (2 months ago)
- Topics: packaging, pep, python
- Language: Python
- Homepage: https://pep610.readthedocs.io
- Size: 170 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# pep610
[](https://pypi.org/project/pep610)
[](https://pypi.org/project/pep610)

[](https://codecov.io/gh/edgarrmondragon/pep610)
[](https://pep610.readthedocs.io/en/stable)A Python library for parsing the [Direct URL Origin structure][pep610-structure] from installed packages.
[PEP 610][pep610] initially specified how the Direct URL Origin of installed distributions should be recorded, but the up-to-date, [canonical specification][pep610-pypa] is maintained on the [PyPA specs page][pypa-specs].
-----
**Table of Contents**
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)## Installation
```console
pip install pep610
```## Usage
You can use `pep610.read_from_distribution` to parse the [Direct URL Origin structure][pep610-structure] from a `Distribution` object:
```python
from importlib import metadataimport pep610
dist = metadata.distribution("pep610")
if (
(data := pep610.read_from_distribution(dist))
and isinstance(data, pep610.DirData)
and data.dir_info.is_editable()
):
print("Editable installation, a.k.a. in development mode")
else:
print("Not an editable installation")
```Or, in Python 3.10+ using pattern matching:
```python
from importlib import metadataimport pep610
dist = metadata.distribution("pep610")
match data := pep610.read_from_distribution(dist):
case pep610.DirData(url, pep610.DirInfo(editable=True)):
print("Editable installation, a.k.a. in development mode")
case _:
print("Not an editable installation")
```## Development
This project uses [Tox][tox].
Run all checks with:
```shell
tox run-parallel
```## License
`pep610` is distributed under the terms of the [Apache License 2.0](LICENSE).
[pep610]: https://www.python.org/dev/peps/pep-0610/
[pep610-pypa]: https://packaging.python.org/en/latest/specifications/direct-url/#direct-url
[pep610-structure]: https://packaging.python.org/en/latest/specifications/direct-url-data-structure/
[pypa-specs]: https://packaging.python.org/en/latest/specifications/
[tox]: https://tox.wiki/