[SciPy-Dev] python3.9 runtests.py -mypy failing on master bc mpmath

Joshua Wilson josh.craig.wilson at gmail.com
Sun Mar 21 23:59:24 EDT 2021


The right approach here is to ignore errors from mpmath in the
mypy.ini instead of ignoring errors from that particular file;
something like

[mypy-mpmath]
ignore_errors = True

[mypy-mpmath.*]
ignore_errors = True

Mypy is unhappy because mpmath has no typing information (it complains
by default so that untyped stuff doesn't sneak in without you
knowing), but mpmath is unlikely to ever gain type support, so we
should ignore errors from it.

On Sun, Mar 21, 2021 at 5:50 PM <rlucas7 at vt.edu> wrote:
>
> Hey Warren,
>
> Also not a mypy expert.
>
> I also opened a pr with an inline ignore that is similar to what was used in another prior pr. I missed your PR until I opened other one.
>
> https://github.com/scipy/scipy/pull/13721
>
> Not sure how we prefer those, if we want to take a top level one (on np math) and omit the file specific ones it might save many lines removal.
>
> If I’ve misunderstood how the mypy.ini config works please let me know.
>
> -Lucas Roberts
>
> On Mar 21, 2021, at 8:13 PM, Warren Weckesser <warren.weckesser at gmail.com> wrote:
>
> On 3/21/21, Lucas Roberts <rlucas7 at vt.edu> wrote:
>
> Hi scipy-dev,
>
> I just merged a PR: https://github.com/scipy/scipy/pull/10170
>
> that was all green and passing.
>
>
> It looks like on master there is a python 3.9 mypy execution of
>
> runtests.py, here is the offending part of the stacktrace where the build
>
> fails
>
>
> ```
>
>
> 2021-03-21T18:26:08.7168990Z Installing collected packages:
>
> typing-extensions, typed-ast, mypy-extensions, mypy
>
> 2021-03-21T18:26:10.3177755Z Successfully installed mypy-0.812
>
> mypy-extensions-0.4.3 typed-ast-1.4.2 typing-extensions-3.7.4.3
>
> 2021-03-21T18:26:10.4138039Z ##[group]Run python3.9 -u runtests.py --mypy
>
> 2021-03-21T18:26:10.4138752Z  [36;1mpython3.9 -u runtests.py --mypy [0m
>
> 2021-03-21T18:26:10.4183883Z shell: /usr/bin/bash -e {0}
>
> 2021-03-21T18:26:10.4184310Z ##[endgroup]
>
> 2021-03-21T18:26:10.4915105Z Building, see build.log...
>
> 2021-03-21T18:27:10.5562824Z     ... build in progress (0:01:00.064479
>
> elapsed)
>
> 2021-03-21T18:28:10.6226962Z     ... build in progress (0:02:00.131202
>
> elapsed)
>
> 2021-03-21T18:29:10.6923322Z     ... build in progress (0:03:00.200865
>
> elapsed)
>
> 2021-03-21T18:30:10.7642621Z     ... build in progress (0:04:00.272632
>
> elapsed)
>
> 2021-03-21T18:31:10.8354301Z     ... build in progress (0:05:00.343937
>
> elapsed)
>
> 2021-03-21T18:32:10.9051482Z     ... build in progress (0:06:00.413679
>
> elapsed)
>
> 2021-03-21T18:33:10.9747934Z     ... build in progress (0:07:00.483329
>
> elapsed)
>
> 2021-03-21T18:34:11.0420822Z     ... build in progress (0:08:00.550613
>
> elapsed)
>
> 2021-03-21T18:35:11.1096296Z     ... build in progress (0:09:00.618168
>
> elapsed)
>
> 2021-03-21T18:36:11.1807347Z     ... build in progress (0:10:00.689247
>
> elapsed)
>
> 2021-03-21T18:37:11.2499801Z     ... build in progress (0:11:00.758503
>
> elapsed)
>
> 2021-03-21T18:38:11.3141592Z     ... build in progress (0:12:00.822681
>
> elapsed)
>
> 2021-03-21T18:39:11.3839094Z     ... build in progress (0:13:00.892443
>
> elapsed)
>
> 2021-03-21T18:40:11.4513782Z     ... build in progress (0:14:00.959913
>
> elapsed)
>
> 2021-03-21T18:41:11.5224005Z     ... build in progress (0:15:01.030878
>
> elapsed)
>
> 2021-03-21T18:42:11.5936181Z     ... build in progress (0:16:01.102135
>
> elapsed)
>
> 2021-03-21T18:42:32.6182673Z Build OK (0:16:22.126754 elapsed)
>
> 2021-03-21T18:43:05.3712863Z
>
> scipy/special/_precompute/cosine_cdf.py:2: error: Cannot find
>
> implementation or library stub for module named 'mpmath'  [import]
>
> 2021-03-21T18:43:05.3716636Z
>
> scipy/special/_precompute/cosine_cdf.py:2: note: See
>
> https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
>
> 2021-03-21T18:43:05.3718156Z Found 1 error in 1 file (checked 677 source
>
> files)
>
> 2021-03-21T18:43:06.5626501Z ##[error]Process completed with exit code 1.
>
> 2021-03-21T18:43:07.2727027Z Post job cleanup.
>
> 2021-03-21T18:43:07.3838441Z [command]/usr/bin/git version
>
> 2021-03-21T18:43:07.3891979Z git version 2.30.2
>
> 2021-03-21T18:43:07.3933267Z [command]/usr/bin/git config --local
>
> --name-only --get-regexp core\.sshCommand
>
> 2021-03-21T18:43:07.3968953Z [command]/usr/bin/git submodule foreach
>
> --recursive git config --local --name-only --get-regexp
>
> 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand'
>
> || :
>
> 2021-03-21T18:43:07.4490076Z [command]/usr/bin/git config --local
>
> --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
>
> 2021-03-21T18:43:07.4525518Z http.https://github.com/.extraheader
>
> 2021-03-21T18:43:07.4539152Z [command]/usr/bin/git config --local
>
> --unset-all http.https://github.com/.extraheader
>
> 2021-03-21T18:43:07.5212999Z [command]/usr/bin/git submodule foreach
>
> --recursive git config --local --name-only --get-regexp
>
> 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local
>
> --unset-all 'http.https://github.com/.extraheader' || :
>
> 2021-03-21T18:43:07.5566225Z Cleaning up orphan processes
>
>
> ```
>
>
> but looking at the runs on the PR
>
> https://github.com/scipy/scipy/runs/1953046830
>
> we were doing:
>
> ```
>
> python3.9 -u runtests.py -m fast
>
> ```
>
> I'm less familiar with the -mypy flag to runtests.py, does anyone know if
>
> we need
>
> (1) to remove the mpmath parts of that PR opting instead for
>
> precompute/hard coded numbers or
>
> (2) this is something that will change/be removed in future
>
>
> --
>
> -L
>
>
>
> I can reproduce the problem locally, and I can "fix" it by configuring
> mypy to ignore errors in that file.  That is done by adding
>
> [mypy-scipy.special._precompute.cosine_cdf]
> ignore_errors = True
>
> to mypy.ini.  I created a pull request:
> https://github.com/scipy/scipy/pull/13720.  The tests are running as I
> write this, but it worked locally.
>
> This is obviously just a work-around, but we have a lot of those in
> mypy.ini.  I'm not a mypy expert, so suggestions (and even better,
> PRs) with a better fix are welcome.
>
> Warren
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev


More information about the SciPy-Dev mailing list