tomli
/
pyproject.toml
157 строк · 4.4 Кб
1[build-system]
2requires = ["flit_core>=3.2.0,<4"]
3build-backend = "flit_core.buildapi"
4
5[project]
6name = "tomli"
7version = "2.0.1" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
8description = "A lil' TOML parser"
9authors = [
10{ name = "Taneli Hukkinen", email = "hukkin@users.noreply.github.com" },
11]
12license = { file = "LICENSE" }
13requires-python = ">=3.8"
14readme = "README.md"
15classifiers = [
16"License :: OSI Approved :: MIT License",
17"Operating System :: MacOS",
18"Operating System :: Microsoft :: Windows",
19"Operating System :: POSIX :: Linux",
20"Programming Language :: Python :: 3 :: Only",
21"Programming Language :: Python :: Implementation :: CPython",
22"Programming Language :: Python :: Implementation :: PyPy",
23"Topic :: Software Development :: Libraries :: Python Modules",
24"Typing :: Typed",
25]
26keywords = ["toml"]
27
28[project.urls]
29"Homepage" = "https://github.com/hukkin/tomli"
30"Changelog" = "https://github.com/hukkin/tomli/blob/master/CHANGELOG.md"
31
32
33[tool.isort]
34# Force imports to be sorted by module, independent of import type
35force_sort_within_sections = true
36# Group first party and local folder imports together
37no_lines_before = ["LOCALFOLDER"]
38
39# Configure isort to work without access to site-packages
40known_first_party = ["tomli", "tests"]
41
42# Settings for Black compatibility
43profile = "black"
44
45
46[tool.tox]
47legacy_tox_ini = '''
48[tox]
49# Only run unittest envs when no args given to tox
50envlist = py{38,39,310,311,312}
51isolated_build = True
52
53[testenv:py{38,39,310,311,312}]
54description = run tests against a built package
55commands =
56python -m unittest {posargs}
57
58[testenv:profile]
59description = run profiler (use e.g. `firefox .tox/prof/output.svg` to open)
60deps =
61-r profiler/requirements.txt
62allowlist_externals =
63mkdir
64dot
65commands =
66mkdir -p "{toxworkdir}/prof"
67python -m cProfile -o "{toxworkdir}/prof/output.pstats" profiler/profiler_script.py
68gprof2dot -f pstats -o "{toxworkdir}/prof/output.dot" "{toxworkdir}/prof/output.pstats"
69dot -Tsvg -o "{toxworkdir}/prof/output.svg" "{toxworkdir}/prof/output.dot"
70python -c 'import pathlib; print("profiler svg output under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "prof" / "output.svg"))'
71
72[testenv:pre-commit]
73description = run linters
74skip_install = True
75deps = pre-commit
76commands = pre-commit run {posargs:--all}
77
78[testenv:benchmark]
79description = run the benchmark script against a local Tomli version
80deps =
81-r benchmark/requirements.txt
82commands =
83python -c 'import datetime; print(datetime.date.today())'
84python --version
85python benchmark/run.py
86
87[testenv:benchmark-pypi]
88description = run the benchmark script against the latest Tomli in PyPI
89skip_install = True
90deps =
91tomli
92-r benchmark/requirements.txt
93commands =
94python -c 'import datetime; print(datetime.date.today())'
95python --version
96python benchmark/run.py
97
98[testenv:fuzz]
99description = run the fuzzer against a local Tomli version (needs "apt install clang")
100deps =
101-r fuzzer/requirements.txt
102allowlist_externals =
103mkdir
104cp
105commands =
106# Create a folder for persistent corpus and use benchmark data as initial seed
107mkdir -p {toxworkdir}/fuzzer-corpus
108cp -n benchmark/data.toml {toxworkdir}/fuzzer-corpus/data.toml
109# Run fuzzer
110python fuzzer/fuzz.py {toxworkdir}/fuzzer-corpus {posargs:-len_control=10000}
111'''
112
113
114[tool.coverage.run]
115branch = true
116source = ['tomli']
117
118[tool.coverage.report]
119# Regexes for lines to exclude from consideration
120exclude_lines = [
121# Re-enable the standard pragma (with extra strictness)
122'# pragma: no cover\b',
123# Code for static type checkers
124'if TYPE_CHECKING:',
125# Scripts
126'if __name__ == .__main__.:',
127]
128
129
130[tool.mypy]
131show_error_codes = true
132warn_unreachable = true
133warn_unused_ignores = true
134warn_redundant_casts = true
135warn_unused_configs = true
136# Disabling incremental mode is required for `warn_unused_configs = true` to work
137incremental = false
138disallow_untyped_defs = true
139check_untyped_defs = true
140strict_equality = true
141implicit_reexport = false
142no_implicit_optional = true
143
144[[tool.mypy.overrides]]
145module = "tests.*"
146disallow_untyped_defs = false
147
148[[tool.mypy.overrides]]
149# This matches `benchmark/run.py`. Since benchmark/ is
150# not a package, we use the module name here.
151module = "run"
152ignore_errors = true
153
154[[tool.mypy.overrides]]
155# This matches `fuzzer/fuzz.py`.
156module = "fuzz"
157ignore_errors = true
158