-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
128 lines (120 loc) · 4.86 KB
/
Copy pathpyproject.toml
File metadata and controls
128 lines (120 loc) · 4.86 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
[project]
name = "simple-module-python"
version = "0.1.0"
description = "A modular monolith framework for Python using FastAPI, Inertia.js, and React"
requires-python = ">=3.12"
dependencies = []
[tool.uv.workspace]
members = [
"framework/*",
"modules/*",
"host",
]
[dependency-groups]
dev = [
"pytest>=8.0",
"pytest-asyncio>=0.24",
"pytest-benchmark>=4.0",
"httpx>=0.27",
"ruff>=0.8",
"playwright>=1.58.0",
"pytest-playwright>=0.7.2",
"ty>=0.0.29",
"memray>=1.14; sys_platform != 'win32'",
"locust>=2.31",
"faker>=30",
"aioboto3>=13",
"moto[s3]>=5",
"tomlkit>=0.13",
"pytest-httpx>=0.36.2",
# Test-only: builds real brotli payloads for the pre-compressed static-file
# tests. The build itself compresses with Node's zlib, so nothing at runtime
# needs this. Declared explicitly because it was otherwise only present as a
# transitive dep of locust's geventhttpclient.
"brotli>=1.1",
]
[tool.ruff]
line-length = 100
target-version = "py312"
# Scaffold templates are copied verbatim (and some live under __PACKAGE__/
# placeholder dirs that aren't valid Python packages until substituted).
extend-exclude = ["framework/cli/simple_module_cli/templates"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors (PEP 8)
"W", # pycodestyle warnings (PEP 8)
"F", # pyflakes
"I", # isort
"N", # PEP 8 naming
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"C4", # flake8-comprehensions
"RET", # flake8-return
"PTH", # flake8-use-pathlib
"PIE", # flake8-pie
"RUF", # ruff-specific rules
]
ignore = [
"B008", # Depends() in default args is idiomatic FastAPI
"B027", # Empty methods in ABC without @abstractmethod — used for optional hooks
]
[tool.ty.environment]
extra-paths = [
"framework/core",
"framework/db",
"framework/hosting",
"framework/testing",
"modules/auth",
"modules/dashboard",
"modules/users",
"modules/permissions",
"modules/background_tasks",
"modules/file_storage",
"modules/settings",
"modules/feature_flags",
"modules/keycloak",
"modules/audit_log",
"modules/site_lock",
"modules/branding",
"host",
"scripts",
]
[tool.ty.src]
# Host scaffold templates are copied verbatim; they aren't imported, so
# type-checking them against this repo's alembic version is misleading.
exclude = ["framework/hosting/simple_module_hosting/templates/**"]
[tool.ty.rules]
# SQLModel declares fields with plain Python types (``str``, ``int``, ``bool``)
# even though at runtime they become SQLAlchemy ``InstrumentedAttribute``s
# that support ``.is_()``, ``.in_()``, ``.ilike()``, ``==``, etc. ty can't see
# through this, so query-construction expressions like
# ``select(Product).where(Product.id == x)`` and ``Role.name.in_(names)``
# trigger false positives in every service / endpoint / test that uses the ORM.
# Downgrading these rules trades a known SQLModel typing limitation for a
# clean lint baseline. Real bugs caught by these rules surface in tests.
unresolved-attribute = "ignore"
unsupported-operator = "ignore"
unknown-argument = "ignore"
no-matching-overload = "ignore"
# ``invalid-argument-type`` covers two distinct things:
# 1. Real bugs (e.g. passing ``float`` where ``Decimal`` is required) — useful.
# 2. SQLAlchemy ``where()`` / ``select()`` / ``selectinload()`` complaints when
# passed SQLModel field expressions — false positives.
# The false positives massively outnumber the real bugs and the latter still
# get caught at runtime by tests, so we ignore the rule globally.
invalid-argument-type = "ignore"
# SQLModel's ``model_config = ConfigDict(...)`` clashes with the internal
# ``SQLModelConfig`` type in newer ty versions. Same root cause as above.
invalid-assignment = "ignore"
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["framework/cli/tests", "framework/core/tests", "framework/db/tests", "framework/hosting/tests", "framework/testing/tests", "host/tests", "modules/auth/tests", "modules/dashboard/tests", "modules/users/tests", "modules/permissions/tests", "modules/background_tasks/tests", "modules/file_storage/tests", "modules/settings/tests", "modules/feature_flags/tests", "modules/keycloak/tests", "modules/audit_log/tests", "modules/branding/tests", "modules/site_lock/tests", "scripts/tests", "tests/integration", "tests/e2e", "tests/benchmarks", "tests/perf"]
markers = [
"e2e: end-to-end tests requiring a live browser",
"perf: performance benchmarks (opt-in; run via `make bench`)",
]
# --durations=20 prints the 20 slowest tests after every run so slow fixtures
# (e.g. function-scoped ``app`` rebuilds) surface without needing an opt-in flag.
# Benchmarks are opt-in — they run under `make bench`, not the default suite.
addopts = "-m 'not e2e and not perf' --durations=20 --benchmark-disable"