mkdocstrings-github 0.2.2__py3-none-any.whl → 0.2.4__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.2.2.dist-info → mkdocstrings_github-0.2.4.dist-info}/METADATA +1 -1
- {mkdocstrings_github-0.2.2.dist-info → mkdocstrings_github-0.2.4.dist-info}/RECORD +6 -6
- mkdocstrings_handlers/github/config.py +5 -0
- mkdocstrings_handlers/github/handler.py +35 -10
- {mkdocstrings_github-0.2.2.dist-info → mkdocstrings_github-0.2.4.dist-info}/WHEEL +0 -0
- {mkdocstrings_github-0.2.2.dist-info → mkdocstrings_github-0.2.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
mkdocstrings_handlers/github/__init__.py,sha256=0WdFUIq4Xu2ZFtlZNIYCQSoqcx3Ot9Wv41_X_dwbFww,248
|
|
2
|
-
mkdocstrings_handlers/github/config.py,sha256=
|
|
3
|
-
mkdocstrings_handlers/github/handler.py,sha256=
|
|
2
|
+
mkdocstrings_handlers/github/config.py,sha256=b2sZiRehEtg27ZUbPmUld8SlsGUYE5f1qLFuq1cWjlU,6220
|
|
3
|
+
mkdocstrings_handlers/github/handler.py,sha256=MD0XmG2vsvsslUpFl1qB6bpiW28jRUNjG2lGkrFNIxs,11251
|
|
4
4
|
mkdocstrings_handlers/github/objects.py,sha256=qkRGcwwYCHsrc9JEmujnvIt00_B1y5cR0vGS5NRkuSg,7028
|
|
5
5
|
mkdocstrings_handlers/github/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
mkdocstrings_handlers/github/rendering.py,sha256=8h5Zn62b3od9Dj3MNvMtAGg_ZyyLfJKv2Z2qGdFaKG8,2329
|
|
@@ -11,7 +11,7 @@ mkdocstrings_handlers/github/templates/material/outputs.html.jinja,sha256=ePu1v8
|
|
|
11
11
|
mkdocstrings_handlers/github/templates/material/secrets.html.jinja,sha256=92ynVoZinsLEp7_sFS3mL2E2ngOXPPAtXzGAuGFvhmY,2782
|
|
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.2.
|
|
15
|
-
mkdocstrings_github-0.2.
|
|
16
|
-
mkdocstrings_github-0.2.
|
|
17
|
-
mkdocstrings_github-0.2.
|
|
14
|
+
mkdocstrings_github-0.2.4.dist-info/METADATA,sha256=1pzvDfDEgY43O-Itmcg-1OEae8vJNabUf5esgLT28II,3125
|
|
15
|
+
mkdocstrings_github-0.2.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
mkdocstrings_github-0.2.4.dist-info/licenses/LICENSE,sha256=5enZtJ4zSp0Ps3jTqFQ4kadcx62BhgTaDNPrXWb3g3E,1069
|
|
17
|
+
mkdocstrings_github-0.2.4.dist-info/RECORD,,
|
|
@@ -171,6 +171,11 @@ 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.",
|
|
177
|
+
)
|
|
178
|
+
|
|
174
179
|
repo: str = Field(
|
|
175
180
|
default="",
|
|
176
181
|
description="""The GitHub repository in the format *owner/repo*.
|
|
@@ -80,22 +80,47 @@ class GitHubHandler(BaseHandler):
|
|
|
80
80
|
) and "pytest" not in sys.modules:
|
|
81
81
|
# Use PyGitHub to find last GitHub releases with tags matching vX.X.X and vX
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
base_url
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
gh_host = os.environ.get("GH_HOST", config.hostname)
|
|
84
|
+
# Construct base_url for GitHub API.
|
|
85
|
+
#
|
|
86
|
+
# Expected formats for GH_HOST/config.hostname:
|
|
87
|
+
# - Full API URL (e.g., 'https://github.company.com/api/v3') [RECOMMENDED for GitHub Enterprise]
|
|
88
|
+
# - Hostname (e.g., 'github.com' or 'github.company.com')
|
|
89
|
+
# - API subdomain (e.g., 'api.github.com')
|
|
90
|
+
#
|
|
91
|
+
# If a full URL is provided, it is used as-is.
|
|
92
|
+
# If the value contains '/api/', it is assumed to be a full API endpoint and used as-is (with protocol if missing).
|
|
93
|
+
# Otherwise, the code falls back to public GitHub conventions.
|
|
94
|
+
if gh_host.startswith(("http://", "https://")):
|
|
95
|
+
base_url = gh_host
|
|
96
|
+
elif "/api/" in gh_host:
|
|
97
|
+
# If protocol is missing, default to https
|
|
98
|
+
base_url = f"https://{gh_host}"
|
|
99
|
+
elif gh_host.startswith("api."):
|
|
100
|
+
base_url = f"https://{gh_host}"
|
|
101
|
+
else:
|
|
102
|
+
# Warn user about possible misconfiguration for GitHub Enterprise
|
|
103
|
+
_logger.warning(
|
|
104
|
+
"The GH_HOST/config.hostname value '%s' does not appear to be a full API endpoint. "
|
|
105
|
+
"For GitHub Enterprise, you may need to specify the full API URL (e.g., 'https://github.company.com/api/v3').",
|
|
106
|
+
gh_host,
|
|
90
107
|
)
|
|
108
|
+
base_url = f"https://api.{gh_host}"
|
|
109
|
+
|
|
110
|
+
if (token_key := "GH_TOKEN") in os.environ:
|
|
111
|
+
gh = Github(base_url=base_url, auth=Auth.Token(os.environ[token_key]))
|
|
112
|
+
elif (token_key := "GITHUB_TOKEN") in os.environ:
|
|
113
|
+
gh = Github(base_url=base_url, auth=Auth.Token(os.environ[token_key]))
|
|
91
114
|
else:
|
|
92
115
|
try:
|
|
93
116
|
gh = Github(base_url=base_url, auth=Auth.NetrcAuth())
|
|
94
117
|
except RuntimeError:
|
|
95
118
|
try:
|
|
96
|
-
token = subprocess.check_output(
|
|
119
|
+
token = subprocess.check_output(
|
|
120
|
+
["gh", "auth", "token"], text=True, env=os.environ
|
|
121
|
+
).strip()
|
|
97
122
|
if token:
|
|
98
|
-
gh = Github(auth=Auth.Token(token))
|
|
123
|
+
gh = Github(base_url=base_url, auth=Auth.Token(token))
|
|
99
124
|
else:
|
|
100
125
|
raise RuntimeError("No token from gh auth token")
|
|
101
126
|
except Exception:
|
|
@@ -104,7 +129,7 @@ class GitHubHandler(BaseHandler):
|
|
|
104
129
|
"Consider setting .netrc, environment variable GH_TOKEN, "
|
|
105
130
|
"or using GitHub CLI (`gh auth login`) to get GitHub releases.",
|
|
106
131
|
)
|
|
107
|
-
gh = Github()
|
|
132
|
+
gh = Github(base_url=base_url)
|
|
108
133
|
|
|
109
134
|
owner, repo_name = self.config.repo.split("/", 1)
|
|
110
135
|
gh_repo = gh.get_repo(f"{owner}/{repo_name}")
|
|
File without changes
|
{mkdocstrings_github-0.2.2.dist-info → mkdocstrings_github-0.2.4.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|