Skip to content

Make --local-partial-types the default#9

Closed
hauntsaninja wants to merge 7 commits intomasterfrom
localparttype
Closed

Make --local-partial-types the default#9
hauntsaninja wants to merge 7 commits intomasterfrom
localparttype

Conversation

@hauntsaninja
Copy link
Copy Markdown
Owner

No description provided.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@ilevkivskyi
Copy link
Copy Markdown

The new mypy_primer fallout looks better. FWIW I am not sure anymore the --local-partial-types migration tool is a blocker for v1.20. @JukkaL @hauntsaninja what do you think?

Btw I finally understand the weird fallout from jax, it is caused by a situation like this:

x = {}

def foo() -> None:
    x[1] = object()

x[1] = "no"  # This one takes precedence with --local-partial-types causing error above

@hauntsaninja
Copy link
Copy Markdown
Owner Author

Yeah that sounds right to me

@github-actions

This comment has been minimized.

@hauntsaninja
Copy link
Copy Markdown
Owner Author

Opening upstream at python#21163

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2026

Diff from mypy_primer, showing the effect of this PR on open source code:

spack (https://github.com/spack/spack)
+ lib/spack/spack/ci/generator_registry.py:10: error: Need type annotation for "_generators" (hint: "_generators: dict[<type>, <type>] = ...")  [var-annotated]
+ lib/spack/spack/package_base.py:143: error: Need type annotation for "detectable_packages"  [var-annotated]
+ lib/spack/spack/bootstrap/core.py:68: error: Need type annotation for "_bootstrap_methods" (hint: "_bootstrap_methods: dict[<type>, <type>] = ...")  [var-annotated]
+ lib/spack/spack/container/writers.py:30: error: Need type annotation for "_writer_factory" (hint: "_writer_factory: dict[<type>, <type>] = ...")  [var-annotated]
+ lib/spack/spack/audit.py:66: error: Need type annotation for "CALLBACKS" (hint: "CALLBACKS: dict[<type>, <type>] = ...")  [var-annotated]
+ lib/spack/spack/audit.py:69: error: Need type annotation for "GROUPS"  [var-annotated]
+ lib/spack/spack/cmd/common/arguments.py:26: error: Need type annotation for "_arguments" (hint: "_arguments: dict[<type>, <type>] = ...")  [var-annotated]
+ lib/spack/spack/cmd/list.py:31: error: Need type annotation for "formatters" (hint: "formatters: dict[<type>, <type>] = ...")  [var-annotated]
+ lib/spack/spack/cmd/env.py:1073: error: Need type annotation for "subcommand_functions" (hint: "subcommand_functions: dict[<type>, <type>] = ...")  [var-annotated]
+ lib/spack/spack/test/mirror.py:35: error: Need type annotation for "repos" (hint: "repos: dict[<type>, <type>] = ...")  [var-annotated]

tornado (https://github.com/tornadoweb/tornado)
+ tornado/autoreload.py:102: error: Need type annotation for "_watched_files" (hint: "_watched_files: set[<type>] = ...")  [var-annotated]
+ tornado/autoreload.py:103: error: Need type annotation for "_reload_hooks" (hint: "_reload_hooks: list[<type>] = ...")  [var-annotated]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/periodic_executor.py:265: error: Need type annotation for "_EXECUTORS" (hint: "_EXECUTORS: set[<type>] = ...")  [var-annotated]
+ pymongo/synchronous/monitor.py:504: error: Need type annotation for "_MONITORS" (hint: "_MONITORS: set[<type>] = ...")  [var-annotated]
+ pymongo/asynchronous/monitor.py:506: error: Need type annotation for "_MONITORS" (hint: "_MONITORS: set[<type>] = ...")  [var-annotated]

paasta (https://github.com/yelp/paasta)
+ paasta_tools/utils.py:1356: error: Need type annotation for "_log_writer_classes" (hint: "_log_writer_classes: dict[<type>, <type>] = ...")  [var-annotated]
+ paasta_tools/cli/cmds/logs.py:486: error: Need type annotation for "_log_reader_classes" (hint: "_log_reader_classes: dict[<type>, <type>] = ...")  [var-annotated]

mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/io/compat.py:281: error: Need type annotation for "_websocket_handshakes" (hint: "_websocket_handshakes: dict[<type>, <type>] = ...")  [var-annotated]
+ mitmproxy/utils/asyncio_utils.py:11: error: Need type annotation for "_KEEP_ALIVE" (hint: "_KEEP_ALIVE: set[<type>] = ...")  [var-annotated]
+ examples/addons/websocket-inject-message.py:37: error: Need type annotation for "tasks" (hint: "tasks: set[<type>] = ...")  [var-annotated]

sympy (https://github.com/sympy/sympy)
+ sympy/polys/polyconfig.py:28: error: Need type annotation for "_current_config" (hint: "_current_config: dict[<type>, <type>] = ...")  [var-annotated]
+ sympy/testing/tests/diagnose_imports.py:123: error: Need type annotation for "sorted_messages" (hint: "sorted_messages: list[<type>] = ...")  [var-annotated]
+ sympy/integrals/manualintegrate.py:1435: error: Need type annotation for "_wilds" (hint: "_wilds: list[<type>] = ...")  [var-annotated]
+ sympy/printing/llvmjitcode.py:153: error: Need type annotation for "exe_engines" (hint: "exe_engines: list[<type>] = ...")  [var-annotated]
+ sympy/printing/llvmjitcode.py:156: error: Need type annotation for "link_names" (hint: "link_names: set[<type>] = ...")  [var-annotated]

asynq (https://github.com/quora/asynq)
+ asynq/tests/test_multiple_inheritance.py:25: error: Need type annotation for "called" (hint: "called: dict[<type>, <type>] = ...")  [var-annotated]

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/utils/signals.py:5: error: Need type annotation for "_exit_handlers_installed" (hint: "_exit_handlers_installed: set[<type>] = ...")  [var-annotated]
+ ddtrace/internal/logger.py:116: error: Need type annotation for "_RATE_LIMITS" (hint: "_RATE_LIMITS: dict[<type>, <type>] = ...")  [var-annotated]
+ ddtrace/_monkey.py:129: error: Need type annotation for "_PATCHED_MODULES" (hint: "_PATCHED_MODULES: set[<type>] = ...")  [var-annotated]
+ ddtrace/errortracking/_handled_exceptions/monitoring_reporting.py:18: error: Need type annotation for "INSTRUMENTED_FILE_PATHS" (hint: "INSTRUMENTED_FILE_PATHS: list[<type>] = ...")  [var-annotated]
+ ddtrace/appsec/_iast/_taint_tracking/_debug.py:13: error: Need type annotation for "TAINTED_FRAMES" (hint: "TAINTED_FRAMES: list[<type>] = ...")  [var-annotated]
+ ddtrace/bootstrap/preload.py:29: error: Need type annotation for "post_preload" (hint: "post_preload: list[<type>] = ...")  [var-annotated]

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/sqlite/udf.py:33: error: Need type annotation for "_SQLITE_UDF_REGISTRY" (hint: "_SQLITE_UDF_REGISTRY: dict[<type>, <type>] = ...")  [var-annotated]
+ ibis/backends/sqlite/udf.py:34: error: Need type annotation for "_SQLITE_UDAF_REGISTRY" (hint: "_SQLITE_UDAF_REGISTRY: dict[<type>, <type>] = ...")  [var-annotated]

jax (https://github.com/google/jax)
+ jax/_src/custom_api_util.py:16: error: Need type annotation for "_custom_wrapper_types" (hint: "_custom_wrapper_types: set[<type>] = ...")  [var-annotated]
+ jax/_src/logging_config.py:98: error: Need type annotation for "_debug_enabled_loggers" (hint: "_debug_enabled_loggers: list[<type>] = ...")  [var-annotated]
+ jax/_src/config.py:235: error: Need type annotation for "config_states" (hint: "config_states: dict[<type>, <type>] = ...")  [var-annotated]
+ jax/_src/mesh.py:216: error: Need type annotation for "_mesh_object_dict" (hint: "_mesh_object_dict: dict[<type>, <type>] = ...")  [var-annotated]
+ jax/_src/compiler.py:378: error: Need type annotation for "_XLA_RUNTIME_ERROR_HANDLERS" (hint: "_XLA_RUNTIME_ERROR_HANDLERS: list[<type>] = ...")  [var-annotated]
+ jax/experimental/jet.py:484: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:510: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:528: error: Incompatible types in assignment (expression has type "def _integer_pow_taylor(primals_in: Any, series_in: Any, *, y: Any) -> Any", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:583: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:597: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:674: error: Incompatible types in assignment (expression has type "def _abs_taylor_rule(x: Any, series_in: Any, **params: Any) -> Any", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:682: error: Incompatible types in assignment (expression has type "def _select_n_taylor_rule(primal_in: Any, series_in: Any, **params: Any) -> Any", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:699: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:715: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/jet.py:728: error: Incompatible types in assignment (expression has type "def _scatter_add_rule(primals_in: Any, series_in: Any, *, update_jaxpr: Any, update_consts: Any, dimension_numbers: Any, indices_are_sorted: Any, unique_indices: Any, mode: Any) -> Any", target has type "def _dynamic_slice_jet_rule(primals_in: Any, series_in: Any, **params: Any) -> Any")  [assignment]
+ jax/experimental/source_mapper/common.py:53: error: Need type annotation for "_pass_registry" (hint: "_pass_registry: dict[<type>, <type>] = ...")  [var-annotated]
+ jax/_src/pallas/cost_estimate.py:37: error: Need type annotation for "_cost_rules" (hint: "_cost_rules: dict[<type>, <type>] = ...")  [var-annotated]
+ jax/_src/pallas/triton/lowering.py:1276: error: Incompatible types in assignment (expression has type "def signless_rule(ctx: LoweringRuleContext, x: Any, y: Any, fn: Any = ..., **kwargs: Any) -> Any", target has type "Callable[[Any, Any], Any]")  [assignment]
+ jax/_src/pallas/triton/lowering.py:1296: error: Incompatible types in assignment (expression has type "Callable[[LoweringRuleContext, Any, Any, Any], Any]", target has type "Callable[[Any, Any], Any]")  [assignment]
+ jax/_src/pallas/mosaic/lowering.py:445: error: Need type annotation for "skip_mlir_conversions" (hint: "skip_mlir_conversions: set[<type>] = ...")  [var-annotated]

scipy (https://github.com/scipy/scipy)
+ scipy/io/_idl.py:72: error: Need type annotation for "STRUCT_DICT" (hint: "STRUCT_DICT: dict[<type>, <type>] = ...")  [var-annotated]

alerta (https://github.com/alerta/alerta)
+ alerta/plugins/escalate.py:11: error: Need type annotation for "escalate_map" (hint: "escalate_map: dict[<type>, <type>] = ...")  [var-annotated]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/html.py:73: error: Need type annotation for "JS_UNMINIFY_SELECTORS" (hint: "JS_UNMINIFY_SELECTORS: set[<type>] = ...")  [var-annotated]

manticore (https://github.com/trailofbits/manticore)
+ tests/other/test_tui_api.py:25: error: Need type annotation for "logs" (hint: "logs: list[<type>] = ...")  [var-annotated]
+ tests/other/test_tui_api.py:26: error: Need type annotation for "state_captures" (hint: "state_captures: list[<type>] = ...")  [var-annotated]

apprise (https://github.com/caronc/apprise)
+ apprise/utils/parse.py:148: error: Need type annotation for "REGEX_VALIDATE_LOOKUP" (hint: "REGEX_VALIDATE_LOOKUP: dict[<type>, <type>] = ...")  [var-annotated]

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/gdblib/events.py:271: error: Need type annotation for "paused"  [var-annotated]
+ pwndbg/commands/context.py:575: error: Need type annotation for "expressions" (hint: "expressions: list[<type>] = ...")  [var-annotated]

pywin32 (https://github.com/mhammond/pywin32)
+ win32/scripts/pywin32_testall.py:13:1: error: Need type annotation for "failures" (hint: "failures: list[<type>] = ...")  [var-annotated]
+ Pythonwin/pywin/scintilla/keycodes.py:7:1: error: Need type annotation for "key_name_to_vk" (hint: "key_name_to_vk: dict[<type>, <type>] = ...")  [var-annotated]
+ Pythonwin/pywin/scintilla/keycodes.py:8:1: error: Need type annotation for "key_code_to_name" (hint: "key_code_to_name: dict[<type>, <type>] = ...")  [var-annotated]
+ Pythonwin/pywin/framework/toolmenu.py:9:1: error: Need type annotation for "tools" (hint: "tools: dict[<type>, <type>] = ...")  [var-annotated]
+ Pythonwin/pywin/scintilla/view.py:79:1: error: Need type annotation for "event_commands" (hint: "event_commands: list[<type>] = ...")  [var-annotated]

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/feature_flag_consistency/input_data/feature_flag_configurations.py:20: error: Need type annotation for "FEATURE_FLAG_CONFIGURATION_PAIRS" (hint: "FEATURE_FLAG_CONFIGURATION_PAIRS: dict[<type>, <type>] = ...")  [var-annotated]

cloud-init (https://github.com/canonical/cloud-init)
+ tests/unittests/early_patches.py:5: error: Need type annotation for "cached_functions" (hint: "cached_functions: list[<type>] = ...")  [var-annotated]

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/plugins/admin/memory.py:8: error: Need type annotation for "_mark" (hint: "_mark: dict[<type>, <type>] = ...")  [var-annotated]
+ openlibrary/plugins/admin/memory.py:9: error: Need type annotation for "_mark_ids" (hint: "_mark_ids: dict[<type>, <type>] = ...")  [var-annotated]
+ openlibrary/utils/schema.py:16: error: Need type annotation for "_datatypes" (hint: "_datatypes: dict[<type>, <type>] = ...")  [var-annotated]
+ openlibrary/utils/schema.py:23: error: Need type annotation for "_adapters" (hint: "_adapters: dict[<type>, <type>] = ...")  [var-annotated]
+ openlibrary/utils/schema.py:37: error: Need type annotation for "_constants" (hint: "_constants: dict[<type>, <type>] = ...")  [var-annotated]
+ openlibrary/config.py:12: error: Need type annotation for "runtime_config" (hint: "runtime_config: dict[<type>, <type>] = ...")  [var-annotated]
+ openlibrary/plugins/admin/code.py:50: error: Need type annotation for "admin_tasks" (hint: "admin_tasks: list[<type>] = ...")  [var-annotated]

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