Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Deprecate read_env_file and move it to DotEnvSettingsSource #318

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

WarpedPixel
Copy link
Contributor

@WarpedPixel WarpedPixel commented Jun 20, 2024

Fixes #296
Adds a method _read_env_file to DotEnvSettingsSource that can be easily overridden.
This fix keeps a global function so it can continue to be tested, but adds an underscore to the name.
The plain read_env_file is marked as deprecated.

Selected Reviewer: @samuelcolvin

@WarpedPixel WarpedPixel force-pushed the WarpedPixel/issue296 branch from 3b2d7c3 to 1bc1e99 Compare June 25, 2024 17:44
@WarpedPixel
Copy link
Contributor Author

please review

WarpedPixel added 4 commits July 1, 2024 11:36
Fixes pydantic#296
Adds a method _read_env_file to DotEnvSettingsSource that can be easily overridden.
This fix keeps a global function so it can continue to be tested, but adds an underscore to the name.
The plain read_env_file is marked as deprecated.
Fixes pydantic#296
Added test and moved bulk of dotenv code into DotEnvSettingsSource so future deprecation will be cleaner
@WarpedPixel WarpedPixel force-pushed the WarpedPixel/issue296 branch from b7912c9 to 33f5646 Compare July 1, 2024 18:36
@hramezani hramezani changed the title Can't read Pydantic Settings from stdin Deprecate read_env_file and move it to DotEnvSettingsSource Jul 2, 2024
@hramezani hramezani merged commit d6db0f9 into pydantic:main Jul 2, 2024
18 checks passed
@hramezani
Copy link
Member

Thanks @WarpedPixel

@WarpedPixel WarpedPixel deleted the WarpedPixel/issue296 branch July 2, 2024 18:43
mr-kamran-ali referenced this pull request in robert-koch-institut/mex-common Aug 8, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [pydantic-settings](https://github.com/pydantic/pydantic-settings)
([changelog](https://github.com/pydantic/pydantic-settings/releases))
| project.dependencies | minor | `==2.3.4` -> `==2.4.0` |

---

### Release Notes

<details>
<summary>pydantic/pydantic-settings (pydantic-settings)</summary>

###
[`v2.4.0`](https://github.com/pydantic/pydantic-settings/releases/tag/v2.4.0)

[Compare
Source](https://github.com/pydantic/pydantic-settings/compare/v2.3.4...v2.4.0)

#### What's Changed

- Fix regex flags accidentally passed as count by
[@&#8203;musicinmybrain](https://github.com/musicinmybrain) in
[https://github.com/pydantic/pydantic-settings/pull/328](https://github.com/pydantic/pydantic-settings/pull/328)
- Deprecate `read_env_file` and move it to `DotEnvSettingsSource` by
[@&#8203;WarpedPixel](https://github.com/WarpedPixel) in
[https://github.com/pydantic/pydantic-settings/pull/318](https://github.com/pydantic/pydantic-settings/pull/318)
- Fix a bug when loading empty yaml file by
[@&#8203;hramezani](https://github.com/hramezani) in
[https://github.com/pydantic/pydantic-settings/pull/330](https://github.com/pydantic/pydantic-settings/pull/330)
- feat: Enable access to the current state in settings sources by
[@&#8203;VictorColomb](https://github.com/VictorColomb) in
[https://github.com/pydantic/pydantic-settings/pull/326](https://github.com/pydantic/pydantic-settings/pull/326)
- Add support for short options. by
[@&#8203;kschwab](https://github.com/kschwab) in
[https://github.com/pydantic/pydantic-settings/pull/339](https://github.com/pydantic/pydantic-settings/pull/339)
- Add Azure Key Vault settings source by
[@&#8203;AndreuCodina](https://github.com/AndreuCodina) in
[https://github.com/pydantic/pydantic-settings/pull/272](https://github.com/pydantic/pydantic-settings/pull/272)
- Add cli_exit_on_error config option by
[@&#8203;kschwab](https://github.com/kschwab) in
[https://github.com/pydantic/pydantic-settings/pull/340](https://github.com/pydantic/pydantic-settings/pull/340)

#### New Contributors

- [@&#8203;musicinmybrain](https://github.com/musicinmybrain) made
their first contribution in
[https://github.com/pydantic/pydantic-settings/pull/328](https://github.com/pydantic/pydantic-settings/pull/328)
- [@&#8203;WarpedPixel](https://github.com/WarpedPixel) made their
first contribution in
[https://github.com/pydantic/pydantic-settings/pull/318](https://github.com/pydantic/pydantic-settings/pull/318)
- [@&#8203;VictorColomb](https://github.com/VictorColomb) made their
first contribution in
[https://github.com/pydantic/pydantic-settings/pull/326](https://github.com/pydantic/pydantic-settings/pull/326)
- [@&#8203;AndreuCodina](https://github.com/AndreuCodina) made their
first contribution in
[https://github.com/pydantic/pydantic-settings/pull/272](https://github.com/pydantic/pydantic-settings/pull/272)

**Full Changelog**:
pydantic/pydantic-settings@v2.3.4...v2.4.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://github.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yMC4xIiwidXBkYXRlZEluVmVyIjoiMzguMjEuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't read Pydantic Settings from stdin
3 participants