Repository navigation
Type-check and ship types for cdc/ai/sqlalchemy/django - #12
Merged
Merged
Conversation
The four secondary packages shipped no py.typed marker and were excluded
from the strict mypy gate in CI, so consumers got no types for them.
- Add py.typed to cockroachdb-{cdc,ai,sqlalchemy,django}; hatchling's
packages=["src/cockroachdb"] auto-includes it in the wheel (no
pyproject change needed, matching the existing four packages).
- Extend the ci.yml mypy invocation to cover the four /src dirs.
- Fix real strict violations surfaced by the newly-gated source:
missing annotations, generic type args (TypeEngine[Any], dict[str, Any],
list[Any]), and Any returns. Notably: core RegionContext had no reset()
classmethod though sqla RegionalSession.execute() called it (latent
AttributeError); added it. events.py now re-exports Region/FollowerRead
contexts via __all__.
- Add a narrow [[tool.mypy.overrides]] ignore_missing_imports for django.*
only (Django ships no py.typed); strictness is unchanged elsewhere.
mypy (61 files), ruff, and pytest (590 passed) all green locally.
- cockroachdb-core 0.2.0 -> 0.3.0 (public RegionContext.reset()) - cockroachdb-sqlalchemy 0.2.0 -> 0.3.0 - cockroachdb-django 0.2.0 -> 0.3.0 - cockroachdb-cdc 0.1.1 -> 0.2.0 - cockroachdb-ai 0.1.2 -> 0.2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes the type-safety gap for the four secondary packages (
cockroachdb-cdc,cockroachdb-ai,cockroachdb-sqlalchemy,cockroachdb-django), which previously shipped nopy.typedmarker and were excluded from the strict mypy gate in CI — so downstream consumers got no types for them.Changes
py.typedmarkers added to all four packages (src/cockroachdb/{cdc,ai,sqla,django}/py.typed). Hatchling'spackages = ["src/cockroachdb"]auto-includes the marker in the wheel (verified by building the django wheel) — nopyproject.tomlchange needed, matching the existing four typed packages.uv run mypy ...invocation in.github/workflows/ci.ymlto also check the four/srcdirs.TypeEngine[Any],dict[str, Any],list[Any]), and fixedAnyreturns.RegionContexthadset()but noreset()classmethod, yetsqlaRegionalSession.execute()calledRegionContext.reset(token)in itsfinally— a runtimeAttributeError. Addedreset().sqla/events.pynow re-exportsRegionContext/FollowerReadContextvia__all__(strictno_implicit_reexport).[[tool.mypy.overrides]] module = ["django.*"] ignore_missing_imports = true— Django ships nopy.typedand no bundled stubs. Scoped todjango.*only; strictness is unchanged everywhere else. Framework-override signature/miscfrictions (SQLAlchemy/Django base classes) use targeted per-line# type: ignore[...].Verification (local)
mypystrict over all 8 package/srcdirs: Success, 61 filesruff format --check+ruff check: cleanpytest: 590 passed, 3 skippedNo version bumps (lead handles release).