Skip to content

Commit 6afcc0c

Browse files
committed
chore: Update project template to sphinx-notes/cookiecutter@800a79a0
1 parent fe70d41 commit 6afcc0c

File tree

9 files changed

+126
-44
lines changed

9 files changed

+126
-44
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/template",
3-
"commit": "0b096cd7ecff1b28ee8c2887ba3321418be34b9a",
3+
"commit": "800a79a06f9a67494516bc14bcda85b3472dcac9",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -14,8 +14,13 @@
1414
"github_repo": "snippet",
1515
"pypi_name": "sphinxnotes-snippet",
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/template",
18-
"_commit": "0b096cd7ecff1b28ee8c2887ba3321418be34b9a"
23+
"_commit": "800a79a06f9a67494516bc14bcda85b3472dcac9"
1924
}
2025
},
2126
"directory": null

Makefile

Lines changed: 31 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.
1816
.PHONY: view
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,33 +54,43 @@ 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 tmpl-update-done tmpl-apply-rej
64+
65+
tmpl-update:
6766
$(PY) -m cruft update
6867

69-
.PHONY: update-template-done
70-
update-template-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+
tmpl-apply-rej:
72+
@for rej in $$(find . -name '*.rej'); do \
73+
echo "applying $$rej..."; \
74+
wiggle --replace $${rej%.rej} $$rej; \
75+
done
76+
7377
# Update project version.
74-
.PHONY: bump-version
78+
.PHONY: bump-version bump-version-done
79+
7580
bump-version:
7681
@echo -n "Please enter the version to bump: "
7782
@read version && $(PY) -m cruft update --variables-to-update "{ \"version\" : \"$$version\" }"
7883

79-
# EXTRA TARGETS START
84+
bump-version-done:
85+
VERSION=$(shell jq -r '.context.cookiecutter.version' .cruft.json); \
86+
$(GIT) commit -m "chore: Bump version to $$VERSION"; \
87+
$(GIT) tag $$VERSION
88+
89+
################################################################################
90+
# CUSTOM TARGETS
91+
################################################################################
8092

8193
# Usage: make cli args=--help
8294
.PHONY: cli
8395
cli:
8496
$(PY) ./utils/cli.py --config ./utils/conf.py $(args)
85-
86-
# EXTRA TARGETS END

README.rst

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

docs/conf.py

Lines changed: 13 additions & 6 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-snippet'
@@ -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.comboroles')
99106
comboroles_roles = {
100107
'parsed_literal': (['literal'], True),
@@ -108,15 +115,15 @@
108115
# If extensions (or modules to document with autodoc) are in another directory,
109116
# add these directories to sys.path here. If the directory is relative to the
110117
# documentation root, use os.path.abspath to make it absolute, like shown here.
118+
import os
119+
import sys
111120
sys.path.insert(0, os.path.abspath('../src/sphinxnotes'))
112121
extensions.append('snippet')
113122

114-
# DOG FOOD CONFIGURATION START
123+
# CUSTOM CONFIGURATION
115124

116125
snippet_config = {
117126
'cache_dir': '/tmp/' + 'sphinxnotes-snippet'
118127
}
119128

120129
extensions.append('sphinxcontrib.asciinema')
121-
122-
# DOG FOOD CONFIGURATION END

docs/index.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ sphinxnotes-snippet
88
.. |docs| image:: https://img.shields.io/github/deployments/sphinx-notes/snippet/github-pages?label=docs
99
:target: https://sphinx.silverrainz.me/snippet
1010
:alt: Documentation Status
11-
1211
.. |license| image:: https://img.shields.io/github/license/sphinx-notes/snippet
1312
:target: https://github.com/sphinx-notes/snippet/blob/master/LICENSE
1413
:alt: Open Source License
15-
1614
.. |pypi| image:: https://img.shields.io/pypi/v/sphinxnotes-snippet.svg
1715
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
1816
:alt: PyPI Package
19-
2017
.. |download| image:: https://img.shields.io/pypi/dm/sphinxnotes-snippet
2118
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
2219
:alt: PyPI Package Downloads
23-
2420
.. |github| image:: https://img.shields.io/badge/GitHub-181717?style=flat&logo=github&logoColor=white/
2521
:target: https://github.com/sphinx-notes/snippet
2622
:alt: GitHub Repository
@@ -48,12 +44,14 @@ Getting Started
4844
We assume you already have a Sphinx documentation,
4945
if not, see `Getting Started with Sphinx`_.
5046

47+
5148
First, downloading extension from PyPI:
5249

5350
.. code-block:: console
5451
5552
$ pip install sphinxnotes-snippet
5653
54+
5755
Then, add the extension name to ``extensions`` configuration item in your
5856
:parsed_literal:`conf.py_`:
5957

pyproject.toml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,41 @@
99
name = "sphinxnotes-snippet"
1010
description = "Sphinx documentation snippets manager"
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
2737
"Topic :: Utilities",
38+
# CUSTOM CLASSIFIERS END
2839
]
2940

41+
# See ``make pyver`` for more details.
3042
requires-python = ">=3.12"
3143
dependencies = [
32-
"Sphinx >= 4",
44+
"Sphinx >= 7.0",
45+
46+
# CUSTOM DEPENDENCIES START
3347
"langid",
3448
"jieba",
3549
"python-pinyin",
@@ -38,6 +52,7 @@ dependencies = [
3852
"setuptools", # req by stopwordsiso, https://stackoverflow.com/a/39930983/4799273
3953
"wcwidth",
4054
"wordsegment",
55+
# CUSTOM DEPENDENCIES END
4156
]
4257

4358
dynamic = ["version"] # required by setuptools_scm, see section [build-system]
@@ -47,20 +62,28 @@ dev = [
4762
"build",
4863
"twine",
4964
"cruft",
50-
"ruff",
51-
"pre-commit"
65+
"ruff>=0.11.10", # pwndbg#2716
66+
"pre-commit",
5267
]
5368
test = [
5469
"pytest",
5570
]
5671
docs = [
5772
"furo",
58-
"sphinxnotes-project",
5973
"sphinx_design",
6074
"sphinx_copybutton",
6175
"sphinxcontrib-gtagjs",
76+
"sphinx-sitemap",
77+
"sphinxext-opengraph",
78+
"sphinx-last-updated-by-git",
79+
80+
# Dependencies of sphinxnotes projcts.
81+
"sphinxnotes-project",
6282
"sphinxnotes-comboroles",
83+
84+
# CUSTOM DOCS DEPENDENCIES START
6385
"sphinxcontrib.asciinema",
86+
# CUSTOM DOCS DEPENDENCIES END
6487
]
6588

6689
[project.urls]
@@ -87,6 +110,8 @@ version_scheme = "no-guess-dev"
87110
# check out https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#finding-namespace-packages
88111
where = ["src"]
89112

113+
# CUSTOM CONFIGURATION
114+
90115
[tool.setuptools.package-data]
91116
# A maps from PACKAGE NAMES to lists of glob patterns,
92117
# see also https://setuptools.pypa.io/en/latest/userguide/datafiles.html

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/snippet/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-snippet'
12+
__author__ = 'Shengyu Zhang'
13+
__desc__ = 'Sphinx documentation snippets manager'
14+
15+
try:
16+
__version__ = metadata.version('sphinxnotes-snippet')
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+
}

src/sphinxnotes/snippet/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)