Failing mypy checks
See original GitHub issueI’m not entirely sure if I’m doing something wrong now or there has been some change to another package that perhaps broke mypy checks. In https://github.com/pystatgen/sgkit/pull/653 I had no trouble with it, but now even with a clean environment I get the errors below.
pre-commit failure
$ pre-commit run --all-files
Check for merge conflicts................................................Passed
Debug Statements (Python)................................................Passed
Mixed line ending........................................................Passed
Check for case conflicts.................................................Passed
Check Yaml...............................................................Passed
isort....................................................................Passed
black....................................................................Passed
flake8...................................................................Passed
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1
sgkit/stats/utils.py:71: error: unused 'type: ignore' comment
sgkit/tests/test_stats_utils.py:25: error: unused 'type: ignore' comment
sgkit/io/vcf/vcf_partition.py:161: error: unused 'type: ignore' comment
sgkit/io/vcf/vcf_partition.py:164: error: unused 'type: ignore' comment
sgkit/utils.py:101: error: unused 'type: ignore' comment
sgkit/utils.py:302: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:7: error: Module 'numpy.typing' has no attribute 'NDArray' [attr-defined]
sgkit/stats/regenie.py:85: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:87: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:88: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:89: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:92: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:133: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:161: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:163: error: unused 'type: ignore' comment
sgkit/stats/regenie.py:487: error: unused 'type: ignore' comment
sgkit/window.py:231: error: unused 'type: ignore' comment
sgkit/window.py:244: error: unused 'type: ignore' comment
sgkit/window.py:245: error: unused 'type: ignore' comment
sgkit/window.py:246: error: unused 'type: ignore' comment
sgkit/window.py:320: error: unused 'type: ignore' comment
sgkit/window.py:322: error: unused 'type: ignore' comment
sgkit/window.py:348: error: unused 'type: ignore' comment
sgkit/window.py:406: error: unused 'type: ignore' comment
sgkit/window.py:429: error: unused 'type: ignore' comment
sgkit/io/utils.py:38: error: unused 'type: ignore' comment
sgkit/io/utils.py:157: error: unused 'type: ignore' comment
sgkit/io/utils.py:205: error: unused 'type: ignore' comment
sgkit/stats/popgen.py:794: error: unused 'type: ignore' comment
sgkit/stats/hwe.py:6: error: Module 'numpy.typing' has no attribute 'NDArray' [attr-defined]
sgkit/stats/ld.py:158: error: unused 'type: ignore' comment
sgkit/testing.py:73: error: unused 'type: ignore' comment
sgkit/testing.py:74: error: unused 'type: ignore' comment
sgkit/tests/test_pca.py:8: error: Module 'numpy.typing' has no attribute 'NDArray' [attr-defined]
sgkit/tests/test_pca.py:33: error: unused 'type: ignore' comment
sgkit/tests/test_aggregation.py:108: error: unused 'type: ignore' comment
sgkit/tests/test_aggregation.py:218: error: unused 'type: ignore' comment
sgkit/tests/test_aggregation.py:253: error: unused 'type: ignore' comment
sgkit/tests/test_mis.py:8: error: Module 'numpy.typing' has no attribute 'NDArray' [attr-defined]
sgkit/io/bgen/bgen_reader.py:26: error: Module 'numpy.typing' has no attribute 'NDArray' [attr-defined]
sgkit/io/bgen/bgen_reader.py:149: error: unused 'type: ignore' comment
sgkit/io/bgen/bgen_reader.py:330: error: unused 'type: ignore' comment
sgkit/tests/test_pc_relate.py:9: error: Module 'numpy.typing' has no attribute 'NDArray' [attr-defined]
sgkit/tests/test_regenie.py:18: error: Module 'numpy.typing' has no attribute 'NDArray' [attr-defined]
sgkit/tests/test_regenie.py:345: error: unused 'type: ignore' comment
sgkit/tests/test_regenie.py:394: error: unused 'type: ignore' comment
sgkit/io/plink/plink_reader.py:10: error: Module 'numpy.typing' has no attribute 'NDArray' [attr-defined]
sgkit/io/plink/plink_reader.py:88: error: unused 'type: ignore' comment
sgkit/tests/io/vcf/test_vcf_reader.py:548: error: unused 'type: ignore' comment
sgkit/tests/io/vcf/test_vcf_reader.py:553: error: unused 'type: ignore' comment
sgkit/tests/io/bgen/test_bgen_reader.py:134: error: unused 'type: ignore' comment
validation/gwas/method/pc_relate/validate_pc_relate.py:36: error: unused 'type: ignore' comment
Found 52 errors in 21 files (checked 98 source files)
I created a clean environment with:
conda create -n sgkit python=3.8
conda activate sgkit
git clone https://github.com/pystatgen/sgkit
cd sgkit
pip install -r requirements.txt -r requirements-dev.txt -r requirements-doc.txt
Any ideas if this is me doing something wrong or it’s possibly due to upstream changes elsewhere?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Common issues and solutions - mypy 0.991 documentation
Common issues and solutions# · Can't install mypy using pip# · No errors reported for obviously wrong code# · Spurious errors and locally...
Read more >MyPy Reporting problems in dependencies (site-packages)
Bug Report MyPy is reporting problems with dependencies in ... For Mypy checks in kraken-core , I configure Mypy to ignore the dill...
Read more >Using mypy to type check and i cant figure out why this errors ...
So, i using mypy to learn how to code in python using type check from the beginning. I'm using this code to train:...
Read more >Mypy Documentation - Read the Docs
Mypy is a static type checker for Python. Type checkers help ensure that you're using variables and functions in your code correctly.
Read more >MyPy is Failing Pipeline Builds that Were Previously Passing
In the last few days, builds of Gaphor have started to fail due to the pre-commit hook for mypy failing on every check...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, sorry I didn’t copy/paste here, instead I rebuilt the steps and missed the
conda activate sgkit
while writing this issue, but I hadsgkit
activated for the next steps. Also fixed that in the description now.I’m not experienced with mypy in general, but it does indeed looks a bit off. What I noticed now is that whenever I changed
numpy==x.xx.x
, pre-commit would install that new NumPy version. When I actually addednumpy>=1.21.2
, there was no package being installed but the number of errors reduced dramatically:I’ve added that change and the fix for the 4 errors above in https://github.com/pystatgen/sgkit/pull/664 .