Skip to content

Commit

Permalink
chore: Update description
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jan 24, 2024
1 parent ca49deb commit 3cbcfac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
32 changes: 8 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,13 @@ from importlib import metadata

import pep610

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

if isinstance(data, pep610.DirData):
print(f"URL: {data.url}")
print(f"Editable: {data.dir_info.editable}")
elif isinstance(data, pep610.VCSData):
print(f"URL: {data.url}")
print(f"VCS: {data.vcs_info.vcs}")
print(f"Commit: {data.vcs_info.commit_id}")
elif isinstance(data, pep610.ArchiveData):
print(f"URL: {data.url}")
print(f"Hashes: {data.archive_info.hashes}")
if isinstance(data, pep610.DirData) and data.dir_info.is_editable():
print("Editable install")
else:
print("Unknown data")
print("Not editable install")
```

Or, in Python 3.10+ using pattern matching:
Expand All @@ -56,22 +48,14 @@ from importlib import metadata

import pep610

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

match data:
case pep610.DirData(url, dir_info):
print(f"URL: {url}")
print(f"Editable: {dir_info.editable}")
case pep610.VCSData(url, vcs_info):
print(f"URL: {url}")
print(f"VCS: {vcs_info.vcs}")
print(f"Commit: {vcs_info.commit_id}")
case pep610.ArchiveData(url, archive_info):
print(f"URL: {url}")
print(f"Hashes: {archive_info.hashes}")
case pep610.DirData(url, pep610.DirInfo(editable=True)):
print("Editable install")
case _:
print("Unknown data")
print("Not editable install")
```

## License
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires = [

[project]
name = "pep610"
description = "Python helpers for PEP 610"
description = "PEP 610 Direct URL data parser"
readme = "README.md"
keywords = [
"pep",
Expand Down

0 comments on commit 3cbcfac

Please sign in to comment.