forked from executablebooks/mdformat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
175 lines (148 loc) · 4.75 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
[build-system]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"
[project]
name = "mdformat"
version = "0.7.17" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
description = "CommonMark compliant Markdown formatter"
authors = [
{ name = "Taneli Hukkinen", email = "hukkin@users.noreply.github.com" },
]
license = { file = "LICENSE" }
requires-python = ">=3.8"
dependencies = [
'markdown-it-py >=1.0.0,<4.0.0',
'tomli >=1.1.0; python_version < "3.11"',
'importlib-metadata >=3.6.0; python_version < "3.10"',
]
readme = "README.md"
classifiers = [
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Topic :: Documentation",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Markup",
"Typing :: Typed",
]
keywords = ["mdformat", "markdown", "commonmark", "formatter", "pre-commit"]
[project.urls]
"Homepage" = "https://github.com/executablebooks/mdformat"
"Documentation" = "https://mdformat.readthedocs.io"
"Style guide" = "https://mdformat.readthedocs.io/en/stable/users/style.html"
"Changelog" = "https://mdformat.readthedocs.io/en/stable/users/changelog.html"
[project.scripts]
mdformat = "mdformat.__main__:run"
[tool.isort]
# Force imports to be sorted by module, independent of import type
force_sort_within_sections = true
# Group first party and local folder imports together
no_lines_before = ["LOCALFOLDER"]
# Configure isort to work without access to site-packages
known_first_party = ["mdformat", "tests"]
# Settings for Black compatibility
profile = "black"
[tool.pytest.ini_options]
addopts = "--strict-markers --strict-config"
xfail_strict = true
[tool.tox]
legacy_tox_ini = '''
[tox]
# Only run pytest envs when no args given to tox
envlist = py{38,39,310,311}
isolated_build = True
[testenv:py{38,39,310,311}]
description = run tests
deps =
-r tests/requirements.txt
commands =
pytest {posargs}
[testenv:profile]
description = run profiler (use e.g. `firefox .tox/prof/combined.svg` to open)
deps =
-r tests/requirements.txt
pytest-profiling
commands =
pytest tests/test_for_profiler.py --profile-svg --pstats-dir "{toxworkdir}/prof"
python -c 'import pathlib; print("profiler svg output under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "prof" / "combined.svg"))'
[testenv:pre-commit]
description = run linters (except mypy)
skip_install = True
deps = pre-commit
commands = pre-commit run {posargs:--all}
[testenv:mypy]
description = run mypy
basepython = python3.8
deps =
-r tests/requirements.txt
mypy==0.910
commands =
mypy {posargs:src/ tests/}
[testenv:hook]
description = test mdformat's own pre-commit hook against the README file
skip_install = True
deps = pre-commit
commands =
pre-commit try-repo . mdformat --files README.md
[testenv:cli]
description = run mdformat's own CLI
commands = mdformat {posargs}
[testenv:docs]
description = invoke sphinx-build to build the HTML docs
skip_install = True
deps =
-r docs/requirements.txt
commands =
sphinx-build -d "{toxworkdir}/docs_doctree" docs/ "{toxworkdir}/docs_out" -W -b html {posargs}
python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))'
[testenv:fuzz]
description = run the fuzzer (needs "apt install clang")
deps =
-r fuzzer/requirements.txt
allowlist_externals =
mkdir
cp
commands =
# Create a folder for persistent corpus and use README.md as initial seed
mkdir -p {toxworkdir}/fuzzer-corpus
cp -n README.md {toxworkdir}/fuzzer-corpus/README.md
# Run fuzzer
python fuzzer/fuzz.py {toxworkdir}/fuzzer-corpus {posargs:-len_control=10000}
'''
[tool.coverage.run]
source = ["mdformat"]
omit = ["*/__main__.py"]
[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
# Re-enable the standard pragma (with extra strictness)
'# pragma: no cover\b',
# Ellipsis lines after @typing.overload
'^ +\.\.\.$',
# Code for static type checkers
"if TYPE_CHECKING:",
# Scripts
'if __name__ == .__main__.:',
]
[tool.mypy]
show_error_codes = true
warn_unreachable = true
warn_unused_ignores = true
warn_redundant_casts = true
warn_unused_configs = true
# Disabling incremental mode is required for `warn_unused_configs = true` to work
incremental = false
disallow_untyped_defs = true
check_untyped_defs = true
strict_equality = true
implicit_reexport = false
no_implicit_optional = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
[[tool.mypy.overrides]]
# This matches `fuzzer/fuzz.py`.
module = "fuzz"
ignore_errors = true