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 complains about not explicitly export attributes from __init__.py #82

Open
derlikh-smart opened this issue Nov 8, 2023 · 3 comments

Comments

@derlikh-smart
Copy link

The code

import deepl

translator = deepl.Translator(...)

Produces the following mypy error: error: Module "deepl" does not explicitly export attribute "Translator" [attr-defined]

@JanEbbing
Copy link
Member

Hi, I can't reproduce this (but will add that mypy passes for an example project to our new CI stage).
Could you tell me the deepl and mypy versions please?

I tested the following:

mkdir python_test
cd python_test
python3 -m venv .venv
source .venv/bin/activate
pip install deepl mypy
pip freeze
  certifi==2023.7.22
  charset-normalizer==3.3.2
  deepl==1.16.1
  idna==3.4
  mypy==1.6.1
  mypy-extensions==1.0.0
  requests==2.31.0
  typing_extensions==4.8.0
  urllib3==2.0.7
echo "
import deepl

translator = deepl.Translator('abc')" > script.py
mypy script.py
  Success: no issues found in 1 source file

If I use deepl.Translator(...) with the 3 dots, I get

script.py:4: error: Argument 1 to "Translator" has incompatible type "ellipsis"; expected "str"  [arg-type]
Found 1 error in 1 file (checked 1 source file)

@vad
Copy link

vad commented Nov 17, 2023

@JanEbbing I'm having the same issue. In order to reproduce you need implicit_reexport = false or strict = true in mypy configuration

@JanEbbing
Copy link
Member

Thanks @vad , I changed our pipeline to use strict mypy checking and fixed this issue, will be in the next patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants