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

Add support for adding config through class kwargs #112

Merged
merged 2 commits into from
Jul 7, 2023

Conversation

hramezani
Copy link
Member

@hramezani hramezani commented Jul 7, 2023

Closes #110

Selected Reviewer: @dmontagu

@codecov
Copy link

codecov bot commented Jul 7, 2023

Codecov Report

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

Comparison is base (026ce3f) 97.42% compared to head (11d591c) 97.44%.

❗ Current head 11d591c differs from pull request most recent head 79c186d. Consider uploading reports for the commit 79c186d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #112      +/-   ##
==========================================
+ Coverage   97.42%   97.44%   +0.01%     
==========================================
  Files           5        5              
  Lines         311      313       +2     
  Branches       68       68              
==========================================
+ Hits          303      305       +2     
  Misses          6        6              
  Partials        2        2              
Impacted Files Coverage Δ
pydantic_settings/main.py 100.00% <100.00%> (ø)

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

@hramezani
Copy link
Member Author

please review

Comment on lines 31 to 33
# Extend config_keys by pydantic settings config keys to
# support setting config through class kwargs.
config_keys |= set(SettingsConfigDict.__annotations__.keys())
Copy link
Member

Choose a reason for hiding this comment

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

This seems super magical... Can you add a reference to the pydantic code that we are using here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I improved the comment and explained it more by mentioning the class and method name that the magic happen there on Pydantic.

Please let me know by comment or suggestion if you think it is not clear yet.

@hramezani hramezani requested a review from Kludex July 7, 2023 12:08
@hramezani hramezani merged commit 2303f50 into main Jul 7, 2023
18 checks passed
@hramezani hramezani deleted the config_through_class_kwargs branch July 7, 2023 12:30
@jordantshaw
Copy link

Which release is this going with? @hramezani

@hramezani
Copy link
Member Author

Which release is this going with? @hramezani

Next release will happen soon and this will be included

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

Successfully merging this pull request may close these issues.

Support setting model through class kwargs
4 participants