sphinx-roles 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 (36) hide show
  1. sphinx_roles-0.0.1/.github/PULL_REQUEST_TEMPLATE.md +5 -0
  2. sphinx_roles-0.0.1/.github/release-drafter.yml +24 -0
  3. sphinx_roles-0.0.1/.github/workflows/policy.yaml +15 -0
  4. sphinx_roles-0.0.1/.github/workflows/qa.yaml +16 -0
  5. sphinx_roles-0.0.1/.github/workflows/release-drafter.yaml +16 -0
  6. sphinx_roles-0.0.1/.github/workflows/release-publish.yaml +72 -0
  7. sphinx_roles-0.0.1/.gitignore +149 -0
  8. sphinx_roles-0.0.1/.pre-commit-config.yaml +28 -0
  9. sphinx_roles-0.0.1/CONTRIBUTING.md +219 -0
  10. sphinx_roles-0.0.1/LICENSE +674 -0
  11. sphinx_roles-0.0.1/Makefile +48 -0
  12. sphinx_roles-0.0.1/PKG-INFO +75 -0
  13. sphinx_roles-0.0.1/README.md +63 -0
  14. sphinx_roles-0.0.1/common.mk +271 -0
  15. sphinx_roles-0.0.1/pyproject.toml +269 -0
  16. sphinx_roles-0.0.1/setup.cfg +4 -0
  17. sphinx_roles-0.0.1/sphinx_roles/__init__.py +53 -0
  18. sphinx_roles-0.0.1/sphinx_roles/_version.py +34 -0
  19. sphinx_roles-0.0.1/sphinx_roles/domain.py +64 -0
  20. sphinx_roles-0.0.1/sphinx_roles/roles.py +70 -0
  21. sphinx_roles-0.0.1/sphinx_roles.egg-info/PKG-INFO +75 -0
  22. sphinx_roles-0.0.1/sphinx_roles.egg-info/SOURCES.txt +34 -0
  23. sphinx_roles-0.0.1/sphinx_roles.egg-info/dependency_links.txt +1 -0
  24. sphinx_roles-0.0.1/sphinx_roles.egg-info/requires.txt +2 -0
  25. sphinx_roles-0.0.1/sphinx_roles.egg-info/top_level.txt +1 -0
  26. sphinx_roles-0.0.1/tests/__init__.py +15 -0
  27. sphinx_roles-0.0.1/tests/integration/__init__.py +15 -0
  28. sphinx_roles-0.0.1/tests/integration/example/__init__.py +15 -0
  29. sphinx_roles-0.0.1/tests/integration/example/conf.py +32 -0
  30. sphinx_roles-0.0.1/tests/integration/example/index.rst +22 -0
  31. sphinx_roles-0.0.1/tests/integration/example/myst-file.md +17 -0
  32. sphinx_roles-0.0.1/tests/integration/example/other-file.rst +6 -0
  33. sphinx_roles-0.0.1/tests/integration/sphinx_roles_integration_test.py +50 -0
  34. sphinx_roles-0.0.1/tests/unit/__init__.py +15 -0
  35. sphinx_roles-0.0.1/tests/unit/test_sphinx_roles.py +173 -0
  36. sphinx_roles-0.0.1/uv.lock +944 -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,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,72 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ tags:
5
+ # These tags should be protected, remember to enable the rule:
6
+ # https://github.com/canonical/starbase/settings/tag_protection
7
+ - "[0-9]+.[0-9]+.[0-9]+"
8
+
9
+ permissions:
10
+ contents: write
11
+
12
+ jobs:
13
+ source-wheel:
14
+ runs-on: [self-hosted, jammy]
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v4
18
+ - name: Fetch tag annotations
19
+ run: |
20
+ # Note: we fetch the tags here instead of using actions/checkout's "fetch-tags"
21
+ # because of https://github.com/actions/checkout/issues/1467
22
+ git fetch --force --tags --depth 1
23
+ git describe --dirty --long --match '[0-9]*.[0-9]*.[0-9]*' --exclude '*[^0-9.]*'
24
+ - name: Setup Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.10"
28
+ check-latest: true
29
+ - name: Build packages
30
+ run: |
31
+ pip install build twine
32
+ python3 -m build
33
+ twine check dist/*
34
+ - name: Upload pypi packages artifact
35
+ uses: actions/upload-artifact@v4
36
+ with:
37
+ name: pypi-packages
38
+ path: dist/
39
+ pypi:
40
+ needs: ["source-wheel"]
41
+ runs-on: [self-hosted, jammy, amd64]
42
+ permissions:
43
+ # IMPORTANT: this permission is mandatory for trusted publishing
44
+ id-token: write
45
+ steps:
46
+ - name: Get packages
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: pypi-packages
50
+ path: dist/
51
+ - name: Publish to pypi
52
+ # Note: this action uses PyPI's support for Trusted Publishers
53
+ # It needs a configuration on the PyPI project - see:
54
+ # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions
55
+ uses: pypa/gh-action-pypi-publish@release/v1
56
+ github-release:
57
+ needs: ["source-wheel"]
58
+ runs-on: [self-hosted, jammy]
59
+ steps:
60
+ - name: Get pypi artifacts
61
+ uses: actions/download-artifact@v4
62
+ with:
63
+ name: pypi-packages
64
+ - name: Release
65
+ uses: softprops/action-gh-release@v2
66
+ with:
67
+ # Generate release notes on the new GH release
68
+ generate_release_notes: true
69
+ # Add wheel and source tarball
70
+ files: |
71
+ *.whl
72
+ *.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,219 @@
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 project expectations
7
+
8
+ Before you start working on the project, there are three documents for you to digest.
9
+
10
+ ### Ubuntu Code of Conduct
11
+
12
+ Projects governed by Canonical expect good conduct and excellence from every member. The
13
+ specific principles are laid out in the [Ubuntu Code of
14
+ Conduct](https://ubuntu.com/community/ethos/code-of-conduct).
15
+
16
+ ### Canonical Contributor License Agreement
17
+
18
+ As a contributor, you retain your copyright and attribution rights, provided you sign
19
+ the [Canonical Contributor Licence Agreement](http://www.ubuntu.com/legal/contributors).
20
+ Before committing any code, review its terms. If you agree and sign it, your code can be
21
+ incorporated into the repository.
22
+
23
+ ### Open source license
24
+
25
+ This project is licensed under [GPL-3.0](LICENSE).
26
+
27
+ ## Report an issue or open a request
28
+
29
+ If you find a bug or feature gap in the project, look for it in the [project's GitHub
30
+ issues](https://github.com/canonical/sphinx-roles/issues) first. If you have fresh
31
+ input, add your voice to the issue.
32
+
33
+ If the bug or feature doesn't have an issue, we invite you to [open
34
+ one](https://github.com/canonical/sphinx-roles/issues/new/choose).
35
+
36
+ ## Set up for development
37
+
38
+ This project uses a forking, feature-based workflow. Most work occurs on people's local
39
+ systems and is heavily terminal-dependent. Remote testing and building is provided on
40
+ GitHub for continuous integration and delivery.
41
+
42
+ Start by [creating a personal fork](https://github.com/canonical/sphinx-roles/fork) of
43
+ the repository on GitHub.
44
+
45
+ Next, on your host system, clone your fork and sync it with the upstream repository:
46
+
47
+ ```bash
48
+ git clone git@github.com:<username>/sphinx-roles --recurse-submodules
49
+ cd sphinx-roles
50
+ git remote add upstream git@github.com:canonical/sphinx-roles
51
+ git fetch upstream
52
+ ```
53
+
54
+ If you don't authenticate with SSH, clone with
55
+ [HTTPS](https://docs.github.com/en/get-started/git-basics/about-remote-repositories#cloning-with-https-urls)
56
+ instead:
57
+
58
+ ```bash
59
+ git clone https://github.com/<username>/sphinx-roles --recurse-submodules
60
+ cd sphinx-roles
61
+ git remote add upstream https://github.com/canonical/sphinx-roles
62
+ git fetch upstream
63
+ ```
64
+
65
+ Inside the project directory, set up the virtual development environment and install all
66
+ dependencies, linters, and testers:
67
+
68
+ ```bash
69
+ make install
70
+ make lint
71
+ make test
72
+ ```
73
+
74
+ If all linting and testing completes without errors, your local environment is ready.
75
+
76
+ ## Contribute a change
77
+
78
+ With the prerequisites out of the way, let's walk through how to make a contribution to
79
+ the project.
80
+
81
+ ### Research the topic
82
+
83
+ All significant work should be tied to an existing issue or ticket.
84
+
85
+ If you'd like to add a small feature or fix, check the project's GitHub issues to see if
86
+ others have reported it. If they have, look into the current status of the topic. If no
87
+ one else is working on it, add a comment stating that you'd like to take it on, and a
88
+ maintainer will assign it to you.
89
+
90
+ If you're ever in doubt about developments in the project, ask!
91
+
92
+ ### Create a development branch
93
+
94
+ Once you've settled on a topic to work on, it's time to set up a local branch.
95
+
96
+ Always start by syncing against the branch and the dependencies you're basing your
97
+ changes on.
98
+
99
+ ```bash
100
+ git checkout main
101
+ git pull upstream main
102
+ git checkout -b <new-branch-name>
103
+ make install
104
+ ```
105
+
106
+ The new branch name should be brief, at no more than 80 characters. Format your branch
107
+ name as `<ticket-id>-<description>`. For example, if you're working on GitHub issue
108
+ \#235, and it's about adding a string sanitizer, you'd name your branch
109
+ `issue-235-add-string-sanitizer-method`.
110
+
111
+ ````
112
+
113
+ ### Commit a change
114
+
115
+ Once you've made the changes to the code and you're ready to test it, start by
116
+ committing:
117
+
118
+ ```bash
119
+ git add -A
120
+ git commit
121
+ ````
122
+
123
+ Format the commit message according to the [Conventional
124
+ Commits](https://www.conventionalcommits.org/en/v1.0.0/) style. For the sanitizer
125
+ example, an appropriate commit title would be:
126
+
127
+ ```
128
+ feat: add text sanitizer
129
+ ```
130
+
131
+ If you need help determining the type of conventional commit for your change, look at
132
+ the history of the file in question with `git log --oneline <filename>` . When you're
133
+ done browsing, press `Q` to exit the interactive log.
134
+
135
+ > **Tip**
136
+ >
137
+ > With complex changes, you might get stuck choosing a conventional commit type.
138
+ >
139
+ > This may signal that a commit is doing more than one thing and should be broken into
140
+ > multiple smaller commits. A commit should not, for example, refactor code and fix a
141
+ > bug. That should be two separate commits.
142
+ >
143
+ > In other scenarios, multiple types could be appropriate because of the nature of the
144
+ > commit. This can happen with `test` and `docs`, which can be used as either types
145
+ > or scopes.
146
+ >
147
+ > Run down the following list and select the highest-ranked type that fits your change:
148
+ >
149
+ > - ci
150
+ > - build
151
+ > - feat
152
+ > - fix
153
+ > - perf
154
+ > - refactor
155
+ > - style
156
+ > - test
157
+ > - docs
158
+ > - chore
159
+
160
+ Committing triggers the [pre-commit](https://pre-commit.com/) hook, which runs the
161
+ automatic code formatter and the fast linters.
162
+
163
+ If the linters reformatted any of the files, the commit was cancelled. To make the
164
+ changes stick, restage the modified files with `git add -A` and commit again.
165
+
166
+ ### Test the change
167
+
168
+ All nontrivial code changes should be accompanied by a reasonable set of tests.
169
+
170
+ The sphinx-roles test suite includes both unit and integration tests. If you're not
171
+ sure which tests you should add, go with your best judgement – additional tests can be
172
+ added during the review process.
173
+
174
+ Once you've made your changes, run the test suite:
175
+
176
+ ```bash
177
+ make test
178
+ ```
179
+
180
+ When iterating and testing, it's a good practice to clean the local temporary files that
181
+ the tests generate:
182
+
183
+ ```bash
184
+ make clean
185
+ ```
186
+
187
+ In rare instances, tests can fail in unpredictable ways, regardless of the state of your
188
+ code. In such cases, it's best to delete your virtual environment and start over:
189
+
190
+ ```bash
191
+ rm -rf .venv
192
+ make clean
193
+ make install
194
+ ```
195
+
196
+ ### Push the branch and open a PR
197
+
198
+ Once your work is committed to your branch, push it to your fork:
199
+
200
+ ```bash
201
+ git push -u origin <branch-name>
202
+ ```
203
+
204
+ Finally, [open a PR](https://github.com/canonical/sphinx-roles/compare) for it on
205
+ GitHub. If your branch has one commit, GitHub will title the PR after it. If your branch
206
+ has more than one commit, name the PR after the most significant. Once open, reviewers
207
+ are assigned automatically to your work.
208
+
209
+ ### Follow up for the review
210
+
211
+ When a maintainer reviews your PR, they typically leave inline comments and suggestions
212
+ on the code.
213
+
214
+ If the comment is a request, accommodate it by pushing one or more additional commits to
215
+ the branch. It's simplest to add the commits locally and push, rather than in the GitHub
216
+ interface, as it leads to fewer potential conflicts with syncs.
217
+
218
+ Don't force-push changes to the branch. It destroys the history of the review and makes
219
+ it harder for maintainers to see code changes.