-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
205 lines (179 loc) · 6.5 KB
/
Copy pathpyproject.toml
File metadata and controls
205 lines (179 loc) · 6.5 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
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "kida-templates"
version = "0.12.0"
description = "Pure-Python server-side components with typed props, named slots, and static validation"
readme = "README.md"
requires-python = ">=3.14"
license = "MIT"
keywords = ["server-components", "python-components", "typed-props", "slots", "component-framework", "template-engine", "jinja2-alternative", "html-components", "markdown", "terminal", "ci-reports", "github-actions", "streaming", "free-threading"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.14",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries",
"Topic :: Text Processing :: Markup :: HTML",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: User Interfaces",
"Typing :: Typed",
]
dependencies = [] # Pure Python, zero runtime dependencies
[project.optional-dependencies]
docs = [
"bengal>=0.3.2",
]
perf = ["markupsafe"]
[project.scripts]
kida = "kida.cli:main"
[project.entry-points."babel.extractors"]
kida = "kida.babel:extract"
[project.urls]
Homepage = "https://lbliii.github.io/kida/"
Documentation = "https://lbliii.github.io/kida/"
Repository = "https://github.com/lbliii/kida"
Changelog = "https://github.com/lbliii/kida/blob/main/CHANGELOG.md"
[tool.setuptools.packages.find]
where = ["src"]
[tool.pytest.ini_options]
testpaths = ["tests", "examples"]
pythonpath = ["src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
python_files = ["test_*.py"]
python_functions = ["test_*"]
[tool.coverage.run]
source = ["kida"]
branch = true
[tool.coverage.report]
show_missing = true
skip_covered = true
precision = 1
fail_under = 80
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
"@overload",
]
[tool.ty.environment]
python-version = "3.14"
[tool.ty.src]
exclude = ["dist/", "build/", "benchmarks/", "tests/", "examples/"]
# Safe-string classes (Markup, Styled, Marked) intentionally return Self
# instead of str. This technically violates LSP but is the correct pattern
# for safe-string wrappers (like MarkupSafe).
[[tool.ty.overrides]]
include = ["src/kida/utils/html.py", "src/kida/utils/terminal_escape.py", "src/kida/utils/markdown_escape.py"]
[tool.ty.overrides.rules]
invalid-method-override = "ignore"
# Optional framework integrations (not installed in minimal dev env).
[[tool.ty.overrides]]
include = ["src/kida/contrib/flask.py", "src/kida/contrib/starlette.py"]
[tool.ty.overrides.rules]
unresolved-import = "ignore"
# Optional wcwidth (wider than Unicode East Asian width in stdlib).
[[tool.ty.overrides]]
include = ["src/kida/environment/terminal.py", "src/kida/utils/ansi_width.py"]
[tool.ty.overrides.rules]
unresolved-import = "ignore"
[tool.ruff]
line-length = 100
target-version = "py314"
[tool.ruff.lint]
# Enable Python upgrade rules and other quality checks
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes (unused imports, variables, etc.)
"UP", # pyupgrade - Python modernization
"B", # flake8-bugbear - common bugs
"SIM", # flake8-simplify - simplify code
"I", # isort - import sorting
"N", # pep8-naming
"PIE", # misc lints (unnecessary pass, duplicate dict keys, etc.)
"PERF", # perflint - performance anti-patterns
"C4", # unnecessary comprehensions/list()/dict() calls
"RUF", # Ruff-specific (unused noqa, mutable class defaults, etc.)
"TCH", # flake8-type-checking - imports behind TYPE_CHECKING
"SLOT", # flake8-slots - enforce __slots__
"FURB", # refurb - modern Python idioms
"T20", # flake8-print - no print() in library code
"PTH", # flake8-pathlib - pathlib over os.path
"S110", # flake8-bandit - flag except: pass (silent exception swallowing)
"S112", # flake8-bandit - flag except: continue (silent exception swallowing in loops)
]
ignore = ["E501"] # Line length handled by formatter
# Per-file ignore rules
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"] # Allow unused imports in __init__ files
"tests/**/*.py" = ["S101", "S110", "S112", "T201", "TC003"] # Allow assert, print, except: pass, except: continue, and runtime stdlib imports in tests
"src/kida/cli.py" = ["T201"] # CLI legitimately uses print()
"src/kida/environment/filters/_debug.py" = ["T201"] # Debug filter uses print()
"benchmarks/**/*.py" = ["T201"] # Benchmarks legitimately use print()
"examples/**/*.py" = ["T201"] # Examples legitimately use print()
"scripts/**/*.py" = ["T201", "PTH"] # Scripts legitimately use print() and os.path
[dependency-groups]
dev = [
# Testing
"pytest>=8.0",
"pytest-asyncio>=0.23",
"pytest-cov>=4.0",
"pytest-benchmark>=4.0.0",
"pytest-xdist>=3.3.0",
"pytest-timeout>=2.3.0", # Prevent hung tests
"hypothesis>=6.100.0", # Property-based testing
"jinja2>=3.1.6,<3.2",
"milo-cli>=0.2.1", # Saga benchmarks + examples (dev-only)
# Optional framework contracts/examples (dev-only; runtime stays dependency-free)
"flask>=3.1.3,<3.2",
"django>=6.0.6,<6.1",
"fastapi>=0.139,<0.140",
"starlette>=1.3.1,<1.4",
"httpx>=0.28.1,<0.29",
"uvicorn>=0.50.2,<0.51",
# Linting & Type Checking
"ty>=0.0.11", # Astral type checker (Rust-based)
"ruff>=0.15.1", # 0.15.1+ fixes except-parenthesis bug (PEP 758 + as clause)
# Pre-commit (optional, for local dev)
"pre-commit>=4.0.0",
# Changelog
"towncrier>=24.0",
]
docs = ["bengal>=0.3.2"]
# ── Towncrier (changelog management) ──────────────────────────────────
[tool.towncrier]
directory = "changelog.d"
filename = "CHANGELOG.md"
package = "kida"
package_dir = "src"
start_string = "## [Unreleased]\n"
title_format = "## [{version}] - {project_date}"
issue_format = "`#{issue}`"
underlines = ["", "", ""]
[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true
[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true
[[tool.towncrier.type]]
directory = "deprecated"
name = "Deprecated"
showcontent = true
[[tool.towncrier.type]]
directory = "removed"
name = "Removed"
showcontent = true
[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true
[[tool.towncrier.type]]
directory = "security"
name = "Security"
showcontent = true