Pylint complains about "No name 'SecretStr' in module 'pydantic'"
See original GitHub issueBug
Pylint complains about missing pydantic data types but they can be used without problems.
I see this problem inside this Docker image: tiangolo/uvicorn-gunicorn-fastapi:python3.7
. It does not occur in my dev environment under MacOS.
Please complete:
- OS: Linux
- Python version
import sys; print(sys.version)
: *3.7.4 - Pydantic version
import pydantic; print(pydantic.VERSION)
: 0.32.2
Where possible please include a self contained code snippet describing your bug
Put this content into app.py
:
"""app.py"""
from pydantic import SecretStr
SECRET = SecretStr('ab')
Then install pylint with pip install pylint
and run pylint app.py
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Pylint complains about "No name 'SecretStr' in module ...
Bug Pylint complains about missing pydantic data types but they can be used without problems. I see this problem inside this Docker image: ......
Read more >pylint-pydantic - PyPI
A Pylint plugin to help Pylint understand the Pydantic. ... How to resolve pylint: No name 'BaseModel' in module 'pydantic' ?
Read more >"No name in module" error from Pylint - python - Stack Overflow
@TerryJanReedy, I know that import utils; utils.stuff won't work. I am curious as to why my code runs without exceptions, but it has...
Read more >How to use pydantic to read environment variables and secret ...
To read environment variables, a common way is to use the os module: If the environment variable does not exist, using os.environ will...
Read more >How Can Mypy Accept Pydantic'S Constr Types? - ADocLib
One of the most common complaints about the Python language is that variables are Dynamically Typed. That means you declare variables without giving...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
--extension-pkg-whitelist=pydantic
solves this.Just for the sake of completeness, here is the explanation to why this option is required: http://pylint.pycqa.org/en/latest/technical_reference/c_extensions.html