Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
128 lines (115 loc) · 5.54 KB
/
Copy pathpyproject.toml
File metadata and controls
128 lines (115 loc) · 5.54 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
[build-system]
requires = ["maturin>=1.7,<2"]
build-backend = "maturin"
[project]
name = "yamluna"
description = "YAML for Python, out of the box: byte-identical round trips, and your own classes and third-party types saved and loaded as themselves. Rust core."
requires-python = ">=3.11"
license = "MIT OR Apache-2.0"
authors = [{ name = "Vyron Vasileiadis", email = "vyron@qilimanjaro.tech" }]
readme = "README.md"
keywords = ["yaml", "round-trip", "serialization", "dataclasses", "config", "comments", "rust"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Rust",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Markup",
"Typing :: Typed",
]
dynamic = ["version"]
[project.urls]
Documentation = "https://fedonman.github.io/yamluna/"
Repository = "https://github.com/fedonman/yamluna"
Changelog = "https://fedonman.github.io/yamluna/changelog/"
Issues = "https://github.com/fedonman/yamluna/issues"
[dependency-groups]
# numpy is for `examples/register_class.py`, which CI runs.
dev = ["pytest>=8", "ruamel.yaml==0.19.1", "maturin>=1.7,<2", "ruff", "ty", "numpy"]
# `bench/libraries.py`: the other libraries the comparison page measures.
bench = ["ruamel.yaml==0.19.1", "pyyaml", "py-yaml12", "strictyaml"]
# The documentation site. `mkdocstrings[python]` is what renders docs/api/*.md;
# without it those pages build clean and come out empty.
docs = ["zensical", "mkdocstrings[python]"]
[tool.maturin]
manifest-path = "crates/yamluna-py/Cargo.toml"
python-source = "python"
module-name = "yamluna._yamluna"
features = ["pyo3/extension-module"]
# maturin lists the root licence files in PKG-INFO but leaves them out of the sdist when
# `manifest-path` points into a workspace, and PyPI rejects an sdist that is missing them.
include = [
{ path = "LICENSE", format = "sdist" },
{ path = "LICENSE-APACHE", format = "sdist" },
{ path = "LICENSE-MIT", format = "sdist" },
]
[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["python"]
[tool.ruff]
line-length = 100
target-version = "py311"
[tool.ruff.format]
# The codebase is single-quoted; the formatter keeps it that way rather than rewriting
# every string literal. `docstring-code-format` also formats the ```python blocks inside
# docstrings, which are what the documentation site renders.
quote-style = "single"
docstring-code-format = true
[tool.ruff.lint]
select = ["ALL"]
ignore = [
# Two pairs where ruff ships both conventions and one has to be picked.
"D203", # incompatible with D211, which is the convention here
"D213", # incompatible with D212, which is the convention here
# Rules the formatter owns. Enabling them makes `ruff check` and `ruff format` disagree.
"COM812", # trailing commas
"ISC001", # implicit string concatenation on one line
"D413", # blank line after the last docstring section: its fix adds a line that
# `docstring-code-format` then removes, so the two never agree
# Project decisions.
"CPY001", # no per-file copyright header; the licence is in the repository root
"TRY003", # a raise carries its own message, and the messages here are long on purpose:
# they name the offending value and say what to do about it. One exception
# subclass per message would bury that.
]
# No `[tool.ruff.lint.pydocstyle] convention`. Setting one silently disables rules, and the
# two that ship would each cost something this project wants: `google` disables `D401`, so
# nothing would hold the docstrings to the imperative mood they are all written in, and
# `pep257` disables `D417`, so a documented function could quietly stop documenting one of
# its parameters. With no convention both are enforced.
[tool.ruff.lint.flake8-quotes]
inline-quotes = "single"
[tool.ruff.lint.isort]
known-first-party = ["yamluna"]
[tool.ruff.lint.per-file-ignores]
# These three modules convert between YAML and arbitrary Python objects. `Any` is the type
# of the thing they hold or hand back, not a placeholder for one nobody wrote down: a
# `CommentedMap` value, a scalar the user assigned, an object handed to the representer.
# Narrower annotations are used wherever one exists.
"python/yamluna/comments.py" = ["ANN401"]
"python/yamluna/constructor.py" = ["ANN401"]
"python/yamluna/representer.py" = ["ANN401"]
# `__slots__` order is the FFI record layout and is read positionally, so sorting the slots
# of `_record.py`'s classes alphabetically is wrong.
"python/yamluna/_record.py" = ["RUF023"]
# Tests: `assert` is the point, reaching into private state is the point, a bare literal in
# an assertion is clearer than a named constant, and a test's name is its documentation.
"tests/**" = [
"S101", "SLF001", "PLR2004", "PT018", "INP001", "T201", "D100", "D101", "D102", "D103",
"D104", "ANN", "PLC0415", "S301", "S311", "ERA001",
]
# The examples are teaching material: they print, they assert, and their trailing
# `# --- real output` blocks are verbatim stdout and are not reflowable.
"examples/**" = ["S101", "T201", "INP001", "E501", "D", "ANN", "ERA001", "PLR2004"]
# Developer tools, run by hand or by CI, not imported by anything.
"bench/**" = ["S101", "T201", "INP001", "D", "ANN", "PLR2004", "S603", "S607"]
"ci/**" = ["S101", "T201", "INP001", "D", "ANN"]
[tool.ty.environment]
python-version = "3.11"
python = ".venv"