mkdocstrings-github 0.4.0__py3-none-any.whl → 0.4.2__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.
- {mkdocstrings_github-0.4.0.dist-info → mkdocstrings_github-0.4.2.dist-info}/METADATA +2 -1
- {mkdocstrings_github-0.4.0.dist-info → mkdocstrings_github-0.4.2.dist-info}/RECORD +5 -5
- mkdocstrings_handlers/github/handler.py +60 -22
- {mkdocstrings_github-0.4.0.dist-info → mkdocstrings_github-0.4.2.dist-info}/WHEEL +0 -0
- {mkdocstrings_github-0.4.0.dist-info → mkdocstrings_github-0.4.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mkdocstrings-github
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: A GitHub Action handler for mkdocstrings
|
|
5
5
|
Author-email: Mark Hu <watermarkhu@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -23,6 +23,7 @@ Classifier: Typing :: Typed
|
|
|
23
23
|
Requires-Python: <3.15,>=3.10
|
|
24
24
|
Requires-Dist: gitpython~=3.1.45
|
|
25
25
|
Requires-Dist: mkdocstrings~=0.29
|
|
26
|
+
Requires-Dist: packaging~=25.0
|
|
26
27
|
Requires-Dist: typing-extensions>=4.0; python_version < '3.11'
|
|
27
28
|
Description-Content-Type: text/markdown
|
|
28
29
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
mkdocstrings_handlers/github/__init__.py,sha256=0WdFUIq4Xu2ZFtlZNIYCQSoqcx3Ot9Wv41_X_dwbFww,248
|
|
2
2
|
mkdocstrings_handlers/github/config.py,sha256=pSjA6gU-kC_mXQqNIIGOYEOhtX5VzZDT0H1hRFlGaj8,6089
|
|
3
|
-
mkdocstrings_handlers/github/handler.py,sha256=
|
|
3
|
+
mkdocstrings_handlers/github/handler.py,sha256=d3bpciheO6BSH1EPAc8ijZ_xmcEzzhXTbfTrbcMmFIg,9310
|
|
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.4.
|
|
15
|
-
mkdocstrings_github-0.4.
|
|
16
|
-
mkdocstrings_github-0.4.
|
|
17
|
-
mkdocstrings_github-0.4.
|
|
14
|
+
mkdocstrings_github-0.4.2.dist-info/METADATA,sha256=humw71gGT_wkykxy7fRgxh_t1ri6JOm3keuIkoiGIyU,3340
|
|
15
|
+
mkdocstrings_github-0.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
mkdocstrings_github-0.4.2.dist-info/licenses/LICENSE,sha256=5enZtJ4zSp0Ps3jTqFQ4kadcx62BhgTaDNPrXWb3g3E,1069
|
|
17
|
+
mkdocstrings_github-0.4.2.dist-info/RECORD,,
|
|
@@ -16,6 +16,7 @@ from mkdocstrings import (
|
|
|
16
16
|
HandlerOptions,
|
|
17
17
|
get_logger,
|
|
18
18
|
)
|
|
19
|
+
from packaging.version import InvalidVersion, Version
|
|
19
20
|
|
|
20
21
|
from mkdocstrings_handlers.github import rendering
|
|
21
22
|
from mkdocstrings_handlers.github.config import GitHubConfig, GitHubOptions
|
|
@@ -72,6 +73,29 @@ class GitHubHandler(BaseHandler):
|
|
|
72
73
|
self.major: str = ""
|
|
73
74
|
self.semver: str = ""
|
|
74
75
|
|
|
76
|
+
# Determine owner and repo name
|
|
77
|
+
if not self.config.repo:
|
|
78
|
+
# Try each remote to find a valid GitHub owner/repo
|
|
79
|
+
owner = None
|
|
80
|
+
repo_name = None
|
|
81
|
+
for remote in self.repo.remotes:
|
|
82
|
+
for url in remote.urls:
|
|
83
|
+
match = re.search(
|
|
84
|
+
r"(?P<host>[\w\.-]+)[/:](?P<owner>[^/]+)/(?P<repo>[^/.]+?)(?:\.git)?$",
|
|
85
|
+
url,
|
|
86
|
+
)
|
|
87
|
+
if match:
|
|
88
|
+
owner = match.group("owner")
|
|
89
|
+
repo_name = match.group("repo")
|
|
90
|
+
break
|
|
91
|
+
if owner and repo_name:
|
|
92
|
+
break
|
|
93
|
+
if not (owner and repo_name):
|
|
94
|
+
raise PluginError(
|
|
95
|
+
f"Could not determine GitHub repository owner/name from config.repo='{self.config.repo}' or any git remote URL."
|
|
96
|
+
)
|
|
97
|
+
self.config.repo = f"{owner}/{repo_name}"
|
|
98
|
+
|
|
75
99
|
# Only run GitHub releases code if required and not in testing
|
|
76
100
|
not_testing = "pytest" not in sys.modules
|
|
77
101
|
no_custom_tags = (
|
|
@@ -113,29 +137,43 @@ class GitHubHandler(BaseHandler):
|
|
|
113
137
|
_logger.warning(f"Could not get git tags from repository: {e}")
|
|
114
138
|
return
|
|
115
139
|
|
|
116
|
-
#
|
|
140
|
+
# Separate semver, major, and other tags
|
|
141
|
+
semver_tags = []
|
|
142
|
+
major_tags = []
|
|
143
|
+
other_tags = []
|
|
117
144
|
for tag in tags:
|
|
118
|
-
if
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
)
|
|
145
|
+
if SEMVER_PATTERN.match(tag):
|
|
146
|
+
semver_tags.append(tag)
|
|
147
|
+
elif MAJOR_PATTERN.match(tag):
|
|
148
|
+
major_tags.append(tag)
|
|
149
|
+
else:
|
|
150
|
+
other_tags.append(tag)
|
|
151
|
+
|
|
152
|
+
# Sort tags using packaging.version.Version
|
|
153
|
+
def version_key(tag):
|
|
154
|
+
try:
|
|
155
|
+
return Version(tag.lstrip("v"))
|
|
156
|
+
except InvalidVersion:
|
|
157
|
+
return Version("0.0.0")
|
|
158
|
+
|
|
159
|
+
semver_tags_sorted = sorted(semver_tags, key=version_key, reverse=True)
|
|
160
|
+
major_tags_sorted = sorted(major_tags, key=version_key, reverse=True)
|
|
161
|
+
other_tags_sorted = sorted(other_tags, reverse=True)
|
|
162
|
+
|
|
163
|
+
if semver_tags_sorted:
|
|
164
|
+
self.semver = semver_tags_sorted[0]
|
|
165
|
+
_logger.info(f"Using git tag '{self.semver}' for semver.")
|
|
166
|
+
else:
|
|
167
|
+
_logger.warning("No semver tags found in repository.")
|
|
168
|
+
|
|
169
|
+
if major_tags_sorted:
|
|
170
|
+
self.major = major_tags_sorted[0]
|
|
171
|
+
_logger.info(f"Using git tag '{self.major}' for major.")
|
|
172
|
+
else:
|
|
173
|
+
_logger.warning("No major tags found in repository.")
|
|
174
|
+
|
|
175
|
+
if other_tags_sorted:
|
|
176
|
+
_logger.debug(f"Other git tags found: {', '.join(other_tags_sorted)}")
|
|
139
177
|
|
|
140
178
|
def get_options(self, local_options: Mapping[str, Any]) -> HandlerOptions:
|
|
141
179
|
"""Get combined default, global and local options.
|
|
File without changes
|
{mkdocstrings_github-0.4.0.dist-info → mkdocstrings_github-0.4.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|