Add py.typed marker and gradual static typing
#1189
Hermann-web
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Proposal
I'd like to contribute static type annotations to NeuroKit2, starting small and building up gradually. Before writing any code I wanted to check whether this is something maintainers would welcome, and if so, what approach fits best.
Proposed plan
PR 1 (infrastructure): add
neurokit2/py.typed(PEP 561 marker, one empty file) so type checkers know the package intends to ship types, and wire up a checker inpyproject.toml+ CI in permissive mode (no hard failures yet, just visibility).PR 2 (proof of concept): annotate the
stats/submodule (~50 functions, no recent churn, mostly pure Python math). This gives a concrete example of what the annotations look like before committing to the full library.Subsequent PRs: submodule by submodule, at whatever pace makes sense.
Checker choice
The two realistic options for a scientific Python library:
Given NeuroKit2 already uses the Astral stack (ruff, uv), pyright feels like a natural fit — but I'd go with whatever you prefer.
What I'm NOT proposing
complexity/or other actively-developed submodules early on--ignore-missing-imports/ basic mode so it doesn't block contributorsHappy to hear if there's a different approach you'd prefer, or if this isn't a priority right now.
All reactions