sphinx-relabel 0.0.1__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 (39) hide show
  1. sphinx_relabel-0.0.1/.github/PULL_REQUEST_TEMPLATE.md +5 -0
  2. sphinx_relabel-0.0.1/.github/release-drafter.yml +24 -0
  3. sphinx_relabel-0.0.1/.github/renovate.json5 +4 -0
  4. sphinx_relabel-0.0.1/.github/workflows/policy.yaml +15 -0
  5. sphinx_relabel-0.0.1/.github/workflows/qa.yaml +16 -0
  6. sphinx_relabel-0.0.1/.github/workflows/release-drafter.yaml +16 -0
  7. sphinx_relabel-0.0.1/.github/workflows/release-publish.yaml +69 -0
  8. sphinx_relabel-0.0.1/.gitignore +149 -0
  9. sphinx_relabel-0.0.1/.pre-commit-config.yaml +28 -0
  10. sphinx_relabel-0.0.1/CONTRIBUTING.md +203 -0
  11. sphinx_relabel-0.0.1/LICENSE +674 -0
  12. sphinx_relabel-0.0.1/Makefile +48 -0
  13. sphinx_relabel-0.0.1/PKG-INFO +68 -0
  14. sphinx_relabel-0.0.1/README.md +56 -0
  15. sphinx_relabel-0.0.1/assets/logo.png +0 -0
  16. sphinx_relabel-0.0.1/common.mk +271 -0
  17. sphinx_relabel-0.0.1/pyproject.toml +267 -0
  18. sphinx_relabel-0.0.1/setup.cfg +4 -0
  19. sphinx_relabel-0.0.1/sphinx_relabel/__init__.py +54 -0
  20. sphinx_relabel-0.0.1/sphinx_relabel/_version.py +34 -0
  21. sphinx_relabel-0.0.1/sphinx_relabel/callback.py +57 -0
  22. sphinx_relabel-0.0.1/sphinx_relabel.egg-info/PKG-INFO +68 -0
  23. sphinx_relabel-0.0.1/sphinx_relabel.egg-info/SOURCES.txt +37 -0
  24. sphinx_relabel-0.0.1/sphinx_relabel.egg-info/dependency_links.txt +1 -0
  25. sphinx_relabel-0.0.1/sphinx_relabel.egg-info/requires.txt +2 -0
  26. sphinx_relabel-0.0.1/sphinx_relabel.egg-info/top_level.txt +1 -0
  27. sphinx_relabel-0.0.1/tests/__init__.py +13 -0
  28. sphinx_relabel-0.0.1/tests/integration/__init__.py +13 -0
  29. sphinx_relabel-0.0.1/tests/integration/dict_input_example/__init__.py +13 -0
  30. sphinx_relabel-0.0.1/tests/integration/dict_input_example/conf.py +32 -0
  31. sphinx_relabel-0.0.1/tests/integration/dict_input_example/index.rst +12 -0
  32. sphinx_relabel-0.0.1/tests/integration/file_input_example/__init__.py +13 -0
  33. sphinx_relabel-0.0.1/tests/integration/file_input_example/conf.py +30 -0
  34. sphinx_relabel-0.0.1/tests/integration/file_input_example/index.rst +12 -0
  35. sphinx_relabel-0.0.1/tests/integration/file_input_example/labels.json +3 -0
  36. sphinx_relabel-0.0.1/tests/integration/relabel_integration_test.py +101 -0
  37. sphinx_relabel-0.0.1/tests/unit/__init__.py +13 -0
  38. sphinx_relabel-0.0.1/tests/unit/relabel_unit_test.py +14 -0
  39. sphinx_relabel-0.0.1/uv.lock +868 -0
@@ -0,0 +1,5 @@
1
+ - [ ] Have you followed the guidelines for contributing?
2
+ - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
3
+ - [ ] Have you successfully run `make lint && make test`?
4
+
5
+ ---
@@ -0,0 +1,24 @@
1
+ categories:
2
+ - title: "New Features"
3
+ labels:
4
+ - "enhancement"
5
+ - title: "Maintenance"
6
+ labels:
7
+ - "maintenance"
8
+ - title: "Bug Fixes"
9
+ labels:
10
+ - "bug"
11
+ - title: "Specifications and Documentation"
12
+ label:
13
+ - "specification"
14
+ - "doc"
15
+ - title: "Tooling"
16
+ label:
17
+ - "tooling"
18
+ change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
19
+ template: |
20
+ Special thanks to the contributors that made this release happen: $CONTRIBUTORS
21
+
22
+ ## Full list of changes
23
+
24
+ $CHANGES
@@ -0,0 +1,4 @@
1
+ {
2
+ $schema: "https://docs.renovatebot.com/renovate-schema.json",
3
+ extends: ["config:recommended"],
4
+ }
@@ -0,0 +1,15 @@
1
+ name: Check policy
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - main
7
+ - hotfix/*
8
+ - work/check-policy # For development
9
+
10
+ jobs:
11
+ policy:
12
+ uses: canonical/starflow/.github/workflows/policy.yaml@main
13
+ python-scans:
14
+ name: Security scan
15
+ uses: canonical/starflow/.github/workflows/scan-python.yaml@main
@@ -0,0 +1,16 @@
1
+ name: QA
2
+ on:
3
+ push:
4
+ branches:
5
+ - "main"
6
+ - "feature/*"
7
+ - "hotfix/*"
8
+ - "release/*"
9
+ - "renovate/*"
10
+ pull_request:
11
+
12
+ jobs:
13
+ lint:
14
+ uses: canonical/starflow/.github/workflows/lint-python.yaml@main
15
+ test:
16
+ uses: canonical/starflow/.github/workflows/test-python.yaml@main
@@ -0,0 +1,16 @@
1
+ name: Release Drafter
2
+
3
+ on:
4
+ push:
5
+ # branches to consider in the event; optional, defaults to all
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ update_release_draft:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Release Drafter
14
+ uses: release-drafter/release-drafter@v6.1.0
15
+ env:
16
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,69 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ tags:
5
+ - "[0-9]+.[0-9]+.[0-9]+"
6
+
7
+ permissions:
8
+ contents: write
9
+
10
+ jobs:
11
+ source-wheel:
12
+ runs-on: [self-hosted]
13
+ steps:
14
+ - name: Install uv
15
+ run: |
16
+ sudo snap install --classic astral-uv
17
+ sudo apt --yes install python3-venv
18
+ - name: Checkout
19
+ uses: actions/checkout@v6
20
+ - name: Fetch tag annotations
21
+ run: |
22
+ # Note: we fetch the tags here instead of using actions/checkout's "fetch-tags"
23
+ # because of https://github.com/actions/checkout/issues/1467
24
+ git fetch --force --tags --depth 1
25
+ git describe --dirty --long --match '[0-9]*.[0-9]*.[0-9]*' --exclude '*[^0-9.]*'
26
+ - name: Build packages
27
+ run: |
28
+ uv venv --no-managed-python
29
+ uv pip install build twine
30
+ uv run -m build
31
+ uv run twine check dist/*
32
+ - name: Upload pypi packages artifact
33
+ uses: actions/upload-artifact@v5
34
+ with:
35
+ name: pypi-packages
36
+ path: dist/
37
+ pypi:
38
+ needs: ["source-wheel"]
39
+ runs-on: [self-hosted]
40
+ permissions:
41
+ id-token: write
42
+ steps:
43
+ - name: Get packages
44
+ uses: actions/download-artifact@v6
45
+ with:
46
+ name: pypi-packages
47
+ path: dist/
48
+ - name: Publish to pypi
49
+ # Note: this action uses PyPI's support for Trusted Publishers
50
+ # It needs a configuration on the PyPI project - see:
51
+ # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions
52
+ uses: pypa/gh-action-pypi-publish@release/v1
53
+ github-release:
54
+ needs: ["source-wheel"]
55
+ runs-on: [self-hosted]
56
+ steps:
57
+ - name: Get pypi artifacts
58
+ uses: actions/download-artifact@v6
59
+ with:
60
+ name: pypi-packages
61
+ - name: Release
62
+ uses: softprops/action-gh-release@v2
63
+ with:
64
+ # Generate release notes on the new GH release
65
+ generate_release_notes: true
66
+ # Add wheel and source tarball
67
+ files: |
68
+ *.whl
69
+ *.tar.gz
@@ -0,0 +1,149 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ *.snap
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ .results.*.xml
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+ docs/spelling/
76
+
77
+ # PyBuilder
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .direnv
109
+ .env
110
+ .venv
111
+ env/
112
+ venv/
113
+ ENV/
114
+ env.bak/
115
+ venv.bak/
116
+
117
+ # Spyder project settings
118
+ .spyderproject
119
+ .spyproject
120
+
121
+ # Rope project settings
122
+ .ropeproject
123
+
124
+ # mkdocs documentation
125
+ /site
126
+
127
+ # mypy
128
+ .mypy_cache/
129
+ .dmypy.json
130
+ dmypy.json
131
+
132
+ # Pyre type checker
133
+ .pyre/
134
+
135
+ # Caches for various tools
136
+ /.*_cache/
137
+
138
+ # Test results
139
+ /results/
140
+ .test_output/
141
+
142
+ # direnv
143
+ .envrc
144
+
145
+ # Ignore version module generated by setuptools_scm
146
+ */_version.py
147
+
148
+ # Visual Studio Code
149
+ .vscode/
@@ -0,0 +1,28 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: "v5.0.0"
6
+ hooks:
7
+ - id: trailing-whitespace
8
+ - id: end-of-file-fixer
9
+ - id: check-yaml
10
+ - id: check-added-large-files
11
+ - id: check-merge-conflict
12
+ - id: check-toml
13
+ - id: fix-byte-order-marker
14
+ - id: mixed-line-ending
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: "v0.11.13"
17
+ hooks:
18
+ # Run the linter
19
+ - id: ruff
20
+ args: [--fix, --exit-non-zero-on-fix]
21
+ # Run the formatter
22
+ - id: ruff-format
23
+ - repo: https://github.com/pre-commit/mirrors-prettier
24
+ rev: "" # Intentionally blank, despite the warning.
25
+ hooks:
26
+ - id: prettier
27
+ additional_dependencies:
28
+ - prettier@3.4.2
@@ -0,0 +1,203 @@
1
+ # Contributing
2
+
3
+ All contributors should become familiar with this guide. It outlines the expectations
4
+ and practices for participating in the project.
5
+
6
+ ## Review the license
7
+
8
+ This project is licensed under [GPL-3.0](LICENSE).
9
+
10
+ ## Report an issue or open a request
11
+
12
+ If you find a bug or feature gap in the project, look for it in the [project's GitHub
13
+ issues](https://github.com/jahn-junior/sphinx-relabel/issues) first. If you have
14
+ fresh input, add your voice to the issue.
15
+
16
+ If the bug or feature doesn't have an issue, we invite you to [open
17
+ one](https://github.com/jahn-junior/sphinx-relabel/issues/new/choose).
18
+
19
+ ## Set up for development
20
+
21
+ This project uses a forking, feature-based workflow. Most work occurs on people's local
22
+ systems and is heavily terminal-dependent. Remote testing and building is provided on
23
+ GitHub for continuous integration and delivery.
24
+
25
+ Start by [creating a personal
26
+ fork](https://github.com/jahn-junior/sphinx-relabel/fork) of the repository on
27
+ GitHub.
28
+
29
+ Next, on your host system, clone your fork and sync it with the upstream repository:
30
+
31
+ ```bash
32
+ git clone git@github.com:<username>/sphinx-relabel --recurse-submodules
33
+ cd sphinx-relabel
34
+ git remote add upstream git@github.com:jahn-junior/sphinx-relabel
35
+ git fetch upstream
36
+ ```
37
+
38
+ If you don't authenticate with SSH, clone with
39
+ [HTTPS](https://docs.github.com/en/get-started/git-basics/about-remote-repositories#cloning-with-https-urls)
40
+ instead:
41
+
42
+ ```bash
43
+ git clone https://github.com/<username>/sphinx-relabel --recurse-submodules
44
+ cd sphinx-relabel
45
+ git remote add upstream https://github.com/jahn-junior/sphinx-relabel
46
+ git fetch upstream
47
+ ```
48
+
49
+ Inside the project directory, set up the virtual development environment and install all
50
+ dependencies, linters, and testers:
51
+
52
+ ```bash
53
+ make install
54
+ make lint
55
+ make test
56
+ ```
57
+
58
+ If all linting and testing completes without errors, your local environment is ready.
59
+
60
+ ## Contribute a change
61
+
62
+ With the prerequisites out of the way, let's walk through how to make a contribution to
63
+ the project.
64
+
65
+ ### Research the topic
66
+
67
+ All significant work should be tied to an existing issue or ticket.
68
+
69
+ If you'd like to add a small feature or fix, check the project's GitHub issues to see if
70
+ others have reported it. If they have, look into the current status of the topic. If no
71
+ one else is working on it, add a comment stating that you'd like to take it on, and a
72
+ maintainer will assign it to you.
73
+
74
+ If you're ever in doubt about developments in the project, ask!
75
+
76
+ ### Create a development branch
77
+
78
+ Once you've settled on a topic to work on, it's time to set up a local branch.
79
+
80
+ Always start by syncing against the branch and the dependencies you're basing your
81
+ changes on.
82
+
83
+ ```bash
84
+ git checkout main
85
+ git pull upstream main
86
+ git checkout -b <new-branch-name>
87
+ make install
88
+ ```
89
+
90
+ The new branch name should be brief, at no more than 80 characters. Format your branch
91
+ name as `<ticket-id>-<description>`. For example, if you're working on GitHub issue
92
+ \#235, and it's about adding a string sanitizer, you'd name your branch
93
+ `issue-235-add-string-sanitizer-method`.
94
+
95
+ ````
96
+
97
+ ### Commit a change
98
+
99
+ Once you've made the changes to the code and you're ready to test it, start by
100
+ committing:
101
+
102
+ ```bash
103
+ git add -A
104
+ git commit
105
+ ````
106
+
107
+ Format the commit message according to the [Conventional
108
+ Commits](https://www.conventionalcommits.org/en/v1.0.0/) style. For the sanitizer
109
+ example, an appropriate commit title would be:
110
+
111
+ ```
112
+ feat: add text sanitizer
113
+ ```
114
+
115
+ If you need help determining the type of conventional commit for your change, look at
116
+ the history of the file in question with `git log --oneline <filename>` . When you're
117
+ done browsing, press `Q` to exit the interactive log.
118
+
119
+ > **Tip**
120
+ >
121
+ > With complex changes, you might get stuck choosing a conventional commit type.
122
+ >
123
+ > This may signal that a commit is doing more than one thing and should be broken into
124
+ > multiple smaller commits. A commit should not, for example, refactor code and fix a
125
+ > bug. That should be two separate commits.
126
+ >
127
+ > In other scenarios, multiple types could be appropriate because of the nature of the
128
+ > commit. This can happen with `test` and `docs`, which can be used as either types
129
+ > or scopes.
130
+ >
131
+ > Run down the following list and select the highest-ranked type that fits your change:
132
+ >
133
+ > - ci
134
+ > - build
135
+ > - feat
136
+ > - fix
137
+ > - perf
138
+ > - refactor
139
+ > - style
140
+ > - test
141
+ > - docs
142
+ > - chore
143
+
144
+ Committing triggers the [pre-commit](https://pre-commit.com/) hook, which runs the
145
+ automatic code formatter and the fast linters.
146
+
147
+ If the linters reformatted any of the files, the commit was cancelled. To make the
148
+ changes stick, restage the modified files with `git add -A` and commit again.
149
+
150
+ ### Test the change
151
+
152
+ All nontrivial code changes should be accompanied by a reasonable set of tests.
153
+
154
+ The sphinx-relabel test suite includes both unit and integration tests. If you're not
155
+ sure which tests you should add, go with your best judgement – additional tests can be
156
+ added during the review process.
157
+
158
+ Once you've made your changes, run the test suite:
159
+
160
+ ```bash
161
+ make test
162
+ ```
163
+
164
+ When iterating and testing, it's a good practice to clean the local temporary files that
165
+ the tests generate:
166
+
167
+ ```bash
168
+ make clean
169
+ ```
170
+
171
+ In rare instances, tests can fail in unpredictable ways, regardless of the state of your
172
+ code. In such cases, it's best to delete your virtual environment and start over:
173
+
174
+ ```bash
175
+ rm -rf .venv
176
+ make clean
177
+ make install
178
+ ```
179
+
180
+ ### Push the branch and open a PR
181
+
182
+ Once your work is committed to your branch, push it to your fork:
183
+
184
+ ```bash
185
+ git push -u origin <branch-name>
186
+ ```
187
+
188
+ Finally, [open a PR](https://github.com/jahn-junior/sphinx-relabel/compare) for it on
189
+ GitHub. If your branch has one commit, GitHub will title the PR after it. If your branch
190
+ has more than one commit, name the PR after the most significant. Once open, reviewers
191
+ are assigned automatically to your work.
192
+
193
+ ### Follow up for the review
194
+
195
+ When a maintainer reviews your PR, they typically leave inline comments and suggestions
196
+ on the code.
197
+
198
+ If the comment is a request, accommodate it by pushing one or more additional commits to
199
+ the branch. It's simplest to add the commits locally and push, rather than in the GitHub
200
+ interface, as it leads to fewer potential conflicts with syncs.
201
+
202
+ Don't force-push changes to the branch. It destroys the history of the review and makes
203
+ it harder for maintainers to see code changes.