Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
159 lines (148 loc) · 6.95 KB
/
Copy pathpyproject.toml
File metadata and controls
159 lines (148 loc) · 6.95 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
[build-system]
requires = ["maturin>=1.0,<2.0"]
build-backend = "maturin"
[project]
name = "dirsql"
# Maturin reads the version from `packages/python/Cargo.toml`'s
# `[package].version` (see `dynamic = ["version"]`). Putitoutthere's
# `write-version` step rewrites that literal before `maturin build` so
# wheels ship at the planned version, not the literal on disk.
dynamic = ["version"]
description = "Ephemeral SQL index over a local directory"
license = "MIT"
requires-python = ">=3.10"
authors = [
{ name = "Kevin Scott" },
]
repository = "https://github.com/thekevinscott/dirsql"
keywords = ["sql", "filesystem", "directory", "sqlite", "index"]
readme = "README.md"
dependencies = [
# The console script runs the CLI in-process through this (#738); without
# it `dirsql.cli.main` cannot import.
"bin-shim>=0.1",
]
# Dev/test dependencies live in a PEP 735 dependency-group (not a
# `[project.optional-dependencies]` extra) so a plain `uv sync` installs them
# by default -- the reusable testing-conventions coverage/mutation jobs run
# `uv sync` with no `--extra`, and our colocated suite needs pytest-describe /
# pytest-asyncio to collect at all. Every in-repo flow is uv-based and now uses
# plain `uv sync`; the old `pip install .[dev]` extra is intentionally dropped.
[dependency-groups]
dev = [
"pytest>=8",
"pytest-describe>=2",
"pytest-asyncio>=0.23",
"pytest-cov>=5",
"ruff==0.16.0",
"maturin>=1.0",
# ty is pre-1.0 -- pin tightly. Re-pin in lockstep with CI.
"ty==0.0.42",
# Real PTY + VT100 for the REPL's interactive e2e cases, which need a
# screen rather than an output stream. Marked because curtaincall declares
# `requires-python >=3.12` against this package's >=3.10 floor; the suite
# skips itself below that (thekevinscott/curtaincall#26).
'curtaincall>=0.3; python_version >= "3.12"',
]
[project.scripts]
dirsql = "dirsql.cli.main:main"
[tool.maturin]
features = ["extension-module"]
# Keep test files out of the built wheel/sdist. `tests/` is the integration
# suite; `**/*_test.py` / `**/test_*.py` are the colocated unit tests that live
# inside the `dirsql/` package and would otherwise ship as package data.
# Enforced by the `packaging` gate (testing-conventions) in CI.
exclude = [
"tests/",
"**/*_test.py",
"**/test_*.py",
]
# `python-source` intentionally unset: the maturin-recommended mixed
# layout (`python-source = "python"`) is unsupported by upstream
# putitoutthere's wheel-content verifier, which compares `stage_to`
# against the literal in-wheel path without subtracting the
# source-root prefix that maturin strips. Filed at
# thekevinscott/putitoutthere; revert this flatten (and re-add
# `python-source = "python"`) once upstream's verifier handles
# python-source stripping.
module-name = "dirsql._dirsql"
# No `dirsql/_binary/*` row any more (#738): the wheel ships no standalone
# binary. The extension module built here carries the CLI (`run_cli`, via
# the core's `cli` feature) and the console script calls it in-process, so
# the wheel holds one copy of the core instead of a `.so` plus a binary.
include = [
{ path = "docs/**/*", format = "sdist" },
]
# Type checking. The source tree currently type-checks clean: the initial
# `# ty: ignore[...]` baseline (seeded by `ty check --add-ignore`) has been
# driven to zero, so any new error in new or touched code fails CI with no
# pre-existing suppressions to hide behind. Every rule is promoted to
# `"error"`, matching TypeScript-strict discipline. Test files are excluded
# because they monkeypatch fakes onto production module attributes
# (`monkeypatch.setattr(async_mod, "_RustDirSQL", ...)`) -- AGENTS.md flags
# that as a smell, ty surfaces it accurately, and the cleanup (constructor
# injection) is tracked separately.
[tool.ty.src]
exclude = [
"**/test_*.py",
"**/*_test.py",
"tests/",
"build/",
"dirsql/_binary/",
]
[tool.ty.environment]
# Tracks `requires-python`: type-check against the FLOOR so a 3.11-only symbol
# (`tomllib`, `StrEnum`, `typing.Self`) fails here rather than at a user's
# import on the oldest supported interpreter.
python-version = "3.10"
# ruff 0.16.0 formats Python code blocks in Markdown by default. Keep ruff
# scoped to Python source (its effective scope under the prior pin): the README
# and the append-only migration/changelog fragments are prose we don't want the
# formatter rewriting.
[tool.ruff]
extend-exclude = ["*.md"]
# Ruff enforces "every type-ignore must cite a rule code" (PGH003) so a
# `# type: ignore` or `# ty: ignore` without `[...]` fails lint. Stops the
# escape hatch from quietly widening.
[tool.ruff.lint]
extend-select = ["PGH003"]
# ruff 0.16.0 turned on a much larger default rule set (413 rules, up from 59).
# The findings below describe production hot-path concerns that do not apply to
# the code they flag; each is silenced at the narrowest scope with the reason.
[tool.ruff.lint.per-file-ignores]
# Test suites open real files and spawn real subprocesses directly. In short,
# synchronous test bodies these async-safety / resource-lifetime rules add no
# safety and would only churn the fixtures:
# SIM115 - transient `open(...)` in a test needs no context manager
# ASYNC230 - a blocking `open` inside an async test is not a latency concern
# ASYNC251 - likewise for a blocking `time.sleep` in an async test
# B017 - a test may legitimately assert that *any* exception is raised
# PLW1510 - subprocess tests inspect `returncode`; `check=` would defeat that
# BLE001 - broad `except` in a test's teardown / assertion helper is fine
# FLY002 - `"".join([...])` here deliberately builds a non-interned string
# so an `is`-vs-`==` mutant survives only if the test uses the
# literal; collapsing to the literal would weaken the mutation test
"**/*_test.py" = ["SIM115", "ASYNC230", "ASYNC251", "B017", "PLW1510", "BLE001", "FLY002"]
# The CLI entry point catches broadly on purpose (any startup failure becomes a
# friendly stderr line + exit 1) and the Windows fallback returns the child's
# exit code directly, with no `check=`.
"dirsql/cli/main.py" = ["BLE001", "PLW1510"]
# Deferred-error pattern: a failed background build is captured and re-raised on
# first use, so the constructor must catch broadly.
"dirsql/_async.py" = ["BLE001"]
# Curated barrel: the public class leads the re-export / `__all__` order rather
# than alphabetical.
"dirsql/__init__.py" = ["I001", "RUF022"]
# Hand-maintained stub mirroring the native module; the `Row` alias and the
# explicit `@override __repr__` document the real surface and stay as written.
"dirsql/_dirsql.pyi" = ["PYI026", "PYI029"]
[tool.coverage.run]
omit = [
# Colocated unit tests live alongside the package source; instrumenting
# them lets a test double's own branches pad the metric (e.g. a fake's
# empty-list return). Exclude test files so the floor reflects only
# library code. Recursive glob so nested packages (e.g.
# `dirsql/cli/`) are covered too.
"**/test_*.py",
"**/*_test.py",
]