Add some type annotations, drop support for Python 3.6 #9
+10
−11
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.
This PR adds a few basic type annotations to the
bmg
module. The main motivation behind this is to improve developer experience when usingndspy
in an IDE. For example, consider the following snippet of code:The
BMG.messages
instance variable is untyped inndspy
, so an IDE wouldn't be able to offer a code suggestion for.stringParts
, and the user would have to consult the docs for the exact attributes ofmessage
.@RoadrunnerWMC are you open to this change/more changes like it? I've been adding some type annotations like these to my local copy of
ndspy
to aid my own development, but if they can be of use more generally then I'm happy to upstream them.One additional note - I also dropped support for Python 3.6 in this PR to enable usage of the
from __future__ import annotations
import, which allows usage of more modern typing syntax likelist[T]
,tuple[T, T]
,X | Y
etc. for Python 3.7+ overtyping.List[T]
,typing.Tuple[T, T]
,typing.Union[X, Y]
, etc. I figured this might be acceptable since 3.6 (and 3.7 in fact) are EOL. But if you'd prefer not to do that, and do want to accept this PR, let me know and I can change it to the 3.6-compatible types.