From de3c580293931c1612a5c985760fbcf8b4fe148f Mon Sep 17 00:00:00 2001 From: Shengyu Zhang Date: Sun, 24 Dec 2023 01:27:49 +0800 Subject: [PATCH] chore: Update cookiecutter template --- .cruft.json | 12 ++-- MANIFEST.in | 2 +- Makefile | 33 +++++++++-- README.rst | 4 +- docs/Makefile | 2 +- docs/_images/.gitkeep | 0 docs/{_images => _static}/sphinx-notes.png | Bin docs/_templates/confval.rst | 11 ++++ docs/_templates/example.rst | 25 +++++++- docs/_templates/version.rst | 7 +-- docs/changelog.rst | 2 +- docs/conf.py | 66 ++++++++++++++------- docs/index.rst | 4 +- docs/make.bat | 2 +- pyproject.toml | 2 +- 15 files changed, 118 insertions(+), 54 deletions(-) create mode 100644 docs/_images/.gitkeep rename docs/{_images => _static}/sphinx-notes.png (100%) create mode 100644 docs/_templates/confval.rst diff --git a/.cruft.json b/.cruft.json index 0129517..94a5128 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,7 +1,7 @@ { - "template": "https://github.com/sphinx-notes/template", - "commit": "c781308dbd84e739727ce09aaf798444ced1e7e4", - "checkout": null, + "template": "https://github.com/sphinx-notes/cookiecutter", + "commit": "b0f937e5596c086960ee27cfe0b069947de8a43f", + "checkout": "2023-12-updates", "context": { "cookiecutter": { "namespace": "sphinxnotes", @@ -14,11 +14,7 @@ "github_repo": "lilypond", "pypi_name": "sphinxnotes-lilypond", "pypi_owner": "SilverRainZ", - "dependencies": [ - "Sphinx >= 4" - ], - "additional_docs": [], - "_template": "https://github.com/sphinx-notes/template" + "_template": "https://github.com/sphinx-notes/cookiecutter" } }, "directory": null diff --git a/MANIFEST.in b/MANIFEST.in index 6b5bf17..4c868dc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -# This file is generated from sphinx-notes/template. +# This file is generated from sphinx-notes/cookiecutter. # You need to consider modifying the TEMPLATE or modifying THIS FILE. include LICENSE diff --git a/Makefile b/Makefile index 59bad58..5b37c2f 100644 --- a/Makefile +++ b/Makefile @@ -1,37 +1,58 @@ -# This file is generated from sphinx-notes/template. +# This file is generated from sphinx-notes/cookiecutter. # You need to consider modifying the TEMPLATE or modifying THIS FILE. LANG = en_US.UTF-8 -MAKE = make -PY = python3 -RM = rm -rf +MAKE = make +PY = python3 +RM = rm -rf +# Build sphinx documentation. .PHONY: docs docs: $(MAKE) -C docs/ +# Run unittest. .PHONY: test test: $(PY) -m unittest discover -s tests -v +# Build distribution package, for "install" or "upload". .PHONY: dist dist: pyproject.toml $(RM) dist/ # clean up old dist $(PY) -m build +# Install distribution package to user directory. +# +# NOTE: It may breaks your system-level packages, use at your own risk. .PHONY: install install: dist + export PIP_BREAK_SYSTEM_PACKAGES=1 # required by Python 3.11+, see PEP-668 $(PY) -m pip install --user --no-deps --force-reinstall dist/*.whl +# Publish wheel to PyPI offical server when you want to +# You should have a PyPI account and have PyPI token configured. +# +# See also https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives .PHONY: upload upload: dist $(PY) -m twine upload --repository pypi $. +.PHONY: upload-test +upload-test: dist $(PY) -m twine upload --repository testpypi $` - - :tag:`{{ title }}` +:Date: :ref:`📅{{ date }} ` +:Download: :tag:`{{ title }}` {% for line in content %} {{ line }} diff --git a/docs/changelog.rst b/docs/changelog.rst index db72915..5f08312 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,4 +1,4 @@ -.. This file is generated from sphinx-notes/template. +.. This file is generated from sphinx-notes/cookiecutter. You need to consider modifying the TEMPLATE or modifying THIS FILE. ========== diff --git a/docs/conf.py b/docs/conf.py index 9fd7da6..2f0808c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,4 @@ -# This file is generated from sphinx-notes/template. +# This file is generated from sphinx-notes/cookiecutter. # You need to consider modifying the TEMPLATE or modifying THIS FILE. # Configuration file for the Sphinx documentation builder. @@ -70,36 +70,64 @@ # It is used to indicate the location of document like canonical_url html_baseurl = 'https://sphinx.silverrainz.me/lilypond' -html_logo = html_favicon = '_images/sphinx-notes.png' +html_logo = html_favicon = '_static/sphinx-notes.png' # -- Extensions ------------------------------------------------------------- +# extensions.append('sphinxnotes.any') from sphinxnotes.any import Schema, Field as F +# +version_schema = Schema('version', + name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES), + attrs={'date': F(referenceable=True)}, + content=F(form=F.Form.LINES), + description_template=open('_templates/version.rst', 'r').read(), + reference_template='🏷️{{ title }}', + missing_reference_template='🏷️{{ title }}', + ambiguous_reference_template='🏷️{{ title }}') +confval_schema = Schema('confval', + name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES), + attrs={ + 'type': F(), + 'default': F(), + 'choice': F(form=F.Form.WORDS), + 'versionadded': F(), + 'versionchanged': F(form=F.Form.LINES), + }, + content=F(), + description_template=open('_templates/confval.rst', 'r').read(), + reference_template='⚙️{{ title }}', + missing_reference_template='⚙️{{ title }}', + ambiguous_reference_template='⚙️{{ title }}') +example_schema = Schema('example', + name=F(referenceable=True), + attrs={'style': F()}, + content=F(form=F.Form.LINES), + description_template=open('_templates/example.rst', 'r').read(), + reference_template='📝{{ title }}', + missing_reference_template='📝{{ title }}', + ambiguous_reference_template='📝{{ title }}') +# any_schemas = [ - # - Schema('version', - name=F(unique=True, referenceable=True, required=True), - attrs={ 'date': F(referenceable=True) }, - content=F(form=F.Form.LINES), - description_template=open('_templates/version.rst', 'r').read(), - reference_template='💽 {{ title }}', - missing_reference_template='💽 {{ title }}', - ambiguous_reference_template='💽 {{ title }}'), - # + version_schema, + confval_schema, + example_schema, ] primary_domain = 'any' +# extensions.append('sphinx.ext.extlinks') extlinks = { - 'issue': ('https://github.com/sphinx-notes/lilypond/issues/%s', '💬 %s'), - 'pull': ('https://github.com/sphinx-notes/lilypond/pull/%s', '🚀 %s'), - 'tag': ('https://github.com/sphinx-notes/lilypond/releases/tag/%s', '🏷️ %s'), + 'issue': ('https://github.com/sphinx-notes/lilypond/issues/%s', '💬%s'), + 'pull': ('https://github.com/sphinx-notes/lilypond/pull/%s', '🚀%s'), + 'tag': ('https://github.com/sphinx-notes/lilypond/releases/tag/%s', '🏷️%s'), } extensions.append('sphinxcontrib.gtagjs') gtagjs_ids = ['G-E4SNX0WZYV'] +# # -- Eat your own dog food -------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, @@ -111,11 +139,3 @@ # DOG FOOD CONFIGURATION START # DOG FOOD CONFIGURATION END - -any_schemas.append(Schema('example', - name=F(referenceable=True), - content=F(form=F.Form.LINES), - description_template=open('_templates/example.rst', 'r').read(), - reference_template='🎵 {{ title }}', - missing_reference_template='🎵 {{ title }}', - ambiguous_reference_template='🎵 {{ title }}')) diff --git a/docs/index.rst b/docs/index.rst index b3745f8..2babe69 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -.. This file is generated from sphinx-notes/template. +.. This file is generated from sphinx-notes/cookiecutter. You need to consider modifying the TEMPLATE or modifying THIS FILE. .. include:: ../README.rst @@ -114,7 +114,7 @@ Contents The Sphinx Notes Project ======================== -This project is a developed by `Shengyu Zhang`__, ++The project is developed by `Shengyu Zhang`__, as part of **The Sphinx Notes Project**. .. toctree:: diff --git a/docs/make.bat b/docs/make.bat index b3cafbd..b158787 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,4 +1,4 @@ -REM This file is generated from sphinx-notes/template. DO NOT EDIT. +REM This file is generated from sphinx-notes/cookiecutter. DO NOT EDIT. @ECHO OFF diff --git a/pyproject.toml b/pyproject.toml index 34e1fd2..0b544b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,4 @@ -# This file is generated from sphinx-notes/template. +# This file is generated from sphinx-notes/cookiecutter. # You need to consider modifying the TEMPLATE or modifying THIS FILE. # This file is used to configure your project.