-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
187 lines (172 loc) · 7.3 KB
/
Copy pathpyproject.toml
File metadata and controls
187 lines (172 loc) · 7.3 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
[build-system]
requires = ["maturin>=1.8,<2"]
build-backend = "maturin"
[project]
name = "yamlrocks"
version = "0.1.0"
description = "A fast, correct YAML library for Python, written in Rust"
readme = "README.md"
authors = [{ name = "Franck Nijhof", email = "opensource@frenck.dev" }]
maintainers = [{ name = "Franck Nijhof", email = "opensource@frenck.dev" }]
requires-python = ">=3.12"
license = "MIT"
# Ship our own license plus the bundled Rust crates' licenses (generated by
# `just licenses`) inside every wheel, under `.dist-info/licenses/`.
license-files = ["LICENSE", "THIRD_PARTY_LICENSES.md"]
keywords = ["yaml", "parser", "serialization", "rust"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Programming Language :: Python :: Free Threading :: 3 - Stable",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Rust",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
[project.urls]
Repository = "https://github.com/frenck/yamlrocks"
Documentation = "https://yaml.rocks"
Changelog = "https://github.com/frenck/yamlrocks/releases"
[tool.maturin]
python-source = "pysrc"
module-name = "yamlrocks._yamlrocks"
features = ["pyo3/extension-module"]
# Embed a CycloneDX SBOM of the Rust dependency tree into every wheel, under
# `.dist-info/sboms/`. This lets anyone holding a wheel recover exactly which
# crates (and versions) it was built from, without trusting an out-of-band file,
# which is the supply-chain transparency the CRA pushes downstream integrators
# toward.
[tool.maturin.sbom]
rust = true
[tool.pytest.ini_options]
testpaths = ["tests"]
# Never collect tests *inside* the real-world config submodules: they ship their
# own third-party Python test files. The real-world suite reads those repos' YAML
# directly (it does not import them).
addopts = "-q --ignore=tests/data/realworld"
asyncio_mode = "auto"
markers = [
"realworld: parse and round-trip real public configs across ecosystems (git submodules under tests/data/realworld; auto-skips when not checked out)",
]
[dependency-groups]
# Dependencies are pinned to exact versions for reproducible local and CI runs;
# bump deliberately (Renovate keeps them current). CI installs these groups
# directly with `uv sync --group <name>` rather than re-listing versions in the
# workflows, so this file is the single source of truth.
# The build tool for the native extension, used by `maturin develop`. The
# `[build-system]` range above governs isolated sdist builds; this pins the tool
# used for local and CI development builds.
build = ["maturin==1.14.1"]
# Test runtime needed to run the suite anywhere, including free-threaded CPython.
# numpy is a separate group because it has no free-threaded wheels yet.
test = [
"pytest==9.1.1",
"pytest-asyncio==1.4.0",
"pyyaml==6.0.3",
"yamllint==1.38.0",
]
# The optional numpy serialization path (OPT_SERIALIZE_NUMPY). Kept as its own
# group so the free-threaded job can omit it (no nogil wheels yet); the numpy
# tests skip cleanly when it is absent.
numpy = ["numpy==2.5.1"]
# Property-based fuzz tests (tests/robustness/test_hostile_objects.py). Kept as
# its own group, like numpy, because Hypothesis ships ABI-specific wheels and has
# none for some targets the wheel smoke test covers (prerelease CPython, 32-bit
# and ARM Windows); it installs best-effort there and the tests skip when it is
# absent. The full suite (coverage.yaml) runs on a target that has a wheel.
proptest = ["hypothesis==6.160.0"]
# Type checkers and linters (no build needed; they check the source and stub).
typing = ["mypy==2.3.0", "ty==0.0.63"]
lint = ["ruff==0.15.22", "codespell==2.4.3", "zizmor==1.28.0"]
# Continuous performance testing (bench/test_benchmarks.py, run by CodSpeed).
codspeed = [{ include-group = "test" }, "pytest-codspeed==5.0.3"]
# Comparison libraries used only by the one-off bench/bench.py report.
bench = ["pyyaml==6.0.3", "ruamel.yaml==0.19.1", "yamlium==0.3.0"]
# Renders the cross-library comparison charts (just charts) into the docs assets.
# Adds the wider field (Rust-backed ryaml/py-yaml12/yaml_rs, the ordered and strict
# pure-Python parsers) that only bench/compare.py needs, plus matplotlib.
charts = [
{ include-group = "bench" },
"ryaml==0.5.1",
"py-yaml12==0.1.0",
"yaml-rs==0.1.6",
"fastyaml-rs==0.6.3",
"oyaml==1.0",
"strictyaml==1.7.3",
"matplotlib==3.11.1",
]
# Everything needed for local development, in one install. Includes the `just`
# task runner (the `rust-just` wheel bundles the binary), so `uv run just` works
# with no separate install.
dev = [
{ include-group = "build" },
{ include-group = "test" },
{ include-group = "numpy" },
{ include-group = "proptest" },
{ include-group = "typing" },
{ include-group = "lint" },
"rust-just==1.57.0",
]
[tool.ruff]
target-version = "py312"
line-length = 88
src = ["pysrc", "tests", "bench"]
# Vendored third-party configs (git submodules) ship their own Python files; they
# are not ours to lint or format. CI does not check them out, but a local clone
# with submodules would otherwise pull thousands of foreign files into `ruff .`.
extend-exclude = ["tests/data/realworld"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"UP", # pyupgrade
"SIM", # flake8-simplify
"C4", # flake8-comprehensions
"RUF", # ruff-specific
]
ignore = [
"E501", # line length is handled by the formatter
]
[tool.ruff.lint.per-file-ignores]
# Tests deliberately exercise odd inputs and broad excepts.
"tests/**" = ["B017", "S101", "SIM105"]
# Benchmark lambdas capture the loop variable but are invoked immediately.
"bench/**" = ["B023"]
[tool.mypy]
python_version = "3.12"
strict = true
files = ["pysrc/yamlrocks"]
# The compiled module is typed via the bundled .pyi stub.
[[tool.mypy.overrides]]
module = "yamlrocks._yamlrocks"
ignore_missing_imports = true
[tool.ty.environment]
python-version = "3.12"
# The typed, enforced surface is the package itself; CI and the pre-commit hook
# both run `ty check pysrc/yamlrocks`. Scope a bare `ty check` to the same surface
# (mirroring mypy's `files = ["pysrc/yamlrocks"]`) so an unscoped run does not crawl
# the test tree or the real-world git submodules (thousands of third-party Python
# files) and report noise that is never enforced.
[tool.ty.src]
include = ["pysrc/yamlrocks"]
# The public API is typed by the bundled __init__.pyi; the runtime __init__.py
# imports from the compiled `_yamlrocks` module, which has no stub of its own, so
# its import is unresolvable to a type checker (mypy silences the same thing).
[[tool.ty.overrides]]
include = ["pysrc/yamlrocks/__init__.py"]
rules = { unresolved-import = "ignore" }
[tool.codespell]
skip = "*.lock,*package-lock.json,./target,./docs/node_modules,./docs/dist,./tests/data/yaml_test_suite/cases,./tests/data/realworld,./fuzz/corpus,./fuzz/target,./fuzz/artifacts,./.git"
ignore-words-list = "crate,ser,inout,aks"