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
|
[build-system]
requires = [
"setuptools>=69",
"mypy[mypyc]>=1.13",
]
build-backend = "setuptools.build_meta"
[project]
name = "tomli"
version = "2.2.1" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
description = "A lil' TOML parser"
authors = [
{ name = "Taneli Hukkinen", email = "hukkin@users.noreply.github.com" },
]
license = { file = "LICENSE" }
requires-python = ">=3.8"
readme = "README.md"
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
keywords = ["toml"]
[project.urls]
"Homepage" = "https://github.com/hukkin/tomli"
"Changelog" = "https://github.com/hukkin/tomli/blob/master/CHANGELOG.md"
[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 = ["tomli", "tests"]
# Settings for Black compatibility
profile = "black"
[tool.tox]
requires = ["tox>=4.21.1"]
# Only run unittest envs when no args given to tox
env_list = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
[tool.tox.env_run_base]
description = "run tests against a built package under {base_python}"
pass_env = ["TOMLI_USE_MYPYC"]
commands = [
["python", "-m", "unittest", { replace = "posargs", extend = true }],
]
[tool.tox.env."profile"]
description = "run profiler (use e.g. `firefox .tox/prof/output.svg` to open)"
deps = [
"-r profiler/requirements.txt",
]
allowlist_externals = [
"mkdir",
"dot",
]
commands = [
["mkdir", "-p", "{toxworkdir}/prof"],
["python", "-m", "cProfile", "-o", "{toxworkdir}/prof/output.pstats", "profiler/profiler_script.py"],
["gprof2dot", "-f", "pstats", "-o", "{toxworkdir}/prof/output.dot", "{toxworkdir}/prof/output.pstats"],
["dot", "-Tsvg", "-o", "{toxworkdir}/prof/output.svg", "{toxworkdir}/prof/output.dot"],
["python", "-c", 'import pathlib; print("profiler svg output under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "prof" / "output.svg"))'],
]
[tool.tox.env."pre-commit"]
description = "run linters"
skip_install = true
deps = ["pre-commit"]
commands = [
["pre-commit", "run", { replace = "posargs", default = ["--all"], extend = true }],
]
[tool.tox.env."benchmark"]
description = "run the benchmark script against a local Tomli version"
deps = ["-r benchmark/requirements.txt"]
commands = [
["python", "-c", "import datetime; print(datetime.date.today())"],
["python", "--version"],
["python", "benchmark/run.py"],
]
[tool.tox.env."benchmark-pypi"]
description = "run the benchmark script against the latest Tomli in PyPI"
skip_install = true
deps = [
"tomli",
"-r benchmark/requirements.txt",
]
commands = [
["python", "-c", "import datetime; print(datetime.date.today())"],
["python", "--version"],
["python", "benchmark/run.py"],
]
[tool.tox.env."fuzz"]
description = 'run the fuzzer against a local Tomli version (needs "apt install clang")'
deps = [
"-r fuzzer/requirements.txt",
]
allowlist_externals = [
"mkdir",
"cp",
]
commands = [
# Create a folder for persistent corpus and use benchmark data as initial seed
["mkdir", "-p", "{toxworkdir}/fuzzer-corpus"],
["cp", "-n", "benchmark/data.toml", "{toxworkdir}/fuzzer-corpus/data.toml"],
# Run fuzzer
["python", "fuzzer/fuzz.py", "{toxworkdir}/fuzzer-corpus", { replace = "posargs", default = ["-len_control=10000"], extend = true }],
]
[tool.coverage.run]
branch = true
source = ['tomli']
[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
# Re-enable the standard pragma (with extra strictness)
'# pragma: no cover\b',
# 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 `benchmark/run.py`. Since benchmark/ is
# not a package, we use the module name here.
module = "run"
ignore_errors = true
[[tool.mypy.overrides]]
# This matches `fuzzer/fuzz.py`.
module = "fuzz"
ignore_errors = true
|