-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
287 lines (257 loc) · 7.77 KB
/
Copy pathpyproject.toml
File metadata and controls
287 lines (257 loc) · 7.77 KB
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
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[project]
name = "dature"
dynamic = ["version"]
description = "Type-safe configuration loader for Python dataclasses with support for YAML, JSON, TOML, INI, ENV and environment variables"
readme = "README.md"
license = "Apache-2.0"
license-files = ["LICENSE"]
requires-python = ">=3.12"
authors = [
{ name = "Niccolum", email = "lastsal@mail.ru" },
]
keywords = [
"configuration",
"config",
"dataclass",
"type-safe",
"yaml",
"json",
"json5",
"toml",
"ini",
"env",
"settings",
"loader",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Typing :: Typed",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries",
"Operating System :: OS Independent",
]
dependencies = [
"adaptix>=3.0.0b11",
]
[project.urls]
Homepage = "https://github.com/reagento/dature"
Repository = "https://github.com/reagento/dature"
Issues = "https://github.com/reagento/dature/issues"
Documentation = "https://dature.readthedocs.io/"
[project.scripts]
dature = "dature.cli:main"
[project.optional-dependencies]
yaml = ["ruamel.yaml>=0.18"]
json5 = ["json-five>=1.1.2"]
toml = ["toml-rs>=0.3.4"]
secure = ["random-string-detector>=1.1.1"]
vault = ["hvac>=2.0"]
# Type stubs for the optional integrations above — only needed by users running
# a static type checker (mypy/pyright). Add ``[<lib>,type-stubs]`` to opt in.
type-stubs = ["types-hvac"]
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.hooks.vcs]
version-file = "src/dature/_version.py"
[tool.ruff]
line-length = 120
target-version = "py312"
extend-exclude = [
"docs/examples/advanced/cross_source_refs/t_string.py",
"src/dature/_version.py",
]
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"D", # pydocstyle
"ANN204", # missing return type for __init__
"SIM108", # ternary operator
"COM812", # disable the conflicting rule with formatter
"TC001", # typing-only first-party import — TYPE_CHECKING is banned in dature
"TC002", # typing-only third-party import — TYPE_CHECKING is banned in dature
"TC003", # typing-only standard-library import — TYPE_CHECKING is banned in dature
]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"typing.TYPE_CHECKING".msg = "TYPE_CHECKING is banned in dature: move imports to module or function scope; resolve cycles by refactoring."
[tool.ruff.lint.per-file-ignores]
"examples/**/*.py" = [
"DTZ001", # datetime without tzinfo (examples use naive datetime for simplicity)
"PLR2004", # magic values in examples
"S101", # assert (examples use assert for simplicity)
]
"tests/**/*.py" = [
"S101", # assert
"ANN", # type annotations
"SLF001", # private member access
"DTZ001", # datetime without tzinfo
"PLR2004", # magic values in tests
"S105", # possible hardcoded password
"S106", # possible hardcoded password assigned to argument
"FBT001", # boolean argument in function definition
]
"src/dature/loaders/*.py" = [
"FBT001", # loader functions accept bool as scalar value, not as a flag
]
"src/dature/cli/*.py" = [
"T201", # print (CLI output goes to stdout/stderr)
]
"docs/generate_*.py" = [
"INP001", # implicit namespace package
"T201", # print (CLI script)
"S310", # URL open audit (hardcoded https)
"BLE001", # blind exception (graceful fallback)
]
"benchmarks/**/*.py" = [
"INP001", # implicit namespace package
"T201", # print (benchmark output goes to stdout)
"ANN", # type annotations
"PLR2004", # magic values
"S101", # assert
"SLF001", # private member access
"FBT", # boolean arguments
"ERA001", # commented-out code
"SIM115", # NamedTemporaryFile can't use context manager (need path to persist)
"ARG003", # pydantic-settings API requires fixed settings_customise_sources signature
"E501", # long lines from external API signatures
"S603", # subprocess with trusted sys.executable + explicit path list
"RUF001", # × multiplication sign intentional in output formatting
]
[tool.ruff.lint.pylint]
max-args = 6
max-returns = 8
[tool.mypy]
python_version = "3.12"
# t_string.py uses Python 3.14 t-string syntax; mypy cannot parse it under 3.12.
exclude = ["docs/examples/advanced/cross_source_refs/t_string\\.py"]
strict = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_any_generics = true
check_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
strict_equality = true
explicit_package_bases = true
mypy_path = "src:."
plugins = ["dature.mypy_plugin"]
[[tool.mypy.overrides]]
module = "tests.*"
disable_error_code = ["no-untyped-def", "arg-type", "call-overload", "func-returns-value", "call-arg", "attr-defined", "index"]
[[tool.mypy.overrides]]
module = "docs.examples.*"
disable_error_code = ["arg-type", "call-overload", "dict-item"]
[[tool.mypy.overrides]]
module = "benchmarks.*"
ignore_errors = true
[[tool.mypy.overrides]]
module = "testcontainers.*"
follow_untyped_imports = true
[[tool.mypy.overrides]]
module = "docker.*"
follow_untyped_imports = true
[tool.coverage.run]
source = ["dature"]
omit = ["src/dature/_version.py"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"@overload",
]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
pythonpath = [
"src",
]
markers = [
"integration: tests that require external services via testcontainers (e.g. Vault)",
"examples: tests that execute the docs example scripts as subprocesses",
]
[tool.dature.ci]
# Libs whose major versions are parametrized across the integration-tests matrix in CI.
# Each entry maps the PyPI package name to the extras section in this file where its
# version constraint lives. See .github/workflows/ci.yml::get-integration-lib-versions.
integration-test-libs = {hvac = "vault"}
[tool.towncrier]
package = "dature"
package_dir = "src"
directory = "changes"
filename = "CHANGELOG.md"
title_format = "## {version}"
underlines = ["", "", ""]
issue_format = "[#{issue}](https://github.com/reagento/dature/issues/{issue})"
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bugfixes"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Docs"
showcontent = true
[[tool.towncrier.type]]
directory = "refactor"
name = "Refactoring"
showcontent = true
[[tool.towncrier.type]]
directory = "removal"
name = "Removals"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Misc"
showcontent = false
[dependency-groups]
dev = [
"mypy>=2.3.0",
"pytest>=9.1.1",
"ruff>=0.15.21",
"prek>=0.4.9",
"towncrier>=25.8.0",
"tzdata>=2026.3; sys_platform == 'win32'",
"pytest-cov>=7.1.0",
"time-machine>=3.2.0",
]
integration-tests = [
"testcontainers[vault]>=4.0",
]
docs = [
"mkdocs>=1.6,<2",
"mkdocs-material>=9.6",
"mkdocs-macros-plugin>=1.0",
"mkdocs-git-revision-date-localized-plugin>=1.2",
"mkdocs-llmstxt>=0.5",
"mkdocs-minify-plugin>=0.8",
"pillow>=10.0",
"cairosvg>=2.7; sys_platform == 'linux'",
"pymdown-extensions>=10.7",
]
examples = [
"click>=8",
]
benchmarks = [
"pydantic-settings[yaml,toml]>=2.0",
"python-decouple>=3.8",
"dynaconf>=3.0",
"hydra-core>=1.3",
"ruamel.yaml>=0.18",
"toml-rs>=0.3.4",
]
[tool.uv]
default-groups = ["dev", "examples"]