Skip to content

Commit 268dd02

Browse files
committed
chore: Update cookiecutter tempalte
1 parent 09c6f5c commit 268dd02

File tree

15 files changed

+129
-40
lines changed

15 files changed

+129
-40
lines changed

.cruft.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/sphinx-notes/template",
3-
"commit": "c781308dbd84e739727ce09aaf798444ced1e7e4",
3+
"commit": "0b7d8aa478b37114cef369a217bd1d463e369d37",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -14,10 +14,6 @@
1414
"github_repo": "snippet",
1515
"pypi_name": "sphinxnotes-snippet",
1616
"pypi_owner": "SilverRainZ",
17-
"dependencies": [
18-
"Sphinx >= 4"
19-
],
20-
"additional_docs": [],
2117
"_template": "https://github.com/sphinx-notes/template"
2218
}
2319
},

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is generated from sphinx-notes/template.
1+
# This file is generated from sphinx-notes/cookiecutter.
22
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
33

44
include LICENSE

Makefile

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,62 @@
1-
# This file is generated from sphinx-notes/template.
1+
# This file is generated from sphinx-notes/cookiecutter.
22
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
33

44
LANG = en_US.UTF-8
55

6-
MAKE = make
7-
PY = python3
8-
RM = rm -rf
6+
MAKE = make
7+
PY = python3
8+
RM = rm -rf
99

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

15+
# Run unittest.
1416
.PHONY: test
1517
test:
1618
$(PY) -m unittest discover -s tests -v
1719

20+
# Build distribution package, for "install" or "upload".
1821
.PHONY: dist
1922
dist: pyproject.toml
2023
$(RM) dist/ # clean up old dist
2124
$(PY) -m build
2225

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

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
2738
.PHONY: upload
2839
upload: dist
2940
$(PY) -m twine upload --repository pypi $</*
3041

31-
.PHONY: test-upload
32-
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
3346
$(PY) -m twine upload --repository testpypi $</*
3447

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\" }"
59+
3560
# Usage: make cli args=--help
3661
.PHONY: cli
3762
cli:

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. This file is generated from sphinx-notes/template.
1+
.. This file is generated from sphinx-notes/cookiecutter.
22
You need to consider modifying the TEMPLATE or modifying THIS FILE.
33
44
===================
@@ -17,7 +17,7 @@ sphinxnotes-snippet
1717
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
1818
:alt: PyPI Package
1919

20-
.. image:: https://img.shields.io/pypi/dw/sphinxnotes-snippet
20+
.. image:: https://img.shields.io/pypi/dm/sphinxnotes-snippet
2121
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
2222
:alt: PyPI Package Downloads
2323

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is generated from sphinx-notes/template.
1+
# This file is generated from sphinx-notes/cookiecutter.
22
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
33

44
# Minimal makefile for Sphinx documentation

docs/_images/.gitkeep

Whitespace-only changes.
File renamed without 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+

docs/_templates/example.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
{% if style is not defined or style == 'tab' %}
3+
.. tab-set::
4+
5+
.. tab-item:: Result
6+
7+
{% for line in content %}{{ line }}
8+
{% endfor %}
9+
10+
.. tab-item:: reStructuredText
11+
12+
.. code:: rst
13+
14+
{% for line in content %}{{ line }}
15+
{% endfor %}
16+
{% elif style == 'grid' %}
17+
.. grid:: 2
18+
19+
.. grid-item-card:: reStructuredText
20+
21+
.. code:: rst
22+
23+
{% for line in content %}{{ line }}
24+
{% endfor %}
25+
26+
.. grid-item-card:: Result
27+
28+
{% for line in content %}{{ line }}
29+
{% endfor %}
30+
{% endif %}
31+

docs/_templates/version.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
.. list-table::
2-
:align: left
3-
4-
* - :ref:`📅 {{ date }} <any-version.date>`
5-
- :tag:`{{ title }}`
61

2+
:Date: :ref:`📅{{ date }} <any-version.date>`
3+
:Download: :tag:`{{ title }}`
74

85
{% for line in content %}
96
{{ line }}

docs/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. This file is generated from sphinx-notes/template.
1+
.. This file is generated from sphinx-notes/cookiecutter.
22
You need to consider modifying the TEMPLATE or modifying THIS FILE.
33
44
==========

docs/conf.py

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is generated from sphinx-notes/template.
1+
# This file is generated from sphinx-notes/cookiecutter.
22
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
33

44
# Configuration file for the Sphinx documentation builder.
@@ -70,38 +70,66 @@
7070
# It is used to indicate the location of document like canonical_url
7171
html_baseurl = 'https://sphinx.silverrainz.me/snippet'
7272

73-
html_logo = html_favicon = '_images/sphinx-notes.png'
73+
html_logo = html_favicon = '_static/sphinx-notes.png'
7474

7575
# -- Extensions -------------------------------------------------------------
7676

77+
#
7778
extensions.append('sphinxnotes.any')
7879
from sphinxnotes.any import Schema, Field as F
80+
#
81+
version_schema = Schema('version',
82+
name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES),
83+
attrs={'date': F(referenceable=True)},
84+
content=F(form=F.Form.LINES),
85+
description_template=open('_templates/version.rst', 'r').read(),
86+
reference_template='🏷️{{ title }}',
87+
missing_reference_template='🏷️{{ title }}',
88+
ambiguous_reference_template='🏷️{{ title }}')
89+
confval_schema = Schema('confval',
90+
name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES),
91+
attrs={
92+
'type': F(),
93+
'default': F(),
94+
'choice': F(form=F.Form.WORDS),
95+
'versionadded': F(),
96+
'versionchanged': F(form=F.Form.LINES),
97+
},
98+
content=F(),
99+
description_template=open('_templates/confval.rst', 'r').read(),
100+
reference_template='⚙️{{ title }}',
101+
missing_reference_template='⚙️{{ title }}',
102+
ambiguous_reference_template='⚙️{{ title }}')
103+
example_schema = Schema('example',
104+
name=F(referenceable=True),
105+
attrs={'style': F()},
106+
content=F(form=F.Form.LINES),
107+
description_template=open('_templates/example.rst', 'r').read(),
108+
reference_template='📝{{ title }}',
109+
missing_reference_template='📝{{ title }}',
110+
ambiguous_reference_template='📝{{ title }}')
111+
#
79112
any_schemas = [
80-
#
81-
Schema('version',
82-
name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES),
83-
attrs={'date': F(referenceable=True)},
84-
content=F(form=F.Form.LINES),
85-
description_template=open('_templates/version.rst', 'r').read(),
86-
reference_template='💽 {{ title }}',
87-
missing_reference_template='💽 {{ title }}',
88-
ambiguous_reference_template='💽 {{ title }}'),
89-
#
113+
version_schema,
114+
confval_schema,
115+
example_schema,
90116
]
91117
primary_domain = 'any'
118+
#
92119

93120
extensions.append('sphinx.ext.extlinks')
94121
extlinks = {
95-
'issue': ('https://github.com/sphinx-notes/snippet/issues/%s', '💬 %s'),
96-
'pull': ('https://github.com/sphinx-notes/snippet/pull/%s', '🚀 %s'),
97-
'tag': ('https://github.com/sphinx-notes/snippet/releases/tag/%s', '🏷️ %s'),
122+
'issue': ('https://github.com/sphinx-notes/snippet/issues/%s', '💬%s'),
123+
'pull': ('https://github.com/sphinx-notes/snippet/pull/%s', '🚀%s'),
124+
'tag': ('https://github.com/sphinx-notes/snippet/releases/tag/%s', '🏷️%s'),
98125
}
99126

100127
extensions.append('sphinxcontrib.gtagjs')
101128
gtagjs_ids = ['G-E4SNX0WZYV']
102129

103130
extensions.append('sphinxcontrib.asciinema')
104131

132+
#
105133
# -- Eat your own dog food --------------------------------------------------
106134

107135
# If extensions (or modules to document with autodoc) are in another directory,
@@ -117,3 +145,4 @@
117145
}
118146

119147
# DOG FOOD CONFIGURATION END
148+
#

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. This file is generated from sphinx-notes/template.
1+
.. This file is generated from sphinx-notes/cookiecutter.
22
You need to consider modifying the TEMPLATE or modifying THIS FILE.
33
44
.. include:: ../README.rst
@@ -65,7 +65,7 @@ Contents
6565
The Sphinx Notes Project
6666
========================
6767

68-
This project is a developed by `Shengyu Zhang`__,
68+
The project is developed by `Shengyu Zhang`__,
6969
as part of **The Sphinx Notes Project**.
7070

7171
.. toctree::

docs/make.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REM This file is generated from sphinx-notes/template. DO NOT EDIT.
1+
REM This file is generated from sphinx-notes/cookiecutter. DO NOT EDIT.
22

33
@ECHO OFF
44

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is generated from sphinx-notes/template.
1+
# This file is generated from sphinx-notes/cookiecutter.
22
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
33

44
# This file is used to configure your project.

0 commit comments

Comments
 (0)