-
Notifications
You must be signed in to change notification settings - Fork 572
/
Copy pathpyproject.toml
336 lines (311 loc) · 10.9 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
[build-system]
requires = ["hatchling", "hatch-build-scripts"]
build-backend = "hatchling.build"
[project]
name = "wiki"
description = "A wiki system written for the Django framework."
readme = "README.rst"
requires-python = ">=3.9"
license = "GPL-3.0"
keywords = ["django", "wiki", "markdown"]
authors = [
{ name = "Benjamin Bach", email = "benjamin@overtag.dk" },
]
maintainers = [
{ name = "Oscar Cortez", email = "om.cortez.2010@gmail.com" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Wiki",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Application Frameworks",
]
dependencies = [
# Django version support is added one minor release at a time
"Django>=3.2,<5.2",
# bleach has been pretty stable, hence the loose pin
"bleach[css]>=6,<7",
# Pillow is used very little and has never broken
"Pillow",
# django-nyt is maintained by django-wiki maintainers, so we can
# control breakage and pinning ourselves
"django-nyt>=1.4.1,<1.5",
# django-mptt has had several breaking changes
"django-mptt>=0.13,<0.17",
# django-sekizai is basically only releasing every time
# it needs to restore support for a new Django/Python version
"django-sekizai>=0.10",
# sorl-thumbnail is maintained by jazzband so it might be
# very stable but it might also suddenly invite breaking changes
"sorl-thumbnail>=12.8,<13",
# django-wiki's integration with Markdown is really detailed,
# several extensions have imported internal APIs, so be very
# careful here.
"Markdown>=3.4,<3.7",
# Set of extensions for Python Markdown.
"pymdown-extensions>=10.5,<10.6",
]
dynamic = ["version"]
[project.optional-dependencies]
docs = [
"sphinx>=6,<8",
"sphinx_rtd_theme==2.0.0",
]
[project.urls]
Homepage = "http://www.django-wiki.org"
Documentation = "https://django-wiki.readthedocs.io/en/latest/"
Tracker = "https://github.com/django-wiki/django-wiki/issues"
Source = "https://github.com/django-wiki/django-wiki"
[[tool.hatch.build.hooks.build-scripts.scripts]]
out_dir = "."
commands = [
"""
python -c "import os, subprocess, shutil;
readthedocs_env = os.environ.get('READTHEDOCS_VIRTUALENV_PATH');
print('Building SCSS files.');
if readthedocs_env:
print('READTHEDOCS_VIRTUALENV_PATH is set, skipping SASS compilation');
elif shutil.which('pysassc') is None:
print('pysassc not found, please install it to proceed.');
else:
result = subprocess.run(
[
'pysassc',
'--style',
'compressed',
'src/wiki/static/wiki/bootstrap/scss/wiki/wiki-bootstrap.scss',
'src/wiki/static/wiki/bootstrap/css/wiki-bootstrap.min.css'
],
check=False,
capture_output=True,
text=True,
);
if result.returncode != 0:
print('Error during SASS compilation:', result.stderr);
exit(result.returncode);
"
"""
]
artifacts = [
# "wiki-bootstrap.min.css",
]
clean_artifacts = false
# clean_out_dir = true
[tool.hatch.publish.index]
disable = true
[tool.hatch.version]
path = "src/wiki/__about__.py"
[tool.hatch.build.targets.sdist]
include = [
"COPYING",
"README.rst",
"/src",
]
exclude = [
"src/wiki/locale/en/LC_MESSAGES/django.mo",
]
[tool.hatch.envs.default]
dependencies = [
"ruff==0.1.3",
"ddt==1.6.0",
"django-functest>=1.2,<1.6",
"pre-commit==3.5.0",
"pytest-cov",
"pytest-django",
"pytest-pythonpath",
"pytest>=6.2.5,<7.3",
"hatch-build-scripts==0.0.4",
]
[tool.hatch.envs.default.scripts]
lint = [
"ruff check src/wiki tests/ {args}",
"pre-commit install -f --install-hooks",
"pre-commit run --all-files --show-diff-on-failure",
]
format = "ruff format src/wiki tests/ {args}"
clean = [
"hatch run clean-build",
"hatch run clean-pyc",
"rm -fr htmlcov/",
]
clean-build = [
"rm -fr build",
"rm -fr dist",
"rm -fr .eggs",
"find . -name '*.egg-info' -exec rm -fr {{}} +",
"find . -name '*.egg' -exec rm -f {{}} +",
]
clean-pyc = [
"find . -name '*.pyc' -exec rm -f {{}} +",
"find . -name '*.pyo' -exec rm -f {{}} +",
"find . -name '*~' -exec rm -f {{}} +",
"find . -name '__pycache__' -exec rm -fr {{}} +",
]
test = "pytest {args}"
[tool.hatch.envs.test.overrides]
matrix.django.dependencies = [
{ value = "django~={matrix:django}" },
]
[tool.hatch.envs.test]
matrix-name-format = "dj{value}"
[tool.hatch.envs.test.scripts]
all = [
"sh -c 'testproject/manage.py makemigrations --check'",
"pytest tests/ --cov=wiki {args}",
]
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10"]
django = ["3.2", "4.0"]
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10", "3.11"]
django = ["4.1", "4.2"]
[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12"]
django = ["5.0", "5.1"]
[tool.hatch.envs.transifex]
dependencies = []
[tool.hatch.envs.transifex.scripts]
push = [
"touch ~/.transifexrc",
# Recipe: https://github.com/transifex/cli#running-from-docker-beta
"docker run --rm -i -t -v `pwd`:/app -v ~/.transifexrc:/.transifexrc -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt transifex/txcli --root-config /.transifexrc push -s",
]
pull = [
"touch ~/.transifexrc",
# Recipe: https://github.com/transifex/cli#running-from-docker-beta
"docker run --rm -i -t -v `pwd`:/app -v ~/.transifexrc:/.transifexrc -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt transifex/txcli --root-config /.transifexrc pull -a",
# This can have permission errors because of Docker
# In this case, run chown -R USERNAME:USERGROUP src/wiki/locale
"cd src/wiki && django-admin compilemessages",
]
[tool.hatch.envs.docs]
dependencies = [
"sphinx>=6,<8",
"sphinx_rtd_theme==2.0.0",
]
[tool.hatch.envs.docs.scripts]
clean = "rm -rf docs/_build/*"
html = "sphinx-build -c docs -b html -d docs/_build/doctrees docs/ docs/_build/html"
dirhtml = "sphinx-build -c docs -b dirhtml -d docs/_build/doctrees docs/ docs/_build/dirhtml"
singlehtml = "sphinx-build -c docs -b singlehtml -d docs/_build/doctrees docs/ docs/_build/singlehtml"
pickle = "sphinx-build -c docs -b pickle -d docs/_build/doctrees docs/ docs/_build/pickle"
json = "sphinx-build -c docs -b json -d docs/_build/doctrees docs/ docs/_build/json"
htmlhelp = [
"sphinx-build -c docs -b htmlhelp -d docs/_build/doctrees docs/ docs/_build/htmlhelp",
"echo 'Build finished; now you can run HTML Help Workshop with the .hhp project file in docs/_build/htmlhelp.'",
]
qthelp = [
"sphinx-build -c docs -b qthelp -d docs/_build/doctrees docs/ docs/_build/qthelp",
"echo 'Build finished; now you can run qcollectiongenerator with the .qhcp project file in docs/_build/qthelp, like this:'",
"echo '# qcollectiongenerator docs/_build/qthelp/django-wiki.qhcp'",
"echo 'To view the help file:'",
"echo '# assistant -collectionFile docs/_build/qthelp/django-wiki.qhc'",
]
devhelp = [
"sphinx-build -c docs -b devhelp -d docs/_build/doctrees docs/ docs/_build/devhelp",
"echo 'Build finished.'",
"echo 'To view the help file:'",
"echo '# mkdir -p $$HOME/.local/share/devhelp/django-wiki'",
"echo '# ln -s docs/_build/devhelp $$HOME/.local/share/devhelp/django-wiki'",
"echo '# devhelp'",
]
epub = "sphinx-build -c docs -b epub -d docs/_build/doctrees docs/ docs/_build/epub"
latex = [
"sphinx-build -c docs -b latex -d docs/_build/doctrees -D latex_paper_size={args} docs/ docs/_build/latext",
"echo 'Build finished; the LaTeX files are in docs/_build/latex.'",
"echo 'Run `make` in that directory to run these through (pdf)latex'",
"echo '(use `make latexpdf` here to do that automatically).'",
]
latexpdf = [
"sphinx-build -c docs -b latex -d docs/_build/doctrees -D latex_paper_size={args} docs/ docs/_build/latext",
"echo 'Running LaTeX files through pdflatex...'",
"make -C docs/_build/latex all-pdf",
"echo 'pdflatex finished; the PDF files are in docs/_build/latex.'",
]
text = "sphinx-build -c docs -b text -d docs/_build/doctrees docs/ docs/_build/text"
man = "sphinx-build -c docs -b man -d docs/_build/doctrees docs/ docs/_build/man"
texinfo = [
"sphinx-build -c docs -b text -d docs/_build/doctrees docs/ docs/_build/text",
"echo 'Build finished. The Texinfo files are in docs/_build/texinfo.'",
"echo 'Run `make` in that directory to run these through makeinfo'",
"echo '(use `make info` here to do that automatically).'",
]
info = [
"sphinx-build -c docs -b texinfo -d docs/_build/doctrees docs/ docs/_build/texinfo",
"echo 'Running Texinfo files through makeinfo...'",
"make -C docs/_build/texinfo info",
"echo 'makeinfo finished; the Info files are in docs/_build/texinfo.'",
]
gettext = "sphinx-build -c docs -b gettext docs/_build/locale"
changes = "sphinx-build -c docs -b changes -d docs/_build/doctrees docs/ docs/_build/changes"
link-check2 = "sphinx-build -c docs -b linkcheck -d docs/_build/doctrees docs/ docs/_build/linkcheck"
doctest = "sphinx-build -c docs -b doctest -d docs/_build/doctrees docs/ docs/_build/doctest"
build = [
"hatch run docs:clean",
"rm -f docs/wiki*.rst",
"rm -f docs/modules.rst",
"sphinx-apidoc -o docs/ src/wiki",
"hatch run docs:html {args}",
"""
python -c '
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open(\"file://\" + pathname2url(os.path.abspath(\"docs/_build/html/index.html\")))
'"""
]
link-check = "sphinx-build -b linkcheck ./docs ./docs/_build"
[tool.coverage.run]
disable_warnings = ['no-data-collected']
branch = true
parallel = true
source = [
"src/",
]
omit = [
".DS_Store",
"*/tests/*",
"src/wiki/__about__.py",
]
[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]
[tool.ruff]
exclude = ["env", "_build", "CVS", "__pycache__", ".eggs", "*.egg", "*/*migrations", "testproject"]
extend-ignore = ["E203"]
line-length = 79
[tool.ruff.mccabe]
max-complexity = 10
[tool.pytest.ini_options]
django_find_project = false
testpaths = [
"tests",
]
norecursedirs = [
"testproject",
".svn",
"_build",
"tmp*",
"dist",
"*.egg-info",
]
DJANGO_SETTINGS_MODULE = "tests.settings"