diff --git a/README.md b/README.md index 1f6c702..046e064 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ [![codecov](https://codecov.io/gh/edgarrmondragon/pep610/graph/badge.svg?token=6W1M6P9LYI)](https://codecov.io/gh/edgarrmondragon/pep610) [![Documentation Status](https://readthedocs.org/projects/pep610/badge/?version=latest)](https://pep610.readthedocs.io/en/stable) -[PEP 610][pep610] specifies how the Direct URL Origin of installed distributions should be recorded. +A Python library for parsing the [Direct URL Origin structure][pep610-structure] from installed packages. -The up-to-date, [canonical specification][pep610-pypa] is maintained on the [PyPA specs page][pypa-specs]. +[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]. ----- @@ -33,12 +33,15 @@ 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") +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 editable install") + print("Not an editable installation") ``` Or, in Python 3.10+ using pattern matching: @@ -49,13 +52,12 @@ from importlib import metadata import pep610 dist = metadata.distribution("pep610") -data = pep610.read_from_distribution(dist) -match data: +match data := pep610.read_from_distribution(dist): case pep610.DirData(url, pep610.DirInfo(editable=True)): - print("Editable install") + print("Editable installation, a.k.a. in development mode") case _: - print("Not editable install") + print("Not an editable installation") ``` ## Development diff --git a/docs/conf.py b/docs/conf.py index d803da3..fa4edb3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,7 +36,7 @@ # a list of builtin themes. html_theme = "furo" -html_title = "PEP 610 - Direct URL Parser and Builder for Python" +html_title = "PEP 610 - Direct URL Parser for Python" html_theme_options = { "navigation_with_keys": True, "source_repository": "https://github.com/edgarrmondragon/citric/", diff --git a/docs/index.md b/docs/index.md index bc4f5bd..dccc63a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ -# PEP 610 Parser and Builder +# PEP 610 Parser -*A parser and builder for {external:doc}`PEP 610 direct URL metadata `.* +*A parser for {external:doc}`PEP 610 direct URL metadata `.* Release **v{sub-ref}`version`**. @@ -14,13 +14,12 @@ from importlib import metadata import pep610 dist = metadata.distribution("pep610") -data = pep610.read_from_distribution(dist) -match data: +match data := pep610.read_from_distribution(dist): case pep610.DirData(url, pep610.DirInfo(editable=True)): - print("Editable install") + print("Editable installation, a.k.a. in development mode") case _: - print("Not editable install") + print("Not an editable installation") ``` ::: @@ -32,12 +31,15 @@ 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") +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 editable install") + print("Not an editable installation") ``` ::: ::::