sphinx-github-changelog 1.7.1__tar.gz → 2.0.0__tar.gz

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.
Files changed (54) hide show
  1. sphinx_github_changelog-2.0.0/.github/workflows/autofix.yml +30 -0
  2. sphinx_github_changelog-2.0.0/.github/workflows/ci.yml +111 -0
  3. sphinx_github_changelog-2.0.0/.github/workflows/coverage-comment.yml +26 -0
  4. sphinx_github_changelog-2.0.0/.pre-commit-config.yaml +58 -0
  5. sphinx_github_changelog-2.0.0/CONTRIBUTING.rst +75 -0
  6. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/PKG-INFO +9 -9
  7. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/README.rst +4 -4
  8. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/pyproject.toml +37 -11
  9. sphinx_github_changelog-2.0.0/scripts/docs +4 -0
  10. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/scripts/lint +1 -1
  11. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/scripts/tests +1 -1
  12. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/sphinx_github_changelog/changelog.py +56 -13
  13. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/sphinx_github_changelog/credentials.py +2 -2
  14. sphinx_github_changelog-2.0.0/tests/acceptance/changelog.html +71 -0
  15. sphinx_github_changelog-2.0.0/tests/acceptance/test_all.py +109 -0
  16. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/conftest.py +1 -1
  17. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/unit/test_changelog.py +87 -12
  18. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/unit/test_git.py +17 -6
  19. sphinx_github_changelog-2.0.0/uv.lock +965 -0
  20. sphinx_github_changelog-1.7.1/.github/sync-pre-commit.py +0 -88
  21. sphinx_github_changelog-1.7.1/.github/workflows/ci.yml +0 -76
  22. sphinx_github_changelog-1.7.1/.pre-commit-config.yaml +0 -117
  23. sphinx_github_changelog-1.7.1/CONTRIBUTING.rst +0 -96
  24. sphinx_github_changelog-1.7.1/MANIFEST.in +0 -12
  25. sphinx_github_changelog-1.7.1/scripts/docs +0 -4
  26. sphinx_github_changelog-1.7.1/setup.py +0 -5
  27. sphinx_github_changelog-1.7.1/tests/acceptance/changelog.html +0 -4
  28. sphinx_github_changelog-1.7.1/tests/acceptance/test_all.py +0 -29
  29. sphinx_github_changelog-1.7.1/uv.lock +0 -855
  30. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/.editorconfig +0 -0
  31. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/.github/CODEOWNERS +0 -0
  32. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  33. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/.github/renovate.json5 +0 -0
  34. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/.gitignore +0 -0
  35. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/.readthedocs.yml +0 -0
  36. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/CHANGELOG.rst +0 -0
  37. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/CODE_OF_CONDUCT.rst +0 -0
  38. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/LICENSE +0 -0
  39. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/docs/Makefile +0 -0
  40. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/docs/conduct.rst +0 -0
  41. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/docs/conf.py +0 -0
  42. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/docs/contributing.rst +0 -0
  43. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/docs/index.rst +0 -0
  44. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/scripts/README.md +0 -0
  45. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/sphinx_github_changelog/__init__.py +0 -0
  46. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/sphinx_github_changelog/urls.py +0 -0
  47. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/__init__.py +0 -0
  48. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/acceptance/__init__.py +0 -0
  49. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/roots/test-all/conf.py +0 -0
  50. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/roots/test-all/index.rst +0 -0
  51. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/roots/test-error/conf.py +0 -0
  52. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/roots/test-error/index.rst +0 -0
  53. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/unit/__init__.py +0 -0
  54. {sphinx_github_changelog-1.7.1 → sphinx_github_changelog-2.0.0}/tests/unit/test_urls.py +0 -0
@@ -0,0 +1,30 @@
1
+ name: autofix.ci
2
+ on: [pull_request]
3
+
4
+ permissions:
5
+ contents: read
6
+
7
+ jobs:
8
+ lint:
9
+ name: Autofix
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
13
+ with:
14
+ persist-credentials: false
15
+
16
+ - name: Set up UV
17
+ id: setup-uv
18
+ uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
19
+ with:
20
+ enable-cache: false
21
+
22
+ - name: Install dependencies
23
+ run: uv sync --all-groups
24
+
25
+ - name: Run prek
26
+ uses: j178/prek-action@bdca6f102f98e2b4c7029491a53dfd366469e33d # v2.0.4
27
+
28
+ - name: Commits back to branch if necessary
29
+ uses: autofix-ci/action@c5b2d67aa2274e7b5a18224e8171550871fc7e4a # v1.3.4
30
+ if: failure()
@@ -0,0 +1,111 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ tags:
9
+ - "*"
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ lint:
16
+ name: linting
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20
+ with:
21
+ persist-credentials: false
22
+
23
+ - name: Set up UV
24
+ id: setup-uv
25
+ uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
26
+ with:
27
+ enable-cache: false
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --all-groups
31
+
32
+ - name: Run prek
33
+ uses: j178/prek-action@bdca6f102f98e2b4c7029491a53dfd366469e33d # v2.0.4
34
+
35
+ tests:
36
+ strategy:
37
+ matrix:
38
+ python_version: ["3.11", "3.12", "3.13", "3.14"]
39
+
40
+ name: "py${{ matrix.python_version }}"
41
+ runs-on: ubuntu-latest
42
+
43
+ steps:
44
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45
+ with:
46
+ persist-credentials: false
47
+
48
+ - name: Set up UV
49
+ id: setup-uv
50
+ uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
51
+ with:
52
+ python-version: ${{ matrix.python_version }}
53
+ enable-cache: false
54
+
55
+ - name: Run tests
56
+ run: uv run pytest
57
+ env:
58
+ COVERAGE_FILE: ".coverage.${{ matrix.python_version }}"
59
+
60
+ - name: Store coverage file
61
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
62
+ with:
63
+ name: coverage-${{ matrix.python_version }}
64
+ path: .coverage.${{ matrix.python_version }}
65
+ include-hidden-files: true
66
+
67
+ coverage:
68
+ name: Coverage
69
+ runs-on: ubuntu-latest
70
+ needs: [tests]
71
+ steps:
72
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
73
+ with:
74
+ persist-credentials: false
75
+
76
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
77
+ with:
78
+ pattern: coverage-*
79
+ merge-multiple: true
80
+
81
+ - name: Display coverage
82
+ uses: ewjoachim/python-coverage-comment-action@63f52f4fbbffada6e8dee8ec432de7e01df9ba79 # v3.41
83
+ with:
84
+ MERGE_COVERAGE_FILES: true
85
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86
+
87
+ - name: Store Pull Request comment to be posted
88
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
89
+ with:
90
+ name: python-coverage-comment-action
91
+ path: python-coverage-comment-action.txt
92
+
93
+ publish:
94
+ name: Publish package to PyPI
95
+ if: github.event_name == 'push' && github.ref_type == 'tag'
96
+ runs-on: ubuntu-latest
97
+ permissions:
98
+ id-token: write
99
+ needs:
100
+ - tests
101
+ - lint
102
+ steps:
103
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104
+ with:
105
+ persist-credentials: false
106
+
107
+ - name: Build wheel & sdist
108
+ run: pipx run uv build
109
+
110
+ - name: Publish package distributions to PyPI
111
+ uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
@@ -0,0 +1,26 @@
1
+ name: Post coverage comment
2
+
3
+ on: # zizmor: ignore[dangerous-triggers]
4
+ workflow_run:
5
+ workflows: ["CI"]
6
+ types:
7
+ - completed
8
+
9
+ permissions:
10
+ pull-requests: write
11
+ actions: read
12
+ contents: read
13
+
14
+ jobs:
15
+ test:
16
+ name: Run tests & display coverage
17
+ runs-on: ubuntu-latest
18
+ if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
19
+ steps:
20
+ # DO NOT run actions/checkout here, for securitity reasons
21
+ # For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
22
+ - name: Post comment
23
+ uses: ewjoachim/python-coverage-comment-action@63f52f4fbbffada6e8dee8ec432de7e01df9ba79 # v3.41
24
+ with:
25
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26
+ GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
@@ -0,0 +1,58 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ # File names
6
+ - id: check-case-conflict
7
+ # File formats
8
+ - id: pretty-format-json
9
+ - id: check-json
10
+ - id: check-toml
11
+ - id: check-yaml
12
+ # Executables
13
+ - id: check-executables-have-shebangs
14
+ exclude: dev-env
15
+ - id: check-shebang-scripts-are-executable
16
+ # Git shenanigans
17
+ - id: check-merge-conflict
18
+ - id: check-added-large-files
19
+ # Python issues
20
+ - id: check-ast
21
+ - id: debug-statements
22
+ # Whitespace
23
+ - id: end-of-file-fixer
24
+ - id: trailing-whitespace
25
+ - id: mixed-line-ending
26
+
27
+ - repo: https://github.com/astral-sh/ruff-pre-commit
28
+ rev: v0.15.12
29
+ hooks:
30
+ - id: ruff
31
+ args: [--fix, --unsafe-fixes, --show-fixes]
32
+ - id: ruff-format
33
+
34
+ # Remove doc8 while they force old docutils.
35
+ # - repo: https://github.com/PyCQA/doc8
36
+ # rev: 0.11.2
37
+ # hooks:
38
+ # - id: doc8
39
+
40
+ - repo: https://github.com/DetachHead/basedpyright-prek-mirror
41
+ rev: 1.39.4
42
+ hooks:
43
+ - id: basedpyright
44
+ args: [--verbose]
45
+
46
+ - repo: https://github.com/astral-sh/uv-pre-commit
47
+ # uv version.
48
+ rev: 0.11.14
49
+ hooks:
50
+ - id: uv-lock
51
+
52
+ - repo: https://github.com/zizmorcore/zizmor-pre-commit
53
+ # Zizmor version.
54
+ rev: v1.24.1
55
+ hooks:
56
+ # Run the linter.
57
+ - id: zizmor
58
+ args: ["--fix=all"]
@@ -0,0 +1,75 @@
1
+ Contributing
2
+ ============
3
+
4
+ You're welcome to come and bake delicious macaroons with us :)
5
+
6
+ This project uses uv_ and prek_.
7
+
8
+ .. _uv: https://docs.astral.sh/uv/
9
+ .. _prek: https://prek.j178.dev/
10
+
11
+ There are multiple ways of interacting with the project.
12
+
13
+ I want to run the code quality tools
14
+ ------------------------------------
15
+
16
+ .. code-block:: console
17
+
18
+ # Run once:
19
+ $ prek run --all-files
20
+
21
+ # Install pre-commit hooks
22
+ $ prek install
23
+
24
+
25
+ I want a venv to play locally
26
+ -----------------------------
27
+
28
+ .. code-block:: console
29
+
30
+ $ uv sync
31
+
32
+ Use at ``uv sync --python=3.x`` if you want to work on a specific Python version.
33
+
34
+ I want to run the tests
35
+ ---------------------------
36
+
37
+ The easiest way to run the tests on a single python version is:
38
+
39
+ .. code-block:: console
40
+
41
+ $ uv run pytest
42
+
43
+
44
+ I want to build the documentation
45
+ ---------------------------------
46
+
47
+ Build with:
48
+
49
+ .. code-block:: console
50
+
51
+ $ scripts/docs
52
+ $ python -m webbrowser docs/_build/html/index.html
53
+
54
+ If Sphinx's console output is localized, and you would rather have it in English,
55
+ use the environment variable ``export LC_ALL=C.utf-8``.
56
+
57
+ I want to hack around
58
+ ---------------------
59
+
60
+ Adapt the commands in ``/scripts`` to your liking.
61
+
62
+ Core contributor additional documentation
63
+ -----------------------------------------
64
+
65
+ Release a new version
66
+ ^^^^^^^^^^^^^^^^^^^^^
67
+
68
+ Make a GitHub Release. The rest is automated.
69
+
70
+ .. note::
71
+
72
+ If you need to edit the name or body of a release in the GitHub UI, don't forget to
73
+ also rebuild the stable and latest doc on readthedocs__.
74
+
75
+ .. __: https://readthedocs.org/projects/sphinx-github-changelog
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sphinx-github-changelog
3
- Version: 1.7.1
3
+ Version: 2.0.0
4
4
  Summary: Build a sphinx changelog from GitHub Releases
5
5
  Project-URL: Homepage, https://sphinx-github-changelog.readthedocs.io/en/latest/
6
6
  Project-URL: Repository, https://github.com/ewjoachim/sphinx-github-changelog
@@ -11,17 +11,17 @@ License-File: LICENSE
11
11
  Keywords: changelog,github,releases,sphinx
12
12
  Classifier: Framework :: Sphinx
13
13
  Classifier: Framework :: Sphinx :: Extension
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
14
  Classifier: Programming Language :: Python :: 3.11
17
15
  Classifier: Programming Language :: Python :: 3.12
18
16
  Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
19
18
  Classifier: Topic :: Documentation
20
19
  Classifier: Topic :: Documentation :: Sphinx
21
20
  Classifier: Typing :: Typed
22
- Requires-Python: >=3.9
21
+ Requires-Python: >=3.11
23
22
  Requires-Dist: docutils
24
- Requires-Dist: requests
23
+ Requires-Dist: httpx
24
+ Requires-Dist: myst-parser>=5.1.0
25
25
  Requires-Dist: sphinx
26
26
  Description-Content-Type: text/x-rst
27
27
 
@@ -49,7 +49,7 @@ Sphinx Github Changelog: Build a sphinx changelog from GitHub Releases
49
49
  :alt: Documentation
50
50
 
51
51
  .. image:: https://img.shields.io/endpoint?logo=codecov&logoColor=white&url=https://raw.githubusercontent.com/wiki/ewjoachim/sphinx-github-changelog/coverage-comment-badge.json
52
- :target: https://github.com/marketplace/actions/coverage-comment
52
+ :target: https://htmlpreview.github.io/?https://github.com/ewjoachim/sphinx-github-changelog/blob/python-coverage-comment-action-data/htmlcov/index.html
53
53
  :alt: Coverage
54
54
 
55
55
  .. image:: https://img.shields.io/github/license/ewjoachim/sphinx-github-changelog?logo=open-source-initiative&logoColor=white
@@ -120,7 +120,7 @@ place people will look for it. As far as we've seen, people expect the changelog
120
120
  be:
121
121
 
122
122
  - in the repo, in ``CHANGELOG.rst``,
123
- - in the documentation.
123
+ - in the built documentation.
124
124
 
125
125
  Having the changelog in ``CHANGELOG.rst`` causes a few problems:
126
126
 
@@ -188,7 +188,7 @@ have ``repo`` scope (classic tokens) or ``contents: read`` access (fine-grained
188
188
  tokens).
189
189
 
190
190
  Pass the token as the ``SPHINX_GITHUB_CHANGELOG_TOKEN`` environment variable.
191
- You can also set the token as ``sphinx_github_changelog_token`` in ``conf.py``
191
+ You can also set the token as ``sphinx_github_changelog_token`` in ``conf.py``,
192
192
  but you should never commit secrets such as this.
193
193
 
194
194
 
@@ -221,7 +221,7 @@ Attributes
221
221
  ~~~~~~~~~~
222
222
 
223
223
  - ``github`` (optional): URL to the releases page of the repository.
224
- If not provided, auto‑detected from your git remote, as described above.
224
+ If not provided, auto-detected from your git remote, as described above.
225
225
  - ``changelog-url`` (optional): URL to the built version of your changelog.
226
226
  ``sphinx-github-changelog`` will display a link to your built changelog if the GitHub
227
227
  token is not provided (hopefully, this does not happen in your built documentation)
@@ -22,7 +22,7 @@ Sphinx Github Changelog: Build a sphinx changelog from GitHub Releases
22
22
  :alt: Documentation
23
23
 
24
24
  .. image:: https://img.shields.io/endpoint?logo=codecov&logoColor=white&url=https://raw.githubusercontent.com/wiki/ewjoachim/sphinx-github-changelog/coverage-comment-badge.json
25
- :target: https://github.com/marketplace/actions/coverage-comment
25
+ :target: https://htmlpreview.github.io/?https://github.com/ewjoachim/sphinx-github-changelog/blob/python-coverage-comment-action-data/htmlcov/index.html
26
26
  :alt: Coverage
27
27
 
28
28
  .. image:: https://img.shields.io/github/license/ewjoachim/sphinx-github-changelog?logo=open-source-initiative&logoColor=white
@@ -93,7 +93,7 @@ place people will look for it. As far as we've seen, people expect the changelog
93
93
  be:
94
94
 
95
95
  - in the repo, in ``CHANGELOG.rst``,
96
- - in the documentation.
96
+ - in the built documentation.
97
97
 
98
98
  Having the changelog in ``CHANGELOG.rst`` causes a few problems:
99
99
 
@@ -161,7 +161,7 @@ have ``repo`` scope (classic tokens) or ``contents: read`` access (fine-grained
161
161
  tokens).
162
162
 
163
163
  Pass the token as the ``SPHINX_GITHUB_CHANGELOG_TOKEN`` environment variable.
164
- You can also set the token as ``sphinx_github_changelog_token`` in ``conf.py``
164
+ You can also set the token as ``sphinx_github_changelog_token`` in ``conf.py``,
165
165
  but you should never commit secrets such as this.
166
166
 
167
167
 
@@ -194,7 +194,7 @@ Attributes
194
194
  ~~~~~~~~~~
195
195
 
196
196
  - ``github`` (optional): URL to the releases page of the repository.
197
- If not provided, auto‑detected from your git remote, as described above.
197
+ If not provided, auto-detected from your git remote, as described above.
198
198
  - ``changelog-url`` (optional): URL to the built version of your changelog.
199
199
  ``sphinx-github-changelog`` will display a link to your built changelog if the GitHub
200
200
  token is not provided (hopefully, this does not happen in your built documentation)
@@ -13,7 +13,7 @@ name = "sphinx-github-changelog"
13
13
  dynamic = ["version"]
14
14
  description = "Build a sphinx changelog from GitHub Releases"
15
15
  authors = [{ name = "Joachim Jablon", email = "ewjoachim@gmail.com" }]
16
- requires-python = ">=3.9"
16
+ requires-python = ">=3.11"
17
17
  readme = "README.rst"
18
18
  license = "MIT"
19
19
  license-files = ["LICENSE"]
@@ -24,13 +24,12 @@ classifiers = [
24
24
  "Framework :: Sphinx",
25
25
  "Framework :: Sphinx :: Extension",
26
26
  "Typing :: Typed",
27
- "Programming Language :: Python :: 3.9",
28
- "Programming Language :: Python :: 3.10",
29
27
  "Programming Language :: Python :: 3.11",
30
28
  "Programming Language :: Python :: 3.12",
31
29
  "Programming Language :: Python :: 3.13",
30
+ "Programming Language :: Python :: 3.14",
32
31
  ]
33
- dependencies = ["docutils", "requests", "Sphinx"]
32
+ dependencies = ["docutils", "myst-parser>=5.1.0", "httpx", "Sphinx"]
34
33
 
35
34
  [project.urls]
36
35
  Homepage = "https://sphinx-github-changelog.readthedocs.io/en/latest/"
@@ -39,21 +38,27 @@ Documentation = "https://sphinx-github-changelog.readthedocs.io/en/latest/"
39
38
 
40
39
  [dependency-groups]
41
40
  dev = [
42
- "doc8",
41
+ # # Remove doc8 while they force old docutils.
42
+ # "doc8",
43
43
  "pytest",
44
44
  "pytest-cov",
45
45
  "pytest-mock",
46
- "requests-mock",
47
- "pyright",
46
+ "pytest-httpx",
47
+ "basedpyright",
48
+ "pytest-subprocess>=1.6.0",
48
49
  ]
49
50
  docs = ["sphinx-rtd-theme"]
50
51
  types = ["types-requests", "types-docutils"]
51
52
 
52
53
  [tool.uv]
53
54
  default-groups = ["dev", "docs"]
55
+ exclude-newer = "5 days"
56
+ # TODO: remove after 2026-05-21
57
+ exclude-newer-package = { myst-parser = false, mdit-py-plugins = false }
54
58
 
55
- [tool.pyright]
59
+ [tool.basedpyright]
56
60
  exclude = ["tests", ".venv", "scripts", ".github"]
61
+ typeCheckingMode = "standard"
57
62
 
58
63
  [tool.ruff]
59
64
  target-version = "py39"
@@ -83,9 +88,30 @@ max-line-length = 88
83
88
  ignore-path = "docs/_build,.venv"
84
89
 
85
90
  [tool.pytest.ini_options]
86
- addopts = ["-vv", "--strict-markers", "-rfE", "-m not benchmark"]
91
+ addopts = [
92
+ "-vv",
93
+ "--strict-markers",
94
+ "-rfE",
95
+ "-m not benchmark",
96
+ "--cov=sphinx_github_changelog",
97
+ "--cov-report=term-missing",
98
+ "--cov-report=html",
99
+ "--cov-branch",
100
+ ]
87
101
  testpaths = ["tests/unit", "tests/acceptance"]
88
- filterwarnings = """
102
+ filterwarnings = '''
89
103
  error
90
- """
104
+ ignore:nodes.Node.traverse\(\) is obsoleted by Node.findall\(\):PendingDeprecationWarning
105
+ '''
91
106
  pythonpath = ["."]
107
+
108
+ [tool.coverage.run]
109
+ relative_files = true
110
+
111
+ [tool.coverage.report]
112
+ exclude_lines = [
113
+ "raise NotImplementedError",
114
+ "coverage: exclude",
115
+ "if TYPE_CHECKING:",
116
+ "[ ]+\\.\\.\\.$",
117
+ ]
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -eux
3
+
4
+ uv run sphinx-build -EW docs docs/_build/html "$@"
@@ -2,4 +2,4 @@
2
2
  set -eux
3
3
 
4
4
  # If you want more details on the underlying command, refer to ../.pre-commit-config.yaml
5
- pre-commit run --all-files --show-diff-on-failure "$@"
5
+ uvx prek run --all-files --show-diff-on-failure "$@"
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env bash
2
2
  set -eux
3
3
 
4
- pytest "$@"
4
+ uv run pytest "$@"
@@ -1,15 +1,19 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import re
3
4
  from collections.abc import Iterable
4
5
  from typing import Any
5
6
 
6
- import requests
7
+ import httpx
7
8
  from docutils import nodes
9
+ from docutils.frontend import get_default_settings
8
10
 
9
11
  # types-docutils (from typeshed) is usable but incomplete.
10
12
  # docutils-stubs is more complete but
11
13
  # https://github.com/tk0miya/docutils-stubs/issues/33
12
- from docutils.parsers.rst import Directive, directives # type: ignore
14
+ from docutils.parsers.rst import Directive, directives
15
+ from docutils.utils import new_document
16
+ from myst_parser.parsers.docutils_ import Parser
13
17
 
14
18
  from . import credentials, urls
15
19
 
@@ -161,8 +165,24 @@ def get_release_title(title: str | None, tag: str):
161
165
  return title if tag in title else f"{tag}: {title}"
162
166
 
163
167
 
168
+ def transform_private_image_urls(html: str) -> str:
169
+ """Convert signed private image URLs to permanent user-attachments URLs.
170
+
171
+ When GitHub's GraphQL API returns release descriptions, images uploaded via
172
+ drag-and-drop are returned as signed private-user-images.githubusercontent.com
173
+ URLs with 5-minute JWT expiration. This converts them to permanent
174
+ github.com/user-attachments/assets/ URLs.
175
+ """
176
+ pattern = (
177
+ r"https://private-user-images\.githubusercontent\.com/"
178
+ r"\d+/(\d+)-([a-f0-9-]{36})\.([a-z]+)\?[^\"'>\s]+"
179
+ )
180
+ return re.sub(pattern, r"https://github.com/user-attachments/assets/\2", html)
181
+
182
+
164
183
  def node_for_release(
165
- release: dict[str, Any], pypi_name: str | None = None
184
+ release: dict[str, Any],
185
+ pypi_name: str | None = None,
166
186
  ) -> nodes.Node | None:
167
187
  if release["isDraft"]:
168
188
  return None # For now, draft releases are excluded
@@ -192,8 +212,11 @@ def node_for_release(
192
212
  subtitle_paragraph += subtitle
193
213
  section += subtitle_paragraph
194
214
 
195
- # Body
196
- section += nodes.raw(text=release["descriptionHTML"], format="html")
215
+ # Body - parse raw markdown with markdown-it-py
216
+ markdown_content = transform_private_image_urls(release["description"] or "")
217
+
218
+ changelog_nodes = convert_markdown_to_nodes(markdown_content)
219
+ section += changelog_nodes
197
220
  return section
198
221
 
199
222
 
@@ -207,7 +230,7 @@ def extract_releases(
207
230
  repository(owner: "{owner}", name: "{repo}") {{
208
231
  releases(orderBy: {{field: CREATED_AT, direction: DESC}}, first:100) {{
209
232
  nodes {{
210
- name, descriptionHTML, url, tagName, publishedAt, isDraft
233
+ name, description, url, tagName, publishedAt, isDraft
211
234
  }}
212
235
  }}
213
236
  }}
@@ -233,20 +256,40 @@ def extract_releases(
233
256
 
234
257
  def github_call(url, token, query):
235
258
  try:
236
- response = requests.post(
259
+ response = httpx.post(
237
260
  url, json=query, headers={"Authorization": f"token {token}"}
238
- )
239
- response.raise_for_status()
240
- # Let's not imagine if GitHub responds non-json...
241
- return response.json()
261
+ ).raise_for_status()
242
262
 
243
- except requests.HTTPError as exc:
263
+ except httpx.HTTPStatusError as exc:
244
264
  # GraphQL always responds 200
245
265
  raise ChangelogError(
246
266
  f"Unexpected GitHub API error status code: {exc.response.status_code}\n"
247
267
  f"{exc.response.text}"
248
268
  ) from exc
249
- except requests.RequestException as exc:
269
+ except httpx.HTTPError as exc:
250
270
  raise ChangelogError(
251
271
  "Could not retrieve changelog from github: " + str(exc)
252
272
  ) from exc
273
+
274
+ # Let's not imagine if GitHub responds non-json...
275
+ return response.json()
276
+
277
+
278
+ def convert_markdown_to_nodes(markdown: str) -> list[nodes.Node]:
279
+ """
280
+ Convert markdown to docutils nodes
281
+ """
282
+ if not markdown or not markdown.strip():
283
+ return []
284
+ parser = Parser()
285
+ settings = get_default_settings(parser)
286
+
287
+ settings.myst_gfm_only = True
288
+
289
+ settings.myst_heading_anchors = 3
290
+
291
+ document = new_document("changelog_text", settings=settings)
292
+
293
+ parser.parse(markdown, document)
294
+
295
+ return document.children
@@ -30,7 +30,7 @@ def is_github_token(token: str) -> bool:
30
30
  As of 2025-05-08 the prefixes are `ghp_`, `gho_`, `ghu_`, and `ghs_`. We
31
31
  use a generic check for `gh?_` to allow for future prefixes.
32
32
  """
33
- return token.startswith("gh") and token[3] == "_"
33
+ return token.startswith("gh") and len(token) > 4 and token[3] == "_"
34
34
 
35
35
 
36
36
  def get_token_from_git_credential(host: str = "github.com") -> str | None:
@@ -48,7 +48,7 @@ def get_token_from_git_credential(host: str = "github.com") -> str | None:
48
48
  text=True,
49
49
  )
50
50
  for ln in resp.splitlines():
51
- key, eq, value = ln.partition("=")
51
+ key, _, value = ln.partition("=")
52
52
  if key == "password" and is_github_token(value):
53
53
  return value
54
54
  return None