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

BaseSettings - pylance complains about missing parameters #3767

Closed
3 tasks done
florian-sattler opened this issue Feb 2, 2022 · 1 comment
Closed
3 tasks done

BaseSettings - pylance complains about missing parameters #3767

florian-sattler opened this issue Feb 2, 2022 · 1 comment
Labels
bug V1 Bug related to Pydantic V1.X

Comments

@florian-sattler
Copy link

Checks

  • I added a descriptive title to this issue
  • I have searched (google, github) for similar issues and couldn't find anything
  • I have read and followed the docs and still think this is a bug

Bug

Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":

             pydantic version: 1.9.0
            pydantic compiled: True
                 install path: /home/user/repo/venv/lib/python3.10/site-packages/pydantic
               python version: 3.10.0 (default, Oct 11 2021, 05:33:59) [GCC 11.2.0]
                     platform: Linux-5.13.0-28-generic-x86_64-with-glibc2.34
     optional deps. installed: ['typing-extensions']

When using base settings in (even without Field see #3617 #3753)

from pydantic import BaseSettings


class MySettings(BaseSettings):
    option_1: str
    option_2: int

    
MySettings()

the resulting class expects the parameters to be provided by the program and not by the environment. Therefore Pylance seems to complain.

image

Btw: I use the basic setting:

"python.analysis.typeCheckingMode": "basic",
"python.languageServer": "Pylance",

The addition of parameters in BaseModel is welcome change, however I don't think the BaseSettings class should be affected as well.

@samuelcolvin
Copy link
Member

samuelcolvin commented Apr 2, 2022

closing as a duplicate of #3753 which has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X
Projects
None yet
Development

No branches or pull requests

2 participants