MyPy Errors in Distributions Module
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 315
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 27
Description
Bug Description
In the PR, adding type hints to the distributions module https://github.com/pyro-ppl/numpyro/pull/2032, the CI did not check for consistency, and we have many lint errors.
Steps to Reproduce
Steps to reproduce the behavior.
We must always add the module into the mypy config in the pyproject.toml file as
[[tool.mypy.overrides]]
module = [
"numpyro.contrib.control_flow.*", # types missing
"numpyro.contrib.funsor.*", # types missing
"numpyro.contrib.hsgp.*",
"numpyro.contrib.stochastic_support.*",
"numpyro.diagnostics.*",
"numpyro.distributions.*", # <-- This line was missing!
"numpyro.handlers.*",
"numpyro.infer.elbo.*",
"numpyro.optim.*",
"numpyro.primitives.*",
"numpyro.patch.*",
"numpyro.util.*",
]
ignore_errors = false
When I add this line and do the mypy checks, we have many errors
...
Found 1043 errors in 14 files (checked 88 source files)
Expected Behavior
We should add the line "numpyro.distributions.*" to the pyproject.toml file as above and fix all the errors.
As there are many, we can do it in small PRs.
FYI: @Qazalbash
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pyproject.toml by adding numpyro.distributions.* to the mypy overrides, then run the mypy checks described in the issue to inspect the errors across the distributions module. Work through the reported errors in small, focused changes; done means the module is checked without the current type errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100