-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpyproject.toml
More file actions
221 lines (204 loc) · 7.78 KB
/
Copy pathpyproject.toml
File metadata and controls
221 lines (204 loc) · 7.78 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
[project]
name = "starhtml"
version = "0.7.0"
description = "Modern HTML generation in Python, inspired by FastHTML"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
# Core (Pyodide/WASM compatible)
"starlette~=1.0",
"httpx",
"beautifulsoup4",
"python-dateutil",
"fastcore",
"oauthlib",
"itsdangerous",
"python-multipart>=0.0.20",
# Server (not needed for WASM, but included for normal usage)
"uvicorn[standard]",
"starlette-compress>=1.0.0",
"rjsmin>=1.2.4",
"fastlite",
]
[project.scripts]
starhtml = "starhtml.icons:main"
[project.optional-dependencies]
test = [
"pytest",
"pytest-cov>=6.1.1",
"pytest-timeout",
"pytest-xdist",
"pytest-watch",
"pytest-asyncio",
"requests>=2.32.4",
]
dev = [
"ipykernel",
"pip-tools",
"ruff",
"pyright",
"psutil",
"brotli>=1.1.0",
]
debug = ["starelements>=0.1.1"]
demo = ["starlighter", "starelements>=0.1.1", "star-drawing>=0.1.0"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.hooks.custom]
path = "scripts/hatch_build_hook.py"
[tool.hatch.build.targets.wheel]
packages = ["src/starhtml"]
# Include only built JavaScript and static assets in the package (exclude TypeScript sources)
include = [
"src/starhtml/static/**/*.js",
"src/starhtml/static/**/*.json",
"src/starhtml/static/**/*.css",
"src/starhtml/**/*.py",
"src/starhtml/**/*.pyi",
"src/starhtml/py.typed",
]
# Build artifacts (JavaScript handlers) will be added dynamically by the build hook
artifacts = []
# Exclude development files from the package
exclude = [
"typescript/",
"package.json",
"package-lock.json",
"bun.lockb",
"tsconfig.json",
"node_modules/",
]
[tool.hatch.build.targets.sdist]
# Keep rebuildable source inputs such as TypeScript, but do not ship the
# project test suite in the source distribution.
exclude = [
"/tests",
"/dist",
"/node_modules",
]
[tool.pytest.ini_options]
minversion = "7.0"
addopts = [
"--verbose",
"--strict-markers",
"--strict-config",
]
testpaths = ["tests"]
pythonpath = ["src", "."]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"asyncio: marks tests as asyncio tests",
]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::PendingDeprecationWarning",
]
[tool.coverage.run]
source = ["src/starhtml"]
omit = ["*/tests/*", "*/test_*.py"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if __name__ == .__main__.:",
"raise NotImplementedError",
"pass",
"except ImportError:",
]
[tool.ruff]
line-length = 120
target-version = "py312"
src = ["src", "tests", "web"]
exclude = []
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # flake8-bugbear
"C90", # mccabe complexity
"PL", # pylint
]
ignore = [
"E501", # Line length
"E701", # Multiple statements on one line - StarHTML uses concise style
"W293", # Blank line contains whitespace
"PLR0913", # Too many arguments
"F403", # Star imports - allowed for StarHTML demos
"F405", # May be undefined from star imports
"N802", # Function names should be lowercase - HTML components need capitals
"C901", # Complex structure - acceptable for web framework core functions
"PLR0912", # Too many branches - acceptable for framework parameter resolution
"N807", # Dunder function names - valid magic methods being flagged incorrectly
"PLW2901", # Redefined loop name - intentional data transformation in framework code
]
[tool.ruff.lint.per-file-ignores]
"web/*.py" = ["F403", "F405", "PLR2004", "N802", "PLW0603", "N803", "B007", "N999", "E402", "F841", "PLW0602", "PLC0415"] # Allow star imports, magic values, capitalized function names, global statements, argument naming, unused loop vars, numbered filenames, imports after code, unused variables, global reads, and lazy imports in web demos
"tests/*.py" = ["F403", "F405", "PLR2004", "N806", "F841", "PLC0415"] # Allow star imports, magic values, constant naming, unused variables, and lazy imports in tests (test patterns)
"scripts/*.py" = ["PLR2004"] # Allow magic values in utility scripts
"src/starhtml/svg.py" = ["N802", "N803", "N806"] # Allow capitalized function names for SVG elements
"src/starhtml/js.py" = ["N802"] # Allow capitalized function names for JS components
"src/starhtml/icons.py" = ["PLC0415", "PLR2004", "N802", "PLW0603"] # Allow lazy imports, magic values, capitalized Icon function, and global _project_root
"src/starhtml/plugins.py" = ["PLC0415"] # Allow lazy imports to avoid circular dependencies
"src/starhtml/datastar.py" = ["B904", "PLR2004", "PLR0911", "PLR0915", "PLC0415", "PLW1641"] # Allow datastar patterns, multiple returns, many statements, lazy imports, and ABC without __hash__
"src/starhtml/handlers.py" = ["PLC0415"] # Allow lazy imports for optional dependencies
"src/starhtml/live_reload.py" = ["N802"] # Allow capitalized function names
"src/starhtml/oauth.py" = ["C901"] # Allow complexity in OAuth
"src/starhtml/__init__.py" = ["F401", "PLC0414"] # Allow unused imports and X-as-X re-export aliases in __init__
"src/starhtml/starapp.py" = ["PLC0415"] # Allow lazy imports to avoid circular dependencies
"src/starhtml/tags.py" = ["N803", "N806", "E743", "PLE0604", "PLC0415"] # Allow SVG naming conventions, ambiguous function names, __all__ patterns, and lazy imports
"src/starhtml/tags.pyi" = ["E743", "N803"] # Allow ambiguous I function and camelCase SVG attrs like viewBox
"src/starhtml/types.py" = [] # Type definitions file
"src/starhtml/realtime.py" = ["PLR0911", "PLR2004", "PLC0415"] # Allow complexity, magic values, and lazy imports to avoid circular dependencies
"src/starhtml/server.py" = ["PLR0911", "N801", "PLW1508", "PLR0915", "PLC0415"] # Allow complexity, internal class naming, env var patterns, many statements, and lazy imports
"src/starhtml/utils.py" = ["N813", "E721", "PLC0415"] # Allow CamelCase imports, type comparisons, and lazy imports
"src/starhtml/xtend.py" = ["N802", "UP031", "F811", "PLC0415"] # Allow capitalized function names, % formatting, Path redefinition, and lazy imports
"src/starhtml/core.py" = ["N813", "E721", "B904", "C901", "PLR0911", "PLR0912", "N802", "E402", "PLR2004", "N801", "F811", "PLR0915", "PLC0415"] # Allow various patterns needed for StarHTML framework, including complex init and lazy imports
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
[tool.pyright]
include = ["src", "tests", "web"]
exclude = ["**/node_modules", "**/__pycache__", "**/.venv", "**/build", "**/dist"]
pythonVersion = "3.12"
pythonPlatform = "All"
typeCheckingMode = "standard"
reportMissingImports = false
reportMissingTypeStubs = false
reportPrivateImportUsage = false
reportUnusedImport = false
reportUnusedClass = true
reportUnusedFunction = false
reportUnusedVariable = false
reportDuplicateImport = true
reportWildcardImportFromLibrary = false
reportOptionalMemberAccess = false
reportOptionalCall = false
reportOptionalIterable = true
reportOptionalContextManager = true
reportOptionalOperand = true
reportTypedDictNotRequiredAccess = true
reportUnnecessaryCast = true
reportUnnecessaryComparison = false
reportUnnecessaryContains = false
reportAssertAlwaysTrue = true
reportUnnecessaryTypeIgnoreComment = false
reportImplicitOverride = false
reportShadowedImports = true
reportUndefinedVariable = false
reportCallIssue = false
reportArgumentType = false
[dependency-groups]
dev = [
"psutil>=7.0.0",
"pytest-asyncio>=1.1.0",
"pytest-cov>=6.1.1",
"python-multipart>=0.0.20",
]