mkdocstrings-github 0.2.1__py3-none-any.whl → 0.2.3__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.2.1
3
+ Version: 0.2.3
4
4
  Summary: A GitHub Action handler for mkdocstrings
5
5
  Author-email: Mark Hu <watermarkhu@gmail.com>
6
6
  License: MIT
@@ -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=BNV3FOUHum9oIIBNYCooVo8HChXNJ9dNYvVI4EH5eak,9717
3
+ mkdocstrings_handlers/github/handler.py,sha256=aqrayPGjHONg1IbWxiw-VjgG38qBafW-_xOGww23xMg,9745
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.1.dist-info/METADATA,sha256=uez6sGRzxIl7UzfYCAxbKtnQlA2CCUMG_2HLhn1lP1s,3125
15
- mkdocstrings_github-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- mkdocstrings_github-0.2.1.dist-info/licenses/LICENSE,sha256=5enZtJ4zSp0Ps3jTqFQ4kadcx62BhgTaDNPrXWb3g3E,1069
17
- mkdocstrings_github-0.2.1.dist-info/RECORD,,
14
+ mkdocstrings_github-0.2.3.dist-info/METADATA,sha256=LKUKsU8uYtYxkKOZRZBhhEXu8dkRzUkogDIi4Ve_rus,3125
15
+ mkdocstrings_github-0.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ mkdocstrings_github-0.2.3.dist-info/licenses/LICENSE,sha256=5enZtJ4zSp0Ps3jTqFQ4kadcx62BhgTaDNPrXWb3g3E,1069
17
+ mkdocstrings_github-0.2.3.dist-info/RECORD,,
@@ -80,31 +80,29 @@ 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
- GH_HOST = os.environ.get("GH_HOST", "https://github.com")
84
- base_url = f"{GH_HOST}/api/v3"
83
+ GH_HOST = os.environ.get("GH_HOST", "https://api.github.com")
85
84
 
86
- if "GH_TOKEN" in os.environ or "GITHUB_TOKEN" in os.environ:
87
- gh = Github(
88
- base_url=base_url,
89
- auth=Auth.Token(os.environ.get("GH_TOKEN", os.environ["GITHUB_TOKEN"])),
90
- )
85
+ if (token_key := "GH_TOKEN") in os.environ:
86
+ gh = Github(base_url=GH_HOST, auth=Auth.Token(os.environ[token_key]))
87
+ elif (token_key := "GITHUB_TOKEN") in os.environ:
88
+ gh = Github(base_url=GH_HOST, auth=Auth.Token(os.environ[token_key]))
91
89
  else:
92
90
  try:
93
- gh = Github(base_url=base_url, auth=Auth.NetrcAuth())
91
+ gh = Github(base_url=GH_HOST, auth=Auth.NetrcAuth())
94
92
  except RuntimeError:
95
93
  try:
96
94
  token = subprocess.check_output(["gh", "auth", "token"], text=True).strip()
97
95
  if token:
98
- gh = Github(auth=Auth.Token(token))
96
+ gh = Github(base_url=GH_HOST, auth=Auth.Token(token))
99
97
  else:
100
98
  raise RuntimeError("No token from gh auth token")
101
99
  except Exception:
102
100
  _logger.warning(
103
101
  "Could not authenticate with GitHub to get releases. "
104
- "Consider setting .netrc, environment variable GITHUB_TOKEN, "
102
+ "Consider setting .netrc, environment variable GH_TOKEN, "
105
103
  "or using GitHub CLI (`gh auth login`) to get GitHub releases.",
106
104
  )
107
- gh = Github()
105
+ gh = Github(base_url=GH_HOST)
108
106
 
109
107
  owner, repo_name = self.config.repo.split("/", 1)
110
108
  gh_repo = gh.get_repo(f"{owner}/{repo_name}")