Skip to content

Commit 8ede5b9

Browse files
authored
refactor: Sync with template and use cruft (#4)
1 parent bc7791b commit 8ede5b9

23 files changed

Lines changed: 346 additions & 160 deletions

.cruft.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"template": "https://github.com/sphinx-notes/cookiecutter",
3+
"commit": "1701bf78ca498d756ce4502aa1712cfe23ed35af",
4+
"checkout": null,
5+
"context": {
6+
"cookiecutter": {
7+
"namespace": "sphinxnotes",
8+
"name": "isso",
9+
"full_name": "sphinxnotes-isso",
10+
"author": "Shengyu Zhang",
11+
"description": "Sphinx extension for embeding Isso comments in documents",
12+
"version": "1.0",
13+
"github_owner": "sphinx-notes",
14+
"github_repo": "isso",
15+
"pypi_name": "sphinxnotes-isso",
16+
"pypi_owner": "SilverRainZ",
17+
"_template": "https://github.com/sphinx-notes/cookiecutter"
18+
}
19+
},
20+
"directory": null
21+
}

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish New Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
pypi:
10+
name: Publish package distributions to PyPI
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/sphinxnotes-isso
15+
permissions:
16+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
- run: pip install build twine && make dist
21+
- uses: pypa/gh-action-pypi-publish@release/v1
22+
with:
23+
password: ${{ secrets.PYPI_API_TOKEN }}
24+
25+
release:
26+
name: Publish Github Release
27+
needs: [pypi]
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: ncipollo/release-action@v1
34+
with:
35+
body: |
36+
Changelog: https://sphinx.silverrainz.me/isso/changelog.html#version-${{ github.ref_name }}

LICENSE

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

3-
Copyright (c) 2023, Shengyu Zhang
3+
Copyright (c) 2024, Shengyu Zhang
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# This file is generated from sphinx-notes/template. DO NOT EDIT.
1+
# This file is generated from sphinx-notes/cookiecutter.
2+
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
23

34
include LICENSE
45
include README.rst

Makefile

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
1-
# This file is generated from sphinx-notes/template. DO NOT EDIT.
1+
# This file is generated from sphinx-notes/cookiecutter.
2+
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
23

34
LANG = en_US.UTF-8
45

5-
MAKE = make
6-
PY = python3
7-
RM = rm -rf
8-
9-
.PHONY: docs test dist install upload test-upload sync-template
6+
MAKE = make
7+
PY = python3
8+
RM = rm -rf
109

10+
# Build sphinx documentation.
11+
.PHONY: docs
1112
docs:
1213
$(MAKE) -C docs/
1314

15+
# Run unittest.
16+
.PHONY: test
1417
test:
1518
$(PY) -m unittest discover -s tests -v
1619

20+
# Build distribution package, for "install" or "upload".
21+
.PHONY: dist
1722
dist: pyproject.toml
1823
$(RM) dist/ # clean up old dist
1924
$(PY) -m build
2025

26+
# Install distribution package to user directory.
27+
#
28+
# NOTE: It may breaks your system-level packages, use at your own risk.
29+
.PHONY: install
2130
install: dist
31+
export PIP_BREAK_SYSTEM_PACKAGES=1 # required by Python 3.11+, see PEP-668
2232
$(PY) -m pip install --user --no-deps --force-reinstall dist/*.whl
2333

34+
# Publish wheel to PyPI offical server <https://pypi.org/> when you want to
35+
# You should have a PyPI account and have PyPI token configured.
36+
#
37+
# See also https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives
38+
.PHONY: upload
2439
upload: dist
2540
$(PY) -m twine upload --repository pypi $</*
2641

27-
test-upload: dist
42+
# Same to the aboved "upload" target, but this publishs to PyPI test server
43+
# <https://test.pypi.org/>.
44+
.PHONY: upload-test
45+
upload-test: dist
2846
$(PY) -m twine upload --repository testpypi $</*
2947

30-
sync-template:
31-
./.sphinxnotes/template/update.py
48+
# Keep up to date with the latest template.
49+
# See also https://github.com/sphinx-notes/cookiecutter.
50+
.PHONY: update-template
51+
update-template:
52+
$(PY) -m cruft update
53+
54+
# Update project version.
55+
.PHONY: bump-version
56+
bump-version:
57+
@echo -n "Please enter the version to bump: "
58+
@read version && $(PY) -m cruft update --variables-to-update "{ \"version\" : \"$$version\" }"

README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.. This file is generated from sphinx-notes/template. DO NOT EDIT.
1+
.. This file is generated from sphinx-notes/cookiecutter.
2+
You need to consider modifying the TEMPLATE or modifying THIS FILE.
23
34
================
45
sphinxnotes-isso
@@ -16,7 +17,7 @@ sphinxnotes-isso
1617
:target: https://pypi.python.org/pypi/sphinxnotes-isso
1718
:alt: PyPI Package
1819

19-
.. image:: https://img.shields.io/pypi/dw/sphinxnotes-isso
20+
.. image:: https://img.shields.io/pypi/dm/sphinxnotes-isso
2021
:target: https://pypi.python.org/pypi/sphinxnotes-isso
2122
:alt: PyPI Package Downloads
2223

docs/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# This file is generated from sphinx-notes/template. DO NOT EDIT.
2-
#
1+
# This file is generated from sphinx-notes/cookiecutter.
2+
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
3+
34
# Minimal makefile for Sphinx documentation
45

56
# You can set these variables from the command line.

docs/_images/.gitkeep

Whitespace-only changes.

docs/_templates/confval.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
:Type: :py:class:`{{ type }}`
3+
:Default: ``{{ default }}``
4+
{% if choice %}:Choices: {% for c in choice %}``{{ c }}`` {% endfor %}{% endif %}
5+
{% if versionadded %}:Version added: :version:`{{ versionadded }}`{% endif %}
6+
{% if versionchanged %}:Version changed:{% for i in range(0, versionchanged|count -1, 2) %}
7+
:version:`{{ versionchanged[i] }}`
8+
{{ versionchanged[i+1] }}{% endfor %}{% endif %}
9+
10+
{{ content }}
11+

0 commit comments

Comments
 (0)