Skip to content

Commit

Permalink
Separate GitHub concerns from repo_info function.
Browse files Browse the repository at this point in the history
Ref #5
  • Loading branch information
jaraco committed Sep 24, 2024
1 parent f4996b1 commit 1b285ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ def none_as(replacement):

@functools.lru_cache
@jaraco.functools.apply(none_as({}))
@suppress(subprocess.CalledProcessError)
def repo_info() -> Mapping:
return github_repo_info()


@suppress(subprocess.CalledProcessError)
def github_repo_info() -> Mapping:
data = json.loads(
subprocess.check_output(
['gh', 'repo', 'view', '--json', 'description,url'],
Expand All @@ -86,19 +90,19 @@ def repo_info() -> Mapping:
return {k: v for k, v in data.items() if v}


def summary_from_github():
def summary():
"""
Load the summary from GitHub.
Load the summary from hosted project.
>>> summary_from_github()
>>> summary()
'A zero-config Python project build backend'
"""
return repo_info().get('description')


def source_url():
"""
Load the repo URL from GitHub.
Load the repo URL from hosted project.
>>> source_url()
'https://github.com/coherent-oss/coherent.build'
Expand Down
2 changes: 1 addition & 1 deletion metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _discover_fields():
yield 'Name', discovery.best_name()
yield 'Version', discovery.version_from_vcs()
yield 'Author-Email', discovery.author_from_vcs()
yield 'Summary', discovery.summary_from_github()
yield 'Summary', discovery.summary()
yield 'Requires-Python', discovery.python_requires_supported()
deps = list(discovery.combined_deps())
for dep in deps:
Expand Down

0 comments on commit 1b285ec

Please sign in to comment.