Skip to content

Commit 793d52a

Browse files
committed
chore: Update project template to sphinx-notes/cookiecutter@7cadd39d
1 parent 9988a57 commit 793d52a

File tree

11 files changed

+137
-51
lines changed

11 files changed

+137
-51
lines changed

.cruft.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/sphinx-notes/cookiecutter",
3-
"commit": "7e07548aad55432b86d881ccdab66eb1c89986c0",
3+
"commit": "7cadd39d13e7e95f37aecb9e998f4d7bb66dbf10",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -14,8 +14,13 @@
1414
"github_repo": "comboroles",
1515
"pypi_name": "sphinxnotes-comboroles",
1616
"pypi_owner": "SilverRainZ",
17+
"is_python_project": true,
18+
"python_version": "3.12",
19+
"is_sphinx_extension": true,
20+
"sphinx_version": "7.0",
21+
"development_status": "3 - Alpha",
1722
"_template": "https://github.com/sphinx-notes/cookiecutter",
18-
"_commit": "7e07548aad55432b86d881ccdab66eb1c89986c0"
23+
"_commit": "7cadd39d13e7e95f37aecb9e998f4d7bb66dbf10"
1924
}
2025
},
2126
"directory": null

.github/workflows/pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313

1414
jobs:
1515
pages:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-latest
1717
environment:
1818
name: github-pages
1919
url: ${{ steps.deployment.outputs.page_url }}

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
rev: v0.6.1
44
hooks:
5-
- id: ruff
5+
- id: ruff-check
6+
args: [ --fix ]
67
- id: ruff-format

Makefile

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@ RM = rm -rf
99
GIT = git
1010
OPEN = xdg-open
1111

12-
# Build sphinx documentation.
1312
.PHONY: docs
1413
docs:
1514
$(MAKE) -C docs/
1615

17-
# View sphinx HTML documentation in browser.
18-
.PHONY: view
16+
.PHONY:
1917
view:
2018
$(OPEN) docs/_build/html/index.html
2119

2220
.PHONY: clean
2321
clean:
24-
$(MAKE) -C docs/ clean | true
25-
$(RM) dist/ | true
22+
$(MAKE) -C docs/ clean; $(RM) dist/
2623

27-
.PHONY: clean
24+
.PHONY: fmt
2825
fmt:
29-
ruff format src/
26+
ruff format src/ && ruff check --fix src/
3027

31-
# Run unittest.
3228
.PHONY: test
3329
test:
3430
$(PY) -m unittest discover -s tests -v
3531

32+
################################################################################
33+
# Distribution Package
34+
################################################################################
35+
3636
# Build distribution package, for "install" or "upload".
3737
.PHONY: dist
3838
dist: pyproject.toml clean
@@ -54,28 +54,37 @@ install: dist
5454
upload: dist
5555
$(PY) -m twine upload --repository pypi $</*
5656

57-
# Same to the aboved "upload" target, but this publishs to PyPI test server
58-
# <https://test.pypi.org/>.
59-
.PHONY: upload-test
60-
upload-test: dist
61-
$(PY) -m twine upload --repository testpypi $</*
57+
################################################################################
58+
# Cookiecutter Incremental Updates
59+
################################################################################
6260

6361
# Keep up to date with the latest template.
64-
# See also https://github.com/sphinx-notes/cookiecutter.
65-
.PHONY: update-template
66-
update-template:
62+
# See https://github.com/sphinx-notes/cookiecutter.
63+
.PHONY: tmpl-update
64+
tmpl-update:
6765
$(PY) -m cruft update
6866

69-
.PHONY: update-template-done
70-
update-template-done:
67+
.PHONY: tmpl-update-done
68+
tmpl-update-done:
7169
$(GIT) commit -m "chore: Update project template to sphinx-notes/cookiecutter@$(shell jq -r '.commit' .cruft.json | head -c8)"
7270

71+
.PHONY: apply-rej
72+
apply-rej:
73+
@for rej in $$(find . -name '*.rej'); do \
74+
echo "applying $$rej..."; \
75+
wiggle --replace $${rej%.rej} $$rej; \
76+
done
77+
78+
# Detect the minimum Python versions needed to run code.
79+
pyvermin:
80+
vermin --eval-annotations --target=3.12- --versions src/
81+
7382
# Update project version.
7483
.PHONY: bump-version
7584
bump-version:
7685
@echo -n "Please enter the version to bump: "
7786
@read version && $(PY) -m cruft update --variables-to-update "{ \"version\" : \"$$version\" }"
7887

79-
# EXTRA TARGETS START
80-
81-
# EXTRA TARGETS END
88+
################################################################################
89+
# CUSTOM TARGETS
90+
################################################################################

README.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ sphinxnotes-comboroles
88
.. |docs| image:: https://img.shields.io/github/deployments/sphinx-notes/comboroles/github-pages
99
:target: https://sphinx.silverrainz.me/comboroles
1010
:alt: Documentation Status
11-
1211
.. |license| image:: https://img.shields.io/github/license/sphinx-notes/comboroles
1312
:target: https://github.com/sphinx-notes/comboroles/blob/master/LICENSE
1413
:alt: Open Source License
15-
1614
.. |pypi| image:: https://img.shields.io/pypi/v/sphinxnotes-comboroles.svg
1715
:target: https://pypi.python.org/pypi/sphinxnotes-comboroles
1816
:alt: PyPI Package
19-
2017
.. |download| image:: https://img.shields.io/pypi/dm/sphinxnotes-comboroles
2118
:target: https://pypi.python.org/pypi/sphinxnotes-comboroles
2219
:alt: PyPI Package Downloads

docs/conf.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
# list see the documentation:
88
# https://www.sphinx-doc.org/en/master/usage/configuration.html
99

10-
import os
11-
import sys
12-
1310
# -- Project information -----------------------------------------------------
1411

1512
project = 'sphinxnotes-comboroles'
@@ -28,6 +25,7 @@
2825
'sphinx.ext.githubpages',
2926
'sphinx_design',
3027
'sphinx_copybutton',
28+
'sphinx_last_updated_by_git',
3129
]
3230

3331
# Add any paths that contain templates here, relative to this directory.
@@ -95,6 +93,15 @@
9593
'jinja': ('https://jinja.palletsprojects.com/en/latest/', None),
9694
}
9795

96+
extensions.append('sphinx_sitemap')
97+
sitemap_filename = "sitemap.xml"
98+
sitemap_url_scheme = "{link}"
99+
100+
extensions.append('sphinxext.opengraph')
101+
ogp_site_url = html_baseurl
102+
ogp_site_name = project
103+
ogp_image = html_baseurl + '/' + html_logo
104+
98105
extensions.append('sphinxnotes.project')
99106
primary_domain = 'any'
100107

@@ -103,11 +110,17 @@
103110
# If extensions (or modules to document with autodoc) are in another directory,
104111
# add these directories to sys.path here. If the directory is relative to the
105112
# documentation root, use os.path.abspath to make it absolute, like shown here.
113+
import os
114+
import sys
106115
sys.path.insert(0, os.path.abspath('../src/sphinxnotes'))
107116
extensions.append('comboroles')
108117

109118
# DOG FOOD CONFIGURATION START
110119

120+
# DOG FOOD CONFIGURATION END
121+
122+
# CUSTOM CONFIGURATION
123+
111124
comboroles_roles = {
112125
# bulitin.
113126
'strong_literal': ['strong', 'literal'],
@@ -126,10 +139,3 @@
126139
}
127140

128141
extensions.append('sphinxnotes.strike')
129-
130-
extensions.append('sphinx.ext.intersphinx')
131-
132-
# For role strong_pycls.
133-
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
134-
135-
# DOG FOOD CONFIGURATION END

docs/index.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
sphinxnotes-comboroles
66
======================
77

8-
.. |docs| image:: https://img.shields.io/github/deployments/sphinx-notes/comboroles/github-pages
8+
.. |docs| image:: https://img.shields.io/github/deployments/sphinx-notes/comboroles/github-pages?label=docs
99
:target: https://sphinx.silverrainz.me/comboroles
1010
:alt: Documentation Status
11-
1211
.. |license| image:: https://img.shields.io/github/license/sphinx-notes/comboroles
1312
:target: https://github.com/sphinx-notes/comboroles/blob/master/LICENSE
1413
:alt: Open Source License
15-
1614
.. |pypi| image:: https://img.shields.io/pypi/v/sphinxnotes-comboroles.svg
1715
:target: https://pypi.python.org/pypi/sphinxnotes-comboroles
1816
:alt: PyPI Package
19-
2017
.. |download| image:: https://img.shields.io/pypi/dm/sphinxnotes-comboroles
2118
:target: https://pypi.python.org/pypi/sphinxnotes-comboroles
2219
:alt: PyPI Package Downloads
20+
.. |github| image:: https://img.shields.io/badge/GitHub-181717?style=flat&logo=github&logoColor=white/
21+
:target: https://github.com/sphinx-notes/comboroles
22+
:alt: GitHub Repository
2323

24-
|docs| |license| |pypi| |download|
24+
|docs| |license| |pypi| |download| |github|
2525

2626
.. _intro:
2727

@@ -55,12 +55,14 @@ Getting Started
5555
We assume you already have a Sphinx documentation,
5656
if not, see `Getting Started with Sphinx`_.
5757

58+
5859
First, downloading extension from PyPI:
5960

6061
.. code-block:: console
6162
6263
$ pip install sphinxnotes-comboroles
6364
65+
6466
Then, add the extension name to ``extensions`` configuration item in your
6567
:parsed_literal:`conf.py_`:
6668

pyproject.toml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,41 @@
99
name = "sphinxnotes-comboroles"
1010
description = "Sphinx extension for composing multiple roles"
1111
readme = "README.rst"
12-
license = { file = "BSD-3-Clause" }
12+
license = "BSD-3-Clause"
13+
license-files = ["LICENSE"]
1314
authors = [ { name = "Shengyu Zhang" } ]
1415
maintainers = [ { name = "Shengyu Zhang" } ]
15-
keywords = ["sphinx", "extension", "documentation"] # TOOD: additional_keywords
16+
keywords = [
17+
"sphinx",
18+
"extension",
19+
"documentation",
20+
"sphinxnotes",
21+
22+
# CUSTOM KEYWORDS START
23+
# CUSTOM KEYWORDS END
24+
]
1625
classifiers = [
17-
# "Development Status :: 4 - Beta",
26+
"Development Status :: 3 - Alpha",
1827
"Environment :: Plugins",
1928
"Framework :: Sphinx",
2029
"Framework :: Sphinx :: Extension",
21-
"License :: OSI Approved :: BSD License",
2230
"Operating System :: OS Independent",
2331
"Programming Language :: Python",
2432
"Programming Language :: Python :: 3",
2533
"Topic :: Documentation",
2634
"Topic :: Documentation :: Sphinx",
35+
36+
# CUSTOM CLASSIFIERS START
37+
# CUSTOM CLASSIFIERS END
2738
]
2839

29-
requires-python = ">=3.8"
40+
# See ``make pyver`` for more details.
41+
requires-python = ">=3.12"
3042
dependencies = [
31-
"Sphinx >= 4",
43+
"Sphinx >= 7.0",
44+
45+
# CUSTOM DEPENDENCIES START
46+
# CUSTOM DEPENDENCIES END
3247
]
3348

3449
dynamic = ["version"] # required by setuptools_scm, see section [build-system]
@@ -39,18 +54,27 @@ dev = [
3954
"twine",
4055
"cruft",
4156
"ruff",
42-
"pre-commit"
57+
"pre-commit",
58+
"vermin",
4359
]
4460
test = [
4561
"pytest",
4662
]
4763
docs = [
4864
"furo",
49-
"sphinxnotes-project",
5065
"sphinx_design",
5166
"sphinx_copybutton",
5267
"sphinxcontrib-gtagjs",
68+
"sphinx-sitemap",
69+
"sphinxext-opengraph",
70+
"sphinx-last-updated-by-git",
71+
72+
# Dependencies of sphinxnotes projcts.
73+
"sphinxnotes-project",
74+
75+
# CUSTOM DOCS DEPENDENCIES START
5376
"sphinxnotes-strike",
77+
# CUSTOM DOCS DEPENDENCIES END
5478
]
5579

5680
[project.urls]
@@ -73,3 +97,5 @@ version_scheme = "no-guess-dev"
7397
# Find namespace package,
7498
# check out https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#finding-namespace-packages
7599
where = ["src"]
100+
101+
# CUSTOM CONFIGURATION

ruff.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ exclude = [
77

88
[format]
99
quote-style = "single"
10+
11+
[lint]
12+
ignore = [
13+
"E741", # Checks for the use of the characters 'l', 'O', or 'I' as variable names
14+
]

src/sphinxnotes/comboroles/meta.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This file is generated from sphinx-notes/cookiecutter.
2+
# DO NOT EDIT!!!
3+
4+
################################################################################
5+
# Project meta infos.
6+
################################################################################
7+
8+
from __future__ import annotations
9+
from importlib import metadata
10+
11+
__project__ = 'sphinxnotes-comboroles'
12+
__author__ = 'Shengyu Zhang'
13+
__desc__ = 'Sphinx extension for composing multiple roles'
14+
15+
try:
16+
__version__ = metadata.version('sphinxnotes-comboroles')
17+
except metadata.PackageNotFoundError:
18+
__version__ = 'unknown'
19+
20+
21+
################################################################################
22+
# Sphinx extension utils.
23+
################################################################################
24+
25+
26+
def pre_setup(app):
27+
app.require_sphinx('7.0')
28+
29+
30+
def post_setup(app):
31+
return {
32+
'version': __version__,
33+
'parallel_read_safe': True,
34+
'parallel_write_safe': True,
35+
}

0 commit comments

Comments
 (0)