PyPI package: found module but no type hints or library stubs

I just made my first python package and uploaded it to PyPI (https://pypi.org/project/pygraphsearch/).

I then made some test code that uses it. I ran pip install pygraphsearch to download my package. Everything works fine except mypy complains that "found module but no type hints or library stubs". I used typing everywhere in my package, so I don't know why it complains about that. What am I doing wrong?

Update

I added a py.typed file, like it says on https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages, but it still doesn't work.

I also added the package_data parameter in the call to setuptools.setup in setup.py.

package_dir={"": "src"},
package_data={"pygraphsearch": ["py.typed"]},

My file structure in case it's relevant looks like this:

pygraphsearch
├── pyproject.toml
├── py.typed
├── README.md
├── setup.py
└── src
    └── pygraphsearch
        ├── Edge.py
        ├── Frontier.py
        ├── __init__.py
        ├── IterativeDeepeningFrontier.py
        ├── Node.py
        ├── search.py
        ├── Stack.py
        ├── State.py
        └── UndirectedEdge.py

Upvotes: 1

Views: 1776

Answers (1)

I moved the file py.typed into src/pygraphsearch and that seemed to solve the issue.

Upvotes: 0

Related Questions