python-checks 0.8.0__tar.gz → 0.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_checks-0.8.0 → python_checks-0.9.0}/PKG-INFO +1 -1
- {python_checks-0.8.0 → python_checks-0.9.0}/pyproject.toml +1 -1
- {python_checks-0.8.0 → python_checks-0.9.0}/pyproject.toml.orig +1 -1
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_model_columns.py +40 -2
- {python_checks-0.8.0 → python_checks-0.9.0}/LICENSE +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/README.md +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/_kind.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/_layout.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/_location.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/_names.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/api/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/api/_edge_declarations.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/api/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/calls/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/calls/_confined_functions.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/calls/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_bound_checks.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_confined_calls.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_model_boundary.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_raw_sql.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_schema_drift.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_statement_keys.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/effects/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/effects/_determinism.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/effects/_log_events.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/effects/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/errors/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/errors/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/errors/_refusals.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/hygiene/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/hygiene/_dependency_bounds.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/hygiene/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/imports/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/imports/_confined.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/imports/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/imports/_sealed.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/imports/_statements.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_class_modules.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_class_placement.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_operation_shape.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_required_class.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_function_length.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_functions.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_keyword_only.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_module_length.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_nesting.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_signature_layout.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_annotation_shapes.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_config_fields.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_confined_types.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_constant_annotations.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_frozen_dataclasses.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_marker.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/_app.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/_protocols.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/commands/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/commands/_doctor.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/commands/_explain.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/commands/_list.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/commands/_mutation.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/commands/_run.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/commands/_summary.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/cli/commands/_sync.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/config/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/config/_base.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/config/_config.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/config/_constants.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/config/_errors.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/config/_loader.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/config/_toml.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/contracts/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/contracts/_constants.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/contracts/_layout.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/contracts/_render.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/contracts/_settings.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_constants.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_discovery.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_edit.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_errors.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_fixer.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_format.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_markers.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_paths.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_protocols.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_registry.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_report.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_runner.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_settings.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_source.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/core/_violation.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/environment/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/environment/_constants.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/environment/_render.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/environment/_settings.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/_baseline.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/_constants.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/_errors.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/_gate.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/_mutmut.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/_process.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/_scope.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/mutation/_settings.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/py.typed +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/sync/__init__.py +0 -0
- {python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/sync/_sync.py +0 -0
|
@@ -21,6 +21,8 @@ CODE: Final = "model-columns"
|
|
|
21
21
|
MAPPED: Final = "Mapped"
|
|
22
22
|
AWARE: Final = "timezone"
|
|
23
23
|
NULLABLE: Final = "nullable"
|
|
24
|
+
RELATIONSHIP: Final = "relationship"
|
|
25
|
+
LAZY: Final = "lazy"
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
class ModelColumnsSettings(ZonedSettings):
|
|
@@ -31,12 +33,13 @@ class ModelColumnsSettings(ZonedSettings):
|
|
|
31
33
|
skip: tuple[str, ...] = ()
|
|
32
34
|
aware: tuple[str, ...] = ()
|
|
33
35
|
nullable: bool = True
|
|
36
|
+
lazy: tuple[str, ...] = ()
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
class ModelColumns:
|
|
37
40
|
"""Fails if a column is built out of the wrong material.
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
Six rules on one table of settings.
|
|
40
43
|
|
|
41
44
|
`instead` is the material that has no place in a column, and what to write
|
|
42
45
|
instead. A bare `Enum` is a native Postgres type: every new member needs an
|
|
@@ -66,8 +69,15 @@ class ModelColumns:
|
|
|
66
69
|
diverge, and then the annotation lies: pyright reasons by it, the database
|
|
67
70
|
holds the keyword, and one of the two is wrong on every row.
|
|
68
71
|
|
|
72
|
+
`lazy` lists the loaders a `relationship()` may name. Under asyncio an
|
|
73
|
+
implicit load cannot run: touching an unloaded relationship raises
|
|
74
|
+
`MissingGreenlet` far from the query, and where it happens to work it is
|
|
75
|
+
one query per row. `lazy="raise"` makes the query say what it loads, with
|
|
76
|
+
`selectinload` or `joinedload`. A value the file does not show is reported
|
|
77
|
+
too: a loader nobody can read is not one anybody chose.
|
|
78
|
+
|
|
69
79
|
Settings: `zones`, `factories`, `instead`, `wrappers`, `defaults`, `skip`,
|
|
70
|
-
`aware`, `nullable`.
|
|
80
|
+
`aware`, `nullable`, `lazy`.
|
|
71
81
|
"""
|
|
72
82
|
|
|
73
83
|
code: ClassVar[str] = CODE
|
|
@@ -134,6 +144,12 @@ class ModelColumns:
|
|
|
134
144
|
f"{written} without timezone=True stores a naive timestamp; say timezone=True"
|
|
135
145
|
),
|
|
136
146
|
)
|
|
147
|
+
if written == RELATIONSHIP and limits.lazy:
|
|
148
|
+
yield from cls._loaded(
|
|
149
|
+
file=file,
|
|
150
|
+
node=node,
|
|
151
|
+
allowed=limits.lazy,
|
|
152
|
+
)
|
|
137
153
|
if written not in limits.factories:
|
|
138
154
|
return
|
|
139
155
|
for keyword in node.keywords:
|
|
@@ -147,6 +163,28 @@ class ModelColumns:
|
|
|
147
163
|
),
|
|
148
164
|
)
|
|
149
165
|
|
|
166
|
+
@classmethod
|
|
167
|
+
def _loaded(
|
|
168
|
+
cls,
|
|
169
|
+
*,
|
|
170
|
+
file: ParsedFile,
|
|
171
|
+
node: ast.Call,
|
|
172
|
+
allowed: tuple[str, ...],
|
|
173
|
+
) -> Iterator[Violation]:
|
|
174
|
+
"""A relationship that loads behind the query's back."""
|
|
175
|
+
written = next((keyword.value for keyword in node.keywords if keyword.arg == LAZY), None)
|
|
176
|
+
if isinstance(written, ast.Constant) and written.value in allowed:
|
|
177
|
+
return
|
|
178
|
+
said = "without lazy=" if written is None else f"with lazy={ast.unparse(written)}"
|
|
179
|
+
yield cls._says(
|
|
180
|
+
file=file,
|
|
181
|
+
node=node,
|
|
182
|
+
message=(
|
|
183
|
+
f"relationship() {said} loads without the query saying so; "
|
|
184
|
+
f"say lazy={allowed[0]!r} and load it at the query"
|
|
185
|
+
),
|
|
186
|
+
)
|
|
187
|
+
|
|
150
188
|
@classmethod
|
|
151
189
|
def _annotation(
|
|
152
190
|
cls,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/calls/_confined_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_confined_calls.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_model_boundary.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/database/_statement_keys.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/hygiene/_dependency_bounds.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_class_modules.py
RENAMED
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_class_placement.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_operation_shape.py
RENAMED
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/placement/_required_class.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_function_length.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_keyword_only.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_module_length.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/signatures/_signature_layout.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_annotation_shapes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_constant_annotations.py
RENAMED
|
File without changes
|
{python_checks-0.8.0 → python_checks-0.9.0}/src/py_checks/checks/types/_frozen_dataclasses.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|