Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Running stubtest locally fails #27580

Open
dstansby opened this issue Dec 28, 2023 · 4 comments · May be fixed by #27618
Open

[Bug]: Running stubtest locally fails #27580

dstansby opened this issue Dec 28, 2023 · 4 comments · May be fixed by #27618

Comments

@dstansby
Copy link
Member

Bug summary

Running python tools/stubtest.py fails for me locally with

% python tools/stubtest.py              
error: matplotlib failed to find stubs
Stub:
MISSING
Runtime:
<module 'matplotlib' from '/Users/dstansby/software/matplotlib/lib/matplotlib/__init__.py'>

note: unused allowlist entry matplotlib.backends.*
note: unused allowlist entry matplotlib.tests.*
note: unused allowlist entry matplotlib.pylab.*
...
(many more note lines below here)

I can't work out what I need to do to fix this, and was hoping someone who knew more about the stubs could help! I followed the contributing guidelines to set up a development environment, which is working fine for tests etc.

Code for reproduction

n/a

Actual outcome

Stub test fails.

Expected outcome

Stub test runs.

Additional information

No response

Operating system

macOS

Matplotlib Version

3.9.0.dev896+gc1b80c56f7

Matplotlib Backend

MacOSX

Python version

3.11.6

Jupyter version

No response

Installation

git checkout

@ksunden
Copy link
Member

ksunden commented Dec 29, 2023

Unfortunately the way meson does editable installs doesn't work with stubtest...

It does work with a normal install.

It also does work if you edit the .pth file in site-packages to point to the lib/matplotlib folder

@story645
Copy link
Member

Unfortunately the way meson does editable installs doesn't work with stubtest..

Can you update the docs to say that? I'd do it but not sure I'd get the details right.

@dstansby
Copy link
Member Author

dstansby commented Jan 2, 2024

I think updating these lines would be good:

Type hints are checked by the mypy :ref:`pre-commit hook <pre-commit-hooks>`
and can often be verified using ``tools\stubtest.py`` and occasionally may
require the use of ``tools\check_typehints.py``.

If it's not possible to run stubtest on an editable install maybe we should just remove mention of it from this section of the docs?

@story645
Copy link
Member

story645 commented Jan 2, 2024

If it's not possible to run stubtest on an editable install maybe we should just remove mention of it from this section of the docs?

:/ I added that section so fine w/ removing it if it doesn't make sense, but then my question is - when do you use these tools? Regular mypy should work and is a pre-commit hook.

@dstansby dstansby linked a pull request Jan 9, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants