Skip to content

Commit

Permalink
docs: Update description in readme and docs (#35)
Browse files Browse the repository at this point in the history
<!-- readthedocs-preview pep610 start -->
----
πŸ“š Documentation preview πŸ“š:
https://pep610--35.org.readthedocs.build/en/35/

<!-- readthedocs-preview pep610 end -->
  • Loading branch information
edgarrmondragon authored Jan 31, 2024
1 parent 2d03031 commit 625c8bd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].

-----

Expand All @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
22 changes: 12 additions & 10 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PEP 610 Parser and Builder
# PEP 610 Parser

*A parser and builder for {external:doc}`PEP 610 direct URL metadata <specifications/direct-url>`.*
*A parser for {external:doc}`PEP 610 direct URL metadata <specifications/direct-url>`.*

Release **v{sub-ref}`version`**.

Expand All @@ -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")
```

:::
Expand All @@ -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")
```
:::
::::
Expand Down

0 comments on commit 625c8bd

Please sign in to comment.