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.
I've created type stubs for pyglm (https://github.com/esoma/pyglm-typing). There is a runtime wart with them however,
glm.array
is not generic (as intyping.Generic
) and my typing stubs are. It works for the most part where annotations are only statically assessed, but some static typing is inevitably also runtime, for example in the case of type aliases:This will fail at runtime since the
array
class doesn't follow the generic typing protocol.Luckily this is fairly easy to add in 3.9+: https://docs.python.org/3/c-api/typehints.html
So I've gone ahead and done that in this PR with the understanding that this isn't perfect. PyGLM of course doesn't officially support typing so this is kind of hacky (and btw, if you'd like to support typing I'd be happy to discuss merging the stubs into this repo). Also it's only 3.9+, it's possible to support this in various ways for all of PyGLM's supported versions (3.7+ would require a custom implementation of
Py_GenericAlias
and 3.5+ would require a metaclass -- those seem a much larger lift).