question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mypy error: Skipping analyzing 'spacy.tokens': found module but no type hints or library stubs

See original GitHub issue

Not a real bug - just static type checker being unhappy.

How to reproduce the behaviour

Create file tmp.py

from spacy.tokens import Doc
> mypy tmp.py                                                                                                                                                                ─╯
app.py:1: error: Skipping analyzing 'spacy.tokens': found module but no type hints or library stubs

Your Environment

Info about spaCy

  • spaCy version: 3.0.0rc2
  • mypy version: 0.79
  • Platform: macOS-10.15.7-x86_64-i386-64bit
  • Python version: 3.8.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
davidatbucommented, Dec 29, 2020

Explosion’s blog post regarding spaCy 3.0 says:

spaCy’s user-facing API that’s implemented in pure Python (as opposed to Cython) now comes with type hints

Since Doc is implemented in Cython, there are in fact no type hints, so @mr-bjerre , you should not be looking for VSCode issues.

@svlandeg , are there any plans to annotate the Cython code with type hints? The most straight forward way would be to create a pyi file corresponding to every .pyx file, and then including a py.typed file with the word partial in it (all of this is from PEP 561 ). PS: Just for completeness, apparently it’s possible forwrite Cythonized code solely using type hints. But I don’t think this approach is battle tested enough to try out in a big library like spaCy

1reaction
ierezellcommented, Jun 9, 2021

Hi, is there any followup on this issue ? I stumbled on the same problem and cannot get mypy typings because of the Cython classes…

Is it planned to add some pure python typings or in python/mypy to lookup for cython code ?

Thanks in advance, Have a great day !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is mypy finding "no type hints or library stubs" for any of ...
This error is because mypy was not able to find the module you are trying to import, whether it comes bundled with type...
Read more >
Running mypy and managing imports
If you are getting a Skipping analyzing X: module is installed, but missing library stubs or py.typed marker , error, this means mypy...
Read more >
mypy matploitlib: error: Skipping analyzing "matplotlib.pyplot ...
mypy matploitlib: error: Skipping analyzing "matplotlib.pyplot": module is installed, but missing library stubs or py.typed marker.
Read more >
Language Processing Pipelines · spaCy Usage Documentation
spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more....
Read more >
Typechecking with a Python Library That Has No Type Hints
When you see this error it's worth first checking that there aren't any types already available. Sometimes a later version of the library...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found