Skip to content

Conversation

@jorenham
Copy link

@jorenham jorenham commented Jan 27, 2026

This configures mypy to run in "strict mode", which according to mypy --help enables the following flags:

--warn-unused-configs, --disallow-any-generics, --disallow-subclassing-any, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs, --disallow-untyped-decorators, --warn-redundant-casts, --warn-unused-ignores, --warn-return-any, --no-implicit-reexport, --strict-equality,
--strict-bytes, --extra-checks

Enabling this caused a bunch of typing errors to surface, which are now also fixed.

Most of these are related to bytes/bytearray/memoryview not being assignable to each other. So I used their common denominator, collections.abc.Buffer, or rather its backport from typing_extensions (which is always available if TYPE_CHECKING because typeshed conveniently lies that it's part of the standard library).

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants