Conversation
ruff 0.16.7 with select = ["ALL"] minus justified ignores, line length 100 and Google docstrings; mypy 2.3.1 strict over permit/, tests/ and .github/scripts on both pydantic majors, with TYPE_CHECKING branches so the v1 models type-check as v1 under pydantic 2. ruff, mypy and typos run as local pre-commit hooks from uv.lock (uv run --locked), external hooks are SHA-pinned, pytest runs strict with warnings as errors, and Dependabot covers pre-commit with lint tools grouped apart from runtime floors. No public API or behaviour change; runtime-visible aliases, bare-dict fields and the star-import surface are kept identical. Three bugs the stricter checks exposed are fixed with regression tests: decimal_encoder crashed on NaN/Infinity, a pre-release pydantic version crashed import permit, and import permit raised under -W error because PermitConnectionError subclasses the deprecated PermitException. py.typed is deliberately not shipped yet (PER-16231). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
This branch has not been deployed
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.
Linear issue
PER-16222. Stacked on #127 (uv migration), which is stacked on #126.
Why
This is a public SDK. It was linted by ruff 0.6.9 with
pyupgradedisabled, and type-checked by a non-strict mypy 1.11.2.uv.lockwere not the ones that actually ran.What changed
Tooling
select = ["ALL"], line length 100, Google docstring convention anddocstring-code-format. Every ignore has a one-line justification inpyproject.toml. The generatedpermit/api/models.pystays out of lint and format (force-exclude).strict, pluswarn_unreachableand 11 extra error codes, overpermit/,tests/and.github/scripts/. It runs under both pydantic majors with thepydantic.v1.mypyplugin.repo: localhooks runninguv run --locked, souv.lockis the only source of their versions and a stale lock fails loudly.pyproject.tomloruv.lockchanges.pre-commit-hooksv6.0.0 anduv-pre-commitare pinned by SHA.check-shebang-scripts-are-executableis added.pre-commit.ymlrunsuv sync --locked, then the hooks, then mypy again on the pydantic-v1 lane.strict = trueandfilterwarnings = ["error"].pre-commitecosystem entry. ruff, mypy and typos get their own group, so a lint-rule break can't hold up runtime floor bumps.Code
if TYPE_CHECKING:branches importpydantic.v1at the 28 version-conditional import sites. The runtime branches are verbatim.ParamSpecon the SDK's decorators and@overloadondelete().permit/__init__.py.test_envs, and a reused variable whosefinallyblock would have crashed and hidden the real failure.Context,AuthorizedUsersDict,IncEx,User,Resource), bare-dictpydantic fields anddeep_merge's key access are deliberately kept identical, each with a justified suppression.dir(permit)and thefrom permit import *names are identical to Migrate packaging, dependencies and CI to uv #127 on both pydantic majors.Optional[Dict]→dictinUserInput/ResourceInputwould have stopped pydantic v1 copying the caller's dict. It is covered by a regression test.Bug fixes exposed by the stricter checks (each with regression tests that fail on #127):
decimal_encoderraisedTypeErroronDecimal("NaN")andDecimal("Infinity"). It now matches upstream fastapi.2.14.0b2) crashedimport permit.PYDANTIC_VERSIONis unchanged for every version that worked before.import permitraised under-W error::DeprecationWarning, becausePermitConnectionErrorsubclasses the deprecatedPermitExceptionat import time. Importing the SDK is now warning-free. Users who instantiate or subclassPermitExceptionstill get the warning.Deliberately not in this PR:
py.typed. With it, users' type checkers would see false errors: the sync client is typed as coroutines,@validate_argumentsmethods accept dicts their annotations reject, and the generated models use positionalFielddefaults. PER-16231 fixes those first, then ships the marker.Architectural changes
No architectural change.
How it was tested
ruff check,ruff format --check,typosand mypy report 0 findings under pydantic 1.10.26 and under 2.13.5.uv lock --checkpasses.permitmodule (fields, aliases, signatures, the 266@validate_argumentsmodels) and a syntax-tree diff ofpermit/, compared against Migrate packaging, dependencies and CI to uv #127 on both pydantic majors. The only differences are the equivalent rewrites and fixes listed above.prek run --all-filesis green; actionlint and zizmor are clean on the changed workflow.Manual test plan
uv sync, thenuv run pre-commit run --all-files. Expect all hooks to pass.uv sync --group pydantic-v1 && uv run --no-sync mypy. Expect no issues.uv run pytest tests/test_offline_regressions.py. Expect all to pass with warnings as errors.python -W error::DeprecationWarning -c "import permit"in the synced env. Expect exit 0.Blast radius and isolation
[tool.uv]table, and CONTRIBUTING.md says so.Scope and size
permit/: +2,169 / -1,567, mostly formatting, docstrings and annotations. Runtime logic changes are only the equivalent rewrites and the three fixes.pyproject.tomlconfig,permit/exceptions.py,permit/api/encoders.py,permit/utils/pydantic_version.py, and the new tests at the end oftests/test_offline_regressions.py.🤖 Generated with Claude Code