Skip to main content

PEP 610 Direct URL data parser

Project description

pep610

PyPI - Version PyPI - Python Version codecov Documentation Status

PEP 610 specifies how the Direct URL Origin of installed distributions should be recorded.

The up-to-date, canonical specification is maintained on the PyPA specs page.


Table of Contents

Installation

pip install pep610

Usage

You can use pep610.read_from_distribution to parse the Direct URL Origin structure from a Distribution object:

from importlib import metadata

import pep610

dist = metadata.distribution("pep610")
data = pep610.read_from_distribution(dist)

if isinstance(data, pep610.DirData) and data.dir_info.is_editable():
    print("Editable install")
else:
    print("Not editable install")

Or, in Python 3.10+ using pattern matching:

from importlib import metadata

import pep610

dist = metadata.distribution("pep610")
data = pep610.read_from_distribution(dist)

match data:
    case pep610.DirData(url, pep610.DirInfo(editable=True)):
        print("Editable install")
    case _:
        print("Not editable install")

License

pep610 is distributed under the terms of the Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pep610-0.2.0.tar.gz (16.5 kB view hashes)

Uploaded Source

Built Distribution

pep610-0.2.0-py3-none-any.whl (13.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page