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

error: Error importing plugin "returns.contrib.mypy.returns_plugin": No module named 'returns' [misc] #1577

Open
wizard-28 opened this issue Mar 5, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@wizard-28
Copy link

Bug report

What's wrong

Mypy is unable to use the plugin. It errors out with the following message:

error: Error importing plugin "returns.contrib.mypy.returns_plugin": No module named 'returns'  [misc]

Here's my pyproject.toml:

[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Sourajyoti Basak <wiz28@protonmail.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
returns = "^0.19.0"
mypy = "^0.950"

[tool.mypy]
plugins = ["returns.contrib.mypy.returns_plugin"]
allow_redefinition = false
check_untyped_defs = true
ignore_errors = false
ignore_missing_imports = true
implicit_reexport = false
local_partial_types = true
no_implicit_optional = true
strict_equality = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true

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

How is that should be

mypy successfully works.

System information

  • python version: 3.10.6
  • returns version: 0.19.0
  • mypy version: 0.950
@wizard-28 wizard-28 added the bug Something isn't working label Mar 5, 2023
@sobolevn
Copy link
Member

sobolevn commented Mar 7, 2023

Can you try checking import returns with python and mypy without a plugin?

@wizard-28
Copy link
Author

wizard-28 commented Mar 9, 2023

Can you try checking import returns with python and mypy without a plugin?

code/python/test is 📦 v0.1.0 via 🐍 v3.10.6 (test-py3.10) took 4s
λ bat pyproject.toml
───────┬────────────────────────────────────────────────────────────────────────────────────
       │ File: pyproject.toml
───────┼────────────────────────────────────────────────────────────────────────────────────
   1   │ [tool.poetry]
   2name = "test"
   3version = "0.1.0"
   4description = ""
   5authors = ["Sourajyoti Basak <wiz28@protonmail.com>"]
   6readme = "README.md"
   78   │ [tool.poetry.dependencies]
   9python = "^3.10"
  10returns = "^0.19.0"
  11mypy = "^0.950"
  1213   │ [tool.mypy]
  14# plugins = ["returns.contrib.mypy.returns_plugin"]
  15allow_redefinition = false
  16check_untyped_defs = true
  17ignore_errors = false
  18ignore_missing_imports = true
  19implicit_reexport = false
  20local_partial_types = true
  21no_implicit_optional = true
  22strict_equality = true
  23strict_optional = true
  24warn_no_return = true
  25warn_redundant_casts = true
  26warn_unreachable = true
  27warn_unused_configs = true
  28warn_unused_ignores = true
  2930   │ [build-system]
  31requires = ["poetry-core"]
  32build-backend = "poetry.core.masonry.api"
───────┴────────────────────────────────────────────────────────────────────────────────────

code/python/test is 📦 v0.1.0 via 🐍 v3.10.6 (test-py3.10) took 5s
λ bat test/__init__.py
───────┬────────────────────────────────────────────────────────────────────────────────────
       │ File: test/__init__.py
───────┼────────────────────────────────────────────────────────────────────────────────────
   1import returns
───────┴────────────────────────────────────────────────────────────────────────────────────

code/python/test is 📦 v0.1.0 via 🐍 v3.10.6 (test-py3.10)
λ mypy test/
Success: no issues found in 1 source file

@sobolevn
Copy link
Member

sobolevn commented Mar 9, 2023

Can you run test/__init__.py with python? python test/__init__.py

@wizard-28
Copy link
Author

Can you run test/__init__.py with python? python test/__init__.py

code/python/test is 📦 v0.1.0 via 🐍 v3.10.6 (test-py3.10)
λ python3 ./test/__init__.py

code/python/test is 📦 v0.1.0 via 🐍 v3.10.6 (test-py3.10)
λ

@sobolevn
Copy link
Member

sobolevn commented Mar 9, 2023

Sorry, I cannot reproduce it :(

@sobolevn
Copy link
Member

sobolevn commented Mar 9, 2023

Can you please create a docker image with this problem?

@aivanoved
Copy link

aivanoved commented Aug 10, 2023

I have encountered the same error, will be trying to make a minimum example (it has been difficult to do so, though)

Setup:

python: 3.11.4
returns: 0.19.0
mypy: 1.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants