Skip to content

Upgrade pyright to 1.1.414 - #1015

Merged
jonathan343 merged 2 commits into
developfrom
chore/upgrade-pyright
Dec 5, 2026
Merged

jonathan343 merged 2 commits into
developfrom
chore/upgrade-pyright

Conversation

@jonathan343

@jonathan343 jonathan343 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

uv.lock has held pyright at 1.1.406 since October 2025, because Dependabot's weekly pip updates never touch uv.lock (fixed separately in #1016). This bumps the lockfile and the >= floor to 1.1.414. On 1.1.406, strict checking of packages spends about 66 of its 70 seconds in smithy_python/_client_emitter.py. Pyright 1.1.409 fixed that, and pyright packages now finishes in about 4.5 seconds.

The newer pyright reports 27 errors from four changes in pyright and typeshed. None of the fixes change runtime behavior.

  1. @contextmanager returning Iterator is deprecated (15 errors). Typeshed now deprecates annotating @contextmanager functions as -> Iterator[X] (Fix the signatures of @(async)contextmanager python/typeshed#12087). They now return Generator[X].
  2. Imports of names a module doesn't export (8 errors). Pyright 1.1.409 stopped hiding reportPrivateImportUsage for packages checked from source (Fix reportPrivateImportUsage errors disappearing microsoft/pyright#11237). One annotation in smithy_http/aio/crt.py and seven test references now go through the module that defines each name, or through monkeypatch.
  3. String literal patterns no longer narrow to str (3 errors). Since 1.1.407, pyright doesn't narrow a match subject from a pattern like case "NaN", because matching uses ==. smithy_json now uses str("Infinity" | "-Infinity" | "NaN") class patterns, which check the type before comparing the value.
  4. A partially unknown test variable (1 error). test_publisher.py built its signing config from stubs behind four # type: ignore comments, so pyright couldn't infer its type. The stubs now implement the signer and resolver protocols, and the variable is annotated with the config type the async publisher accepts.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Fix the new errors: Generator returns for @contextmanager, imports from
exporting modules, and str narrowing for non-finite JSON numbers.
Match non-finite JSON numbers with str("Infinity" | ...) instead of a guard,
and give the publisher test's signing config its real type in place of Any
and type: ignore.
@jonathan343
jonathan343 merged commit 5c01e4f into develop Dec 5, 2026
26 checks passed
@jonathan343
jonathan343 deleted the chore/upgrade-pyright branch December 5, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants