Skip to content

Commit da57ecc

Browse files
committed
doc: add towncrier to build changelogs
1 parent 06c844e commit da57ecc

File tree

9 files changed

+124
-18
lines changed

9 files changed

+124
-18
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ docs/source/api/methods/
1616
docs/source/api/bound-methods/
1717
docs/source/api/types/
1818

19-
# Sphinx documentation
20-
docs/build/
21-
docs/source/_build/
22-
2319
# PyCharm stuff
2420
.idea/
2521

@@ -92,6 +88,7 @@ instance/
9288
.scrapy
9389

9490
# Sphinx documentation
91+
docs/build/
9592
docs/_build/
9693
docs/source/_build
9794

NEWS.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=========
2+
Changelog
3+
=========
4+
5+
..
6+
You should *NOT* be adding new change log entries to this file, this
7+
file is managed by towncrier. You *may* edit previous change logs to
8+
fix problems like typo corrections or such.
9+
To add a new change log entry, please see
10+
https://pip.pypa.io/en/latest/development/#adding-a-news-entry
11+
we named the news folder "news".
12+
WARNING: Don't drop the next directive!
13+
14+
.. towncrier release notes start
15+
16+
0.1.0 (2023-11-01)
17+
===================
18+
19+
No significant changes.

docs/source/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Meta
9898

9999
- :doc:`Hydrogram FAQ <faq/index>`: Answers to common Hydrogram questions.
100100
- :doc:`Support Hydrogram <support>`: Ways to show your appreciation.
101-
- :doc:`Release Notes <releases/index>`: Release notes for Hydrogram releases.
101+
- :doc:`Release Notes <releases>`: Release notes for Hydrogram releases.
102102

103103
.. toctree::
104104
:hidden:
@@ -160,7 +160,7 @@ Meta
160160

161161
faq/index
162162
support
163-
releases/index
163+
releases
164164

165165
.. toctree::
166166
:hidden:

docs/source/releases.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.. _hydrogram_changes:
2+
3+
.. include:: ../../NEWS.rst

news/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!.gitignore

news/.template.rst.jinja2

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{% if top_line %}
2+
{{ top_line }}
3+
{{ top_underline * ((top_line)|length)}}
4+
{% elif versiondata.name %}
5+
{{ versiondata.version }} ({{ versiondata.date }})
6+
{{ top_underline * ((versiondata.version + versiondata.date)|length + 4)}}
7+
{% else %}
8+
{{ versiondata.version }} ({{ versiondata.date }})
9+
{{ top_underline * ((versiondata.version + versiondata.date)|length + 3)}}
10+
{% endif %}
11+
{% for section, _ in sections.items() %}
12+
{% set underline = underlines[0] %}{% if section %}{{section}}
13+
{{ underline * section|length }}{% set underline = underlines[1] %}
14+
15+
{% endif %}
16+
17+
{% if sections[section] %}
18+
{% for category, val in definitions.items() if category in sections[section]%}
19+
{{ definitions[category]['name'] }}
20+
{{ underline * definitions[category]['name']|length }}
21+
22+
{% if definitions[category]['showcontent'] %}
23+
{% for text, values in sections[section][category].items() %}
24+
- {{ text }}
25+
{{ values|join(', ') }}
26+
{% endfor %}
27+
28+
{% else %}
29+
- {{ sections[section][category]['']|join(', ') }}
30+
31+
{% endif %}
32+
{% if sections[section][category]|length == 0 %}
33+
No significant changes.
34+
35+
{% else %}
36+
{% endif %}
37+
38+
{% endfor %}
39+
{% else %}
40+
No significant changes.
41+
42+
43+
{% endif %}
44+
{% endfor %}

pyproject.toml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ docs = [
6565
"sphinx-autobuild>=2021.3.14",
6666
"sphinx-copybutton>=0.5.2",
6767
"pygments>=2.16.1",
68+
"towncrier>=23.6.0",
6869
]
6970

7071
[tool.hatch.metadata]
@@ -87,21 +88,56 @@ package = "hydrogram"
8788
line-length = 99
8889
target-version = "py38"
8990
select = [
90-
"I", # isort
91-
"E", # pycodestyle
92-
"W", # pycodestyle
93-
"UP", # pyupgrade
94-
"F", # pyflakes
95-
"SIM", # flake8-simplify
96-
"RET", # flake8-return
97-
"C4", # flake8-comprehensions
98-
"PTH", # flake8-use-pathlib
99-
"PERF", # perflint
100-
"N", # pep8-naming
101-
"RUF", # ruff
91+
"I", # isort
92+
"E", # pycodestyle
93+
"W", # pycodestyle
94+
"UP", # pyupgrade
95+
"F", # pyflakes
96+
"SIM", # flake8-simplify
97+
"RET", # flake8-return
98+
"C4", # flake8-comprehensions
99+
"PTH", # flake8-use-pathlib
100+
"PERF", # perflint
101+
"N", # pep8-naming
102+
"RUF", # ruff
102103
]
103104
ignore = ["RUF001", "RUF002", "RUF003", "E203"]
104105
preview = true
105106

106107
[tool.ruff.isort]
107108
known-first-party = ["hydrogram"]
109+
110+
[tool.towncrier]
111+
package = "hydrogram"
112+
filename = "NEWS.rst"
113+
directory = "news/"
114+
template = "news/.template.rst.jinja2"
115+
issue_format = "`#{issue} <https://github.com/AmanoTeam/hydrogram/issues/{issue}>`_"
116+
117+
[[tool.towncrier.section]]
118+
path = ""
119+
120+
[[tool.towncrier.type]]
121+
directory = "feature"
122+
name = "Features"
123+
showcontent = true
124+
125+
[[tool.towncrier.type]]
126+
directory = "bugfix"
127+
name = "Bugfixes"
128+
showcontent = true
129+
130+
[[tool.towncrier.type]]
131+
directory = "doc"
132+
name = "Improved Documentation"
133+
showcontent = true
134+
135+
[[tool.towncrier.type]]
136+
directory = "removal"
137+
name = "Deprecations and Removals"
138+
showcontent = true
139+
140+
[[tool.towncrier.type]]
141+
directory = "misc"
142+
name = "Misc"
143+
showcontent = true

requirements-dev.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ beautifulsoup4==4.12.2
1313
certifi==2023.7.22
1414
cffi==1.16.0
1515
charset-normalizer==3.3.2
16+
click==8.1.7
1617
colorama==0.4.6
1718
coverage==7.3.2
1819
cryptography==41.0.5
@@ -21,6 +22,7 @@ furo==2023.9.10
2122
idna==3.4
2223
imagesize==1.4.1
2324
importlib-metadata==6.8.0
25+
incremental==22.10.0
2426
iniconfig==2.0.0
2527
jaraco-classes==3.3.0
2628
jeepney==0.8.0
@@ -63,6 +65,7 @@ sphinxcontrib-jsmath==1.0.1
6365
sphinxcontrib-qthelp==1.0.6
6466
sphinxcontrib-serializinghtml==1.1.9
6567
tornado==6.3.3
68+
towncrier==23.10.0
6669
twine==4.0.2
6770
urllib3==2.0.7
6871
zipp==3.17.0

requirements.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ babel==2.13.1
1212
beautifulsoup4==4.12.2
1313
certifi==2023.7.22
1414
charset-normalizer==3.3.2
15+
click==8.1.7
1516
colorama==0.4.6
1617
docutils==0.20.1
1718
furo==2023.9.10
1819
idna==3.4
1920
imagesize==1.4.1
21+
incremental==22.10.0
2022
jinja2==3.1.2
2123
livereload==2.6.3
2224
markupsafe==2.1.3
@@ -39,6 +41,7 @@ sphinxcontrib-jsmath==1.0.1
3941
sphinxcontrib-qthelp==1.0.6
4042
sphinxcontrib-serializinghtml==1.1.9
4143
tornado==6.3.3
44+
towncrier==23.10.0
4245
urllib3==2.0.7
4346
# The following packages are considered to be unsafe in a requirements file:
4447
setuptools==68.2.2

0 commit comments

Comments
 (0)