Skip to content

Basic mypy compatibility#56

Merged
sneakers-the-rat merged 10 commits intomainfrom
basic-mypy-compat
Aug 14, 2025
Merged

Basic mypy compatibility#56
sneakers-the-rat merged 10 commits intomainfrom
basic-mypy-compat

Conversation

@sneakers-the-rat
Copy link
Collaborator

Related to: #32

While writing this, realized there was a very easy path to get basic mypy compatibility, even though it doesn't get us to where we want to be.

We should at least be able to write annotations without needing to ignore major linter rules and failing mypy altogether.

Following #55 mypy will actually use the type stub,
and previously we have implemented support for Literal instead of Shape, though this wasn't documented?

The only thing remaining was that mypy didn't detect that NDArray and Shape should accept generic params, added them to the type stub and to the shape class. the Final class creation and the Immutable metaclasses interfered with being able to set the generic dunder attrs, and they are sorta silly anyway, don't really accomplish anything, and will be deprecated soon, so they were removed.

Added the most basic mypy test and a tiny bit of documentation on using literals

@sneakers-the-rat sneakers-the-rat merged commit d5d1238 into main Aug 14, 2025
32 checks passed
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.

1 participant