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

Added support for direct initialization #23

Merged
merged 8 commits into from
Jan 13, 2023

Conversation

apollo13
Copy link
Contributor

@apollo13 apollo13 commented Jan 8, 2023

This is a re-implementation of #14 without any backwards incompatible changes (aside from a pydantic version increase)

elif load:
return self.load()

_config_file: str | None = PrivateAttr()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This requires Pydantic 1.7, if this is not okay for you then I can work around this.

tests/test_goodconf.py Show resolved Hide resolved
tests/test_goodconf.py Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2023

Codecov Report

Merging #23 (19673f7) into main (993d745) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main       #23   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          437       482   +45     
  Branches        50        52    +2     
=========================================
+ Hits           437       482   +45     
Impacted Files Coverage Δ
goodconf/__init__.py 100.00% <100.00%> (ø)
goodconf/contrib/django.py 100.00% <100.00%> (ø)
tests/test_files.py 100.00% <100.00%> (ø)
tests/test_goodconf.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

pyproject.toml Outdated
@@ -21,7 +21,7 @@ classifiers = [
]
dynamic = ["version"]
dependencies = [
"pydantic>=1.0"
"pydantic>=1.7,<2.0"
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure 2.0 will be breaking for our use case? I'm hesitant to add the upper version restriction.

env_settings,
file_config_settings_source,
file_secret_settings,
)
Copy link
Member

Choose a reason for hiding this comment

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

Could you document the precedence here in the README?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just looked at the README and it already documents the precedence of env over files. I'd prefer not to document anything else currently and wait to see if pydantic 2 would require further changes. In the same sense I would not document initialization via __init__ now. Everyone using this library and knows pydantic can use it, but let's wait and see what pydantic 2 does before making this an official feature.

@apollo13
Copy link
Contributor Author

apollo13 commented Jan 11, 2023 via email

@ipmb ipmb merged commit 44d3590 into lincolnloop:main Jan 13, 2023
@ipmb
Copy link
Member

ipmb commented Jan 13, 2023

@apollo13 could you update CHANGES.rst and I can cut a new release? We should probably call this 2.1.0

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.

3 participants