Skip to main content

PEP 610 Direct URL data parser

Project description

pep610

PyPI - Version PyPI - Python Version PyPI - Downloads codecov Documentation Status

A Python library for parsing the Direct URL Origin structure from installed packages.

PEP 610 initially specified how the Direct URL Origin of installed distributions should be recorded, but 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")

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:

from importlib import metadata

import 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 Hatch.

Testing

  1. Run the unit tests:

    hatch run all:cov
    
  2. Compute the coverage report:

    hatch run coverage:report
    

Linting

  1. Run the linters:

    hatch env run --force-continue --env=lint all
    

Documentation

  1. Build the documentation:

    hatch run docs:build
    

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.4.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

pep610-0.4.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file pep610-0.4.0.tar.gz.

File metadata

  • Download URL: pep610-0.4.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for pep610-0.4.0.tar.gz
Algorithm Hash digest
SHA256 41f7d14599db1ab085a7f6d36a1ef534ed8a472de699bed7a6b657979b5b5322
MD5 032aa63f23a3186cb7750a15894bd392
BLAKE2b-256 261010d6bb0ab9fd8f9c985fcd71edd117bd9d8aac29ddcea48dfe8fd45231e2

See more details on using hashes here.

File details

Details for the file pep610-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pep610-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for pep610-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f60a1f0169c7d4de8afd613241312a485b6b2ed90c3b1e19d31fd3d8f80be28f
MD5 6999cde0ed7c96742dd3749d8139f146
BLAKE2b-256 10f6a2702ff18bff0546b8c01d2e57428081c17a8d6d2b1d37b352f0a03c09aa

See more details on using hashes here.

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