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

Considering extra config in dotenv source #39

Merged
merged 2 commits into from
May 2, 2023

Conversation

hramezani
Copy link
Member

Fixes #11

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.12 🎉

Comparison is base (0ff45ea) 95.25% compared to head (b0b5d02) 95.37%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #39      +/-   ##
==========================================
+ Coverage   95.25%   95.37%   +0.12%     
==========================================
  Files           5        5              
  Lines         295      303       +8     
  Branches       74       78       +4     
==========================================
+ Hits          281      289       +8     
  Misses         12       12              
  Partials        2        2              
Impacted Files Coverage Δ
pydantic_settings/sources.py 95.34% <100.00%> (+0.14%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise seems ok

pydantic_settings/sources.py Show resolved Hide resolved
# As `extra` config is allowed in dotenv settings source, We have to
# update data with extra env variabels from dotenv file.
for k, v in self.env_vars.items():
if v is not None and k not in data:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why v is not None?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise test_env_file_none fails

@hramezani
Copy link
Member Author

I've added a commit and changed the logic to handle case insensitive and sub-model

@samuelcolvin samuelcolvin merged commit 45f63f9 into pydantic:main May 2, 2023
18 checks passed
@samuelcolvin
Copy link
Member

thanks so much.

@hramezani hramezani deleted the dotenv_extra branch May 2, 2023 19:15
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

Successfully merging this pull request may close these issues.

Extra.Forbid is not applied when using BaseSettings with Config.env_file defined
3 participants