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

mypy says "no type hints or library stubs" although it parses package's .pyi #2194

Closed
3 tasks done
yanoom opened this issue Mar 18, 2020 · 10 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected

Comments

@yanoom
Copy link

yanoom commented Mar 18, 2020

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

We are in the process of releasing our library, called "Pyctuator".

I successfully created stubs for the package using stubgen.
I added the MYPYPATH environment variable with the location of the previously created "stub output folder" for mypy to find the stubs.

I use poetry run mypy on an example application that uses our new package:
I see that mypy is parsing the desired pyctuator.pyi
image

But still fails in the end stating that no type hints or library stubs have been found:
image

Your assistance is highly appreciated- thanks!
:)

@yanoom yanoom added the kind/bug Something isn't working as expected label Mar 18, 2020
@bryanforbes
Copy link
Contributor

Did you include a py.typed file in pyctuator?

@fwallacevt
Copy link

@yanoom was this ever resolved?

@sobolevn
Copy link
Contributor

sobolevn commented Oct 3, 2020

I am facing the same issue with the 1.1.0 release.

@abn
Copy link
Member

abn commented Oct 3, 2020

@sobolevn can you provide a bit more context please?

@yanoom I believe this was resolved in #2000 for 1.0.6. This was also resolved in python-poetry/poetry-core#28 and should be available in poetry-1.1.0 via poetry-core-1.0.0.

If you are building the wheen under PEP 517, you should update your pyproject.toml to use the following.

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

@sobolevn
Copy link
Contributor

sobolevn commented Oct 4, 2020

@abn here's the full reproduction: dry-python/returns#659

Update: solved, by typeddjango/pytest-mypy-plugins#40

@abn
Copy link
Member

abn commented Oct 4, 2020

@sobolevn am I correct in understanding that this was a plugin issue caused due to poetry's editable installs using dist-info insted of setuptool's egg-link mechanism for "develop" installs?

@sobolevn
Copy link
Contributor

sobolevn commented Oct 4, 2020

Yes, exactly. We needed to add a hack around MYPYPATH to make this working again.

@abn
Copy link
Member

abn commented Oct 4, 2020

@sobolevn so I can close this issue then? Assuming there is nothing to be done on the poetry side since we are following standard mechanisms to load path into python site.

@sobolevn
Copy link
Contributor

sobolevn commented Oct 4, 2020

Yeap, this can be closed. Solution: use MYPYPATH env var or mypy_path option when mypy fails to detect your stubs.

Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

5 participants