Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ All notable changes to this project are documented in this file. The format is b

## [Unreleased]

### Changed

- The development type checker and scaffolded apps now use ty 0.0.100. Their configuration uses its renamed attribute rules while preserving the existing SQLModel suppressions; generated apps pin the tested 0.0.100 series (#894).

### Added

- `users`: `oauth_microsoft_discovery_url` points Microsoft sign-in at a local IdP through its discovery document, honoured only when `SM_ENVIRONMENT` is explicitly development or testing (unset does not count; anywhere else it is ignored and `users.oauth.microsoft_discovery_ignored` is logged). `docs/examples/keycloak-entra-realm.json` is a Keycloak realm with Entra-shaped claims (`tid`, `oid`, `upn`) for clicking through the flow before an Entra app exists. `simple_module_test` gains `OidcTestIssuer` and the `oidc_test_issuer` fixture (RSA key, JWKS, discovery document, `sign(claims)`) for testing an OpenID Connect sign-in without an IdP (#879).
Expand Down
5 changes: 2 additions & 3 deletions framework/cli/simple_module_cli/_lint_tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

from __future__ import annotations

# ty is pre-1.0 and renames rules between releases (0.0.100 renamed
# ``unresolved-attribute``, which the scaffold's ``[tool.ty.rules]`` names), so
# ty is pre-1.0 and renames rules between releases, so
# new apps get the range this repo is tested on, not the newest ty.
# ``test_scaffold_lint_tooling.py`` fails once ``uv.lock`` moves past it.
TY_REQUIREMENT = "ty>=0.0.90,<0.0.100"
TY_REQUIREMENT = "ty>=0.0.100,<0.0.101"

# Apps turn ty's ``invalid-assignment`` off, so this ignore would be reported as
# unused there; only a module inside the framework repo, which checks the rule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ ignore = [
# see through this, so ORM query expressions trip these rules with false
# positives — real bugs still surface in tests.
[tool.ty.rules]
unresolved-attribute = "ignore"
missing-attribute = "ignore"
missing-union-attribute = "ignore"
unsupported-operator = "ignore"
unknown-argument = "ignore"
no-matching-overload = "ignore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ ignore = [
# see through this, so ORM query expressions trip these rules with false
# positives — real bugs still surface in tests.
[tool.ty.rules]
unresolved-attribute = "ignore"
missing-attribute = "ignore"
missing-union-attribute = "ignore"
unsupported-operator = "ignore"
unknown-argument = "ignore"
no-matching-overload = "ignore"
Expand Down
3 changes: 2 additions & 1 deletion framework/cli/tests/test_cli_new_scaffold_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ def test_sm_new_root_pyproject_has_dev_tooling_and_config(tmp_path: Path) -> Non
assert any(d.startswith("simple_module_test==") for d in dev)
assert data["tool"]["pytest"]["ini_options"]["asyncio_mode"] == "auto"
assert data["tool"]["ruff"]["line-length"] == 100
assert "unresolved-attribute" in data["tool"]["ty"]["rules"]
assert data["tool"]["ty"]["rules"]["missing-attribute"] == "ignore"
assert data["tool"]["ty"]["rules"]["missing-union-attribute"] == "ignore"


def test_sm_new_generated_app_passes_its_own_ruff(tmp_path: Path) -> None:
Expand Down
2 changes: 1 addition & 1 deletion framework/core/simple_module_core/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def init(self: Any, *args: Any, **kwargs: Any) -> None:
entry.warn(stacklevel=2)
original_init(self, *args, **kwargs)

obj.__init__ = init # ty: ignore[invalid-assignment]
obj.__init__ = init
return obj

@functools.wraps(cast("Callable[..., Any]", obj))
Expand Down
2 changes: 1 addition & 1 deletion framework/hosting/simple_module_hosting/_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@ def openapi() -> dict:
assert app.openapi_schema is not None
return app.openapi_schema

app.openapi = openapi # ty: ignore[invalid-assignment]
app.openapi = openapi
2 changes: 1 addition & 1 deletion framework/hosting/simple_module_hosting/_route_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def guard_included_routers(app: FastAPI, *, warm: bool = True) -> None:
if isinstance(route, _IncludedRouter) and not isinstance(route.matches, _PrefixGuard):
guard = _PrefixGuard(route)
guard._current_prefix()
route.matches = guard # ty: ignore[invalid-assignment]
route.matches = guard
if warm:
for _ in route.effective_route_contexts():
pass
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
kwargs.setdefault("task_cls", TenantTask)
super().__init__(*args, **kwargs)

def _task_from_fun( # ty: ignore[invalid-method-override]
def _task_from_fun( # ty: ignore[incompatible-method-override]
self,
fun: Any,
name: Any = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def test_env_overrides_bad_json_or_shape_is_ignored(monkeypatch, caplog) -> None
def test_celery_overrides_is_not_a_db_backed_setting(monkeypatch) -> None:
assert "celery_overrides" not in BackgroundTasksSettings.model_fields
# A stored/hydrated value is ignored, not applied.
s = BackgroundTasksSettings(celery_overrides={"task_serializer": "pickle"}) # pyright: ignore
s = BackgroundTasksSettings( # ty: ignore[pydantic-discarded-extra-argument]
celery_overrides={"task_serializer": "pickle"}
)
assert not hasattr(s, "celery_overrides")
monkeypatch.setattr(celery_app, "_discover_task_packages", list)
c = celery_app.build_celery(BackgroundTasksSettings(task_always_eager=True))
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ exclude = ["framework/hosting/simple_module_hosting/templates/**"]
# 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"
missing-attribute = "ignore"
missing-union-attribute = "ignore"
unsupported-operator = "ignore"
unknown-argument = "ignore"
no-matching-overload = "ignore"
Expand Down
2 changes: 1 addition & 1 deletion skills/simple-module-conventions/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Locale-related diagnostics: SM013 (missing file), SM014 (missing keys vs default

### 9. Don't re-enable the silenced ty rules

Projects using the `ty` type checker should globally suppress `unresolved-attribute`, `unsupported-operator`, `unknown-argument`, `no-matching-overload`, `invalid-argument-type`, and `invalid-assignment` in `pyproject.toml`. SQLModel runtime-instruments fields as SQLAlchemy attributes, so the type checker can't see what's there (and `model_config = ConfigDict(...)` clashes with ty's internal `SQLModelConfig` type, which `invalid-assignment` covers). Real bugs surface in tests. Line-level suppressions use ty's rule names, `# ty: ignore[<rule>]`; a mypy-style `# type: ignore[arg-type]` silences nothing under ty.
Projects using `ty` 0.0.100 should globally suppress `missing-attribute`, `missing-union-attribute`, `unsupported-operator`, `unknown-argument`, `no-matching-overload`, `invalid-argument-type`, and `invalid-assignment` in `pyproject.toml`. SQLModel runtime-instruments fields as SQLAlchemy attributes, so the type checker can't see what's there (and `model_config = ConfigDict(...)` clashes with ty's internal `SQLModelConfig` type, which `invalid-assignment` covers). Real bugs surface in tests. Line-level suppressions use ty's rule names, `# ty: ignore[<rule>]`; a mypy-style `# type: ignore[arg-type]` silences nothing under ty.

### 10. Declare external asset origins with `register_csp_sources`

Expand Down
42 changes: 21 additions & 21 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading