-
Notifications
You must be signed in to change notification settings - Fork 1
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
Should strip whitespace #13
Comments
Thank you! This is definitely a bug. |
Btw, I just checked that def test_str_strip_whitespace_not_respected(secrets_dir):
class Settings(BaseSettings):
key: str
model_config = SettingsConfigDict(
secrets_dir=secrets_dir,
str_strip_whitespace=False,
)
secrets_dir.add_files(
('key', ' value '),
)
conf = Settings()
assert conf.key == 'value' # str_strip_whitespace not respected |
@FichteFoll thank you for the bug report. The fix was trivial and already merged to main branch. I will update PyPI release as soon as all bugs reported will be fixed (a couple of days at most). Thank you for your interest in the package! |
Indeed, it was simply always stripped. Perhaps this is an upstream bug. I simply monkey-patched Thanks for adapting this into a package until this feature hopefully lands in the mainline pydantic-settings project. |
The new version 0.3.0 with all your suggestions and bug reports fixed is released on PyPI.
There's already a PR to |
The default implementation of
SecretsSettingsSource
strips the read file contents of any whitespace but this one here does not.Setting
str_strip_whitespace
in themodel_config
does not seem to have any effect on this either.The text was updated successfully, but these errors were encountered: