Skip to content

Commit 94c8a95

Browse files
authored
Merge pull request #3 from sphinx-notes/template
chore: Update project template to sphinx-notes/cookiecutter@800a79a0
2 parents 1c98a40 + 3a10dec commit 94c8a95

33 files changed

+812
-446
lines changed

.cruft.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"template": "https://github.com/sphinx-notes/cookiecutter",
3+
"commit": "800a79a06f9a67494516bc14bcda85b3472dcac9",
4+
"checkout": null,
5+
"context": {
6+
"cookiecutter": {
7+
"namespace": "sphinxnotes",
8+
"name": "recentupdate",
9+
"full_name": "sphinxnotes-recentupdate",
10+
"author": "Shengyu Zhang",
11+
"description": "Get the document update information from git and display it in Sphinx documentation",
12+
"version": "1.0a2",
13+
"github_owner": "sphinx-notes",
14+
"github_repo": "recentupdate",
15+
"pypi_name": "sphinxnotes-recentupdate",
16+
"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",
22+
"_template": "https://github.com/sphinx-notes/cookiecutter",
23+
"_commit": "800a79a06f9a67494516bc14bcda85b3472dcac9"
24+
}
25+
},
26+
"directory": null
27+
}

.github/workflows/lint.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Ruff
2+
on: [ push, pull_request ]
3+
4+
jobs:
5+
ruff:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: chartboost/ruff-action@v1

.github/workflows/pages.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
name: Pages
1+
name: Deploy Sphinx documentation to Pages
2+
3+
# Runs on pushes targeting the default branch
24
on:
35
push:
4-
branches:
5-
- master
6+
branches: [master]
7+
8+
# Cancel any in-progress job or run
9+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
10+
concurrency:
11+
group: ${{ github.ref }}
12+
cancel-in-progress: true
13+
614
jobs:
7-
build:
8-
runs-on: ubuntu-20.04
15+
pages:
16+
runs-on: ubuntu-latest
17+
environment:
18+
name: github-pages
19+
url: ${{ steps.deployment.outputs.page_url }}
20+
permissions:
21+
pages: write
22+
id-token: write
923
steps:
10-
- name: Checkout
11-
uses: actions/checkout@master
12-
with:
13-
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
14-
- name: Build and Commit
15-
uses: sphinx-notes/pages@master
16-
with:
17-
documentation_path: doc
18-
- name: Push changes
19-
uses: ad-m/github-push-action@master
20-
with:
21-
github_token: ${{ secrets.GITHUB_TOKEN }}
22-
branch: gh-pages
24+
- id: deployment
25+
uses: sphinx-notes/pages@v3

.github/workflows/pypi.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish package distributions to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
pypi:
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/sphinxnotes-recentupdate
14+
permissions:
15+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
- run: pip install build twine && make dist
20+
- uses: pypa/gh-action-pypi-publish@release/v1
21+
with:
22+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish Github Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+" # MAJOR.MINOR (1.0: y, 1.0a0: n, 1.0.1: n)
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: ncipollo/release-action@v1
16+
with:
17+
body: |
18+
Changelog: https://sphinx.silverrainz.me/recentupdate/changelog.html

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,10 @@ dmypy.json
128128
# Pyre type checker
129129
.pyre/
130130

131+
# Poetry
132+
poetry.lock
133+
131134
# Sphinx
132-
doc/_build/
135+
docs/_build/
136+
# sphinxnotes-any >= 2.5
137+
docs/.any*

.pre-commit-config.yaml

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

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2021, Sphinx Notes
3+
Copyright (c) 2025, Shengyu Zhang
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without
@@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2626
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2727
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2828
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MANIFEST.in

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
include README.rst
1+
# This file is generated from sphinx-notes/cookiecutter.
2+
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
3+
24
include LICENSE
3-
recursive-include doc *
4-
prune doc/_build
5+
include README.rst
6+
7+
recursive-include tests *
8+
recursive-exclude * __pycache__
9+
recursive-exclude * *.py[co]
10+
11+
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif

Makefile

Lines changed: 83 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,92 @@
1-
LANG=en_US.UTF-8
1+
# This file is generated from sphinx-notes/cookiecutter.
2+
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
23

3-
MAKE = make
4-
PY = python3
5-
RM = rm -rf
4+
LANG = en_US.UTF-8
65

7-
.PHONY: doc
8-
doc:
9-
$(RM) doc/_build
10-
$(MAKE) -C doc/
6+
MAKE = make
7+
PY = python3
8+
RM = rm -rf
9+
GIT = git
10+
OPEN = xdg-open
1111

12-
.PHONY: dist
13-
dist: setup.py
14-
$(RM) dist/ build/ *.egg-info/
15-
$(PY) setup.py sdist bdist_wheel
16-
$(PY) -m twine check dist/*
12+
.PHONY: docs
13+
docs:
14+
$(MAKE) -C docs/
1715

18-
.PHONY: upload
19-
upload: dist/
20-
$(PY) -m twine upload --repository pypi $<*
16+
.PHONY: view
17+
view:
18+
$(OPEN) docs/_build/html/index.html
19+
20+
.PHONY: clean
21+
clean:
22+
$(MAKE) -C docs/ clean; $(RM) dist/
23+
24+
.PHONY: fmt
25+
fmt:
26+
ruff format src/ && ruff check --fix src/
27+
28+
.PHONY: test
29+
test:
30+
$(PY) -m unittest discover -s tests -v
31+
32+
################################################################################
33+
# Distribution Package
34+
################################################################################
35+
36+
# Build distribution package, for "install" or "upload".
37+
.PHONY: dist
38+
dist: pyproject.toml clean
39+
$(PY) -m build
2140

41+
# Install distribution package to user directory.
42+
#
43+
# NOTE: It may breaks your system-level packages, use at your own risk.
2244
.PHONY: install
2345
install: dist
46+
export PIP_BREAK_SYSTEM_PACKAGES=1 # required by Python 3.11+, see PEP-668
2447
$(PY) -m pip install --user --no-deps --force-reinstall dist/*.whl
2548

26-
.PHONY: test
27-
test: tests
28-
$(PY) -m unittest discover -s tests -v
49+
# Publish wheel to PyPI offical server <https://pypi.org/> when you want to
50+
# You should have a PyPI account and have PyPI token configured.
51+
#
52+
# See also https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives
53+
.PHONY: upload
54+
upload: dist
55+
$(PY) -m twine upload --repository pypi $</*
56+
57+
################################################################################
58+
# Cookiecutter Incremental Updates
59+
################################################################################
60+
61+
# Keep up to date with the latest template.
62+
# See https://github.com/sphinx-notes/cookiecutter.
63+
.PHONY: tmpl-update tmpl-update-done tmpl-apply-rej
64+
65+
tmpl-update:
66+
$(PY) -m cruft update
67+
68+
tmpl-update-done:
69+
$(GIT) commit -m "chore: Update project template to sphinx-notes/cookiecutter@$(shell jq -r '.commit' .cruft.json | head -c8)"
70+
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+
77+
# Update project version.
78+
.PHONY: bump-version bump-version-done
79+
80+
bump-version:
81+
@echo -n "Please enter the version to bump: "
82+
@read version && $(PY) -m cruft update --variables-to-update "{ \"version\" : \"$$version\" }"
83+
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+
################################################################################
91+
# CUSTOM TARGETS
92+
################################################################################

0 commit comments

Comments
 (0)