mkdocstrings-github 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocstrings-github
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A GitHub Action handler for mkdocstrings
5
5
  Author-email: Mark Hu <watermarkhu@gmail.com>
6
6
  License: MIT
@@ -14,15 +14,15 @@ Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
17
18
  Classifier: Topic :: Documentation
18
19
  Classifier: Topic :: Software Development
19
20
  Classifier: Topic :: Software Development :: Documentation
20
21
  Classifier: Topic :: Utilities
21
22
  Classifier: Typing :: Typed
22
- Requires-Python: <3.14,>=3.10
23
+ Requires-Python: <3.15,>=3.10
23
24
  Requires-Dist: gitpython~=3.1.45
24
25
  Requires-Dist: mkdocstrings~=0.29
25
- Requires-Dist: pygithub~=2.8.1
26
26
  Requires-Dist: typing-extensions>=4.0; python_version < '3.11'
27
27
  Description-Content-Type: text/markdown
28
28
 
@@ -37,6 +37,7 @@ Description-Content-Type: text/markdown
37
37
  [![Qualify](https://github.com/watermarkhu/mkdocstrings-github/actions/workflows/qualify.yaml/badge.svg?branch=main)](https://github.com/watermarkhu/mkdocstrings-github/actions/workflows/qualify.yaml)
38
38
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://watermarkhu.nl/mkdocstrings-github)
39
39
  [![pypi version](https://img.shields.io/pypi/v/mkdocstrings-github.svg)](https://pypi.org/project/mkdocstrings-github/)
40
+ [![codecov](https://codecov.io/github/watermarkhu/mkdocstrings-github/graph/badge.svg?token=M6XW8UeURE)](https://codecov.io/github/watermarkhu/mkdocstrings-github)
40
41
 
41
42
  <!-- --8<-- [end:header] -->
42
43
  <!-- --8<-- [start:install] -->
@@ -1,6 +1,6 @@
1
1
  mkdocstrings_handlers/github/__init__.py,sha256=0WdFUIq4Xu2ZFtlZNIYCQSoqcx3Ot9Wv41_X_dwbFww,248
2
- mkdocstrings_handlers/github/config.py,sha256=IxD1AiaQf3wC2cRabi3wUriimZDOhFOmpWw5CB-jSb4,6277
3
- mkdocstrings_handlers/github/handler.py,sha256=KjZJAq_wELYhBTMZgkWugsaNhBJFlidmFe_9cddxCuo,11028
2
+ mkdocstrings_handlers/github/config.py,sha256=pSjA6gU-kC_mXQqNIIGOYEOhtX5VzZDT0H1hRFlGaj8,6089
3
+ mkdocstrings_handlers/github/handler.py,sha256=xRvBMbQexYB-qWivLzNMMSP87fzPM3cPYBi1qZNrVDw,7931
4
4
  mkdocstrings_handlers/github/objects.py,sha256=JDkY7mg_LGlIEwZHP2wSd8ZkB6RVtRsu_JEpwV-PikQ,7069
5
5
  mkdocstrings_handlers/github/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  mkdocstrings_handlers/github/rendering.py,sha256=tJeAsSaijqSC2IkxYsIXq7d0lR2A3aB5PRUcFFTFpVU,2705
@@ -11,7 +11,7 @@ mkdocstrings_handlers/github/templates/material/outputs.html.jinja,sha256=jlzVF9
11
11
  mkdocstrings_handlers/github/templates/material/secrets.html.jinja,sha256=1lMJoxjjeiqetVu0mdLKmZ1faYRReeyjiYvYTZESots,2881
12
12
  mkdocstrings_handlers/github/templates/material/style.css,sha256=R2hh1RfHwJ6XNT4YQl_txNkNXcPBZJMCBZn5kQEMQ6M,962
13
13
  mkdocstrings_handlers/github/templates/material/workflow.html.jinja,sha256=E1VUi2w7_NDkpS9VNrWRV52hhyhQvnKUrjPbV_j0Qcg,3312
14
- mkdocstrings_github-0.3.0.dist-info/METADATA,sha256=MQyoPBfAXQXy8Lsc8PA_GSo1s1OQlWffozEo7Jx-M_k,3125
15
- mkdocstrings_github-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- mkdocstrings_github-0.3.0.dist-info/licenses/LICENSE,sha256=5enZtJ4zSp0Ps3jTqFQ4kadcx62BhgTaDNPrXWb3g3E,1069
17
- mkdocstrings_github-0.3.0.dist-info/RECORD,,
14
+ mkdocstrings_github-0.4.0.dist-info/METADATA,sha256=01wUyZdvlbDHBFUqUP8Qmobe61BfAS-_HsI_6nak4cQ,3309
15
+ mkdocstrings_github-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ mkdocstrings_github-0.4.0.dist-info/licenses/LICENSE,sha256=5enZtJ4zSp0Ps3jTqFQ4kadcx62BhgTaDNPrXWb3g3E,1069
17
+ mkdocstrings_github-0.4.0.dist-info/RECORD,,
@@ -171,11 +171,6 @@ class GitHubOptions(BaseModel):
171
171
  class GitHubConfig(BaseModel):
172
172
  """Configuration options for the GitHub handler."""
173
173
 
174
- hostname: str = Field(
175
- default="github.com",
176
- description="The hostname of the GitHub instance to use. This is only needed for GitHub Enterprise installations.",
177
- )
178
-
179
174
  repo: str = Field(
180
175
  default="",
181
176
  description="""The GitHub repository in the format *owner/repo*.
@@ -4,7 +4,6 @@ from __future__ import annotations
4
4
 
5
5
  import os
6
6
  import re
7
- import subprocess
8
7
  import sys
9
8
  from pathlib import Path
10
9
  from typing import TYPE_CHECKING, Any, ClassVar, Mapping
@@ -18,7 +17,6 @@ from mkdocstrings import (
18
17
  get_logger,
19
18
  )
20
19
 
21
- from github import Auth, Github
22
20
  from mkdocstrings_handlers.github import rendering
23
21
  from mkdocstrings_handlers.github.config import GitHubConfig, GitHubOptions
24
22
  from mkdocstrings_handlers.github.objects import Action, Workflow
@@ -108,82 +106,20 @@ class GitHubHandler(BaseHandler):
108
106
  self.actions[action_file] = action
109
107
 
110
108
  def get_releases(self) -> None:
111
- gh_host = os.environ.get("GH_HOST", self.config.hostname)
112
- if gh_host.startswith(("http://", "https://")):
113
- base_url = gh_host
114
- elif "/api/" in gh_host:
115
- # If protocol is missing, default to https
116
- base_url = f"https://{gh_host}"
117
- elif gh_host.startswith("api."):
118
- base_url = f"https://{gh_host}"
119
- else:
120
- base_url = f"https://api.{gh_host}"
121
-
122
- _logger.debug(f"Using GitHub API base URL: {base_url}")
109
+ # Get all tags from the local git repository
110
+ try:
111
+ tags = [tag.name for tag in self.repo.tags]
112
+ except Exception as e:
113
+ _logger.warning(f"Could not get git tags from repository: {e}")
114
+ return
123
115
 
124
- if (token_key := "GH_TOKEN") in os.environ:
125
- gh = Github(base_url=base_url, auth=Auth.Token(os.environ[token_key]))
126
- _logger.debug(f"Using GitHub authentication from environment variable {token_key}")
127
- elif (token_key := "GITHUB_TOKEN") in os.environ:
128
- gh = Github(base_url=base_url, auth=Auth.Token(os.environ[token_key]))
129
- _logger.debug(f"Using GitHub authentication from environment variable {token_key}")
130
- else:
131
- try:
132
- gh = Github(base_url=base_url, auth=Auth.NetrcAuth())
133
- _logger.debug("Using GitHub authentication from .netrc")
134
- except RuntimeError:
135
- try:
136
- token = subprocess.check_output(
137
- ["gh", "auth", "token"], text=True, env=os.environ
138
- ).strip()
139
- if token:
140
- gh = Github(base_url=base_url, auth=Auth.Token(token))
141
- _logger.debug("Using GitHub authentication from gh cli.")
142
- else:
143
- raise RuntimeError("No token from gh auth token")
144
- except Exception:
145
- _logger.warning(
146
- "Could not authenticate with GitHub to get releases. "
147
- "Consider setting .netrc, environment variable GH_TOKEN, "
148
- "or using GitHub CLI (`gh auth login`) to get GitHub releases.",
149
- )
150
- gh = Github(base_url=base_url)
151
-
152
- # Determine owner and repo name
153
- if "/" in self.config.repo:
154
- owner, repo_name = self.config.repo.split("/", 1)
155
- else:
156
- # Try each remote to find a valid GitHub owner/repo
157
- owner = None
158
- repo_name = None
159
- for remote in self.repo.remotes:
160
- for url in remote.urls:
161
- match = re.search(
162
- r"(?P<host>[\w\.-]+)[/:](?P<owner>[^/]+)/(?P<repo>[^/.]+?)(?:\.git)?$",
163
- url,
164
- )
165
- if match:
166
- owner = match.group("owner")
167
- repo_name = match.group("repo")
168
- break
169
- if owner and repo_name:
170
- break
171
- if not (owner and repo_name):
172
- raise PluginError(
173
- f"Could not determine GitHub repository owner/name from config.repo='{self.config.repo}' or any git remote URL."
174
- )
175
- self.config.repo = f"{owner}/{repo_name}"
176
-
177
- # Get releases
178
- gh_repo = gh.get_repo(f"{owner}/{repo_name}")
179
- releases = list(gh_repo.get_releases())
180
- for release in releases:
181
- tag = release.tag_name
116
+ # Find matching tags
117
+ for tag in tags:
182
118
  if not self.semver and SEMVER_PATTERN.match(tag):
183
- _logger.info(f"Using GitHub release tag '{tag}' for semver.")
119
+ _logger.info(f"Using git tag '{tag}' for semver.")
184
120
  self.semver = tag
185
121
  if not self.major and MAJOR_PATTERN.match(tag):
186
- _logger.info(f"Using GitHub release tag '{tag}' for major.")
122
+ _logger.info(f"Using git tag '{tag}' for major.")
187
123
  self.major = tag
188
124
  if self.semver and self.major:
189
125
  break
@@ -196,8 +132,8 @@ class GitHubHandler(BaseHandler):
196
132
  else: # not self.major
197
133
  messages = ("'vX'", "'major'")
198
134
  _logger.warning(
199
- f"Could not find suitable GitHub releases for repo '{self.config.repo}'. "
200
- f"Make sure there are releases with tags matching {messages[0]}, "
135
+ f"Could not find suitable git tags in repository. "
136
+ f"Make sure there are tags matching {messages[0]}, "
201
137
  f"if you wish to use option signature_version {messages[1]}.",
202
138
  )
203
139