-
-
Notifications
You must be signed in to change notification settings - Fork 953
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
warn instead of raise for missing env file #2485
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kludex
approved these changes
Feb 6, 2024
Thanks. |
3 tasks
Thanks & sorry for the churn. |
@Kludex Could you pls release the fixed version asap? (maybe even backport to 0.36.x releases, since it's used by latest FastsAPI v0.109.2) |
This was referenced Feb 9, 2024
Merged
nixroxursox
pushed a commit
to nixroxursox/starlette
that referenced
this pull request
Mar 18, 2024
tvasenin
added a commit
to tvasenin/fastapi
that referenced
this pull request
Mar 19, 2024
v0.36.0 to v0.37.0 had a regression failing on missing .env file. Fixed in v0.37.1: encode/starlette#2485
br3ndonland
added a commit
to br3ndonland/fastenv
that referenced
this pull request
Apr 7, 2024
Starlette 0.37 modifies the exception handling behavior of the `Config` class used for application settings. The `Config` class accepts an `env_file` arg that can be used to load environment variables from a "dotenv" (`.env`) file. Previously, if the file was not found, the `Config` class would silently pass without any exception. In 0.36, the `Config` class was updated to raise a `FileNotFoundError` exception if `env_file` was not not found. This was a breaking change but was not documented as such (encode/starlette#2422, encode/starlette#2446). In 0.37, the exception handling behavior has been changed again to raise a warning instead of an exception (encode/starlette#2485), which could also be a breaking change if users had rewritten their code to catch the `FileNotFoundError`. This commit will update the comparisons docs to explain that a warning will now be raised, and will link to the relevant code changes.
br3ndonland
added a commit
to br3ndonland/inboard
that referenced
this pull request
Apr 8, 2024
This commit will update/upgrade to [FastAPI 0.110.1](https://fastapi.tiangolo.com/release-notes/) and [Starlette 0.37.2](https://www.starlette.io/release-notes/). FastAPI 0.110 makes a change to dependencies with `yield` and `except`. Dependencies must now raise exceptions after `except`. This change is intended to address memory leak issues and may be a breaking change in some projects if dependencies with `yield` and `except` used `pass` instead of `raise`. See the [FastAPI docs](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield/) for further info. FastAPI 0.110.1 makes a small type annotation change to the `Depends` dependency class. Starlette 0.37 modifies the exception handling behavior of the `Config` class used for application settings. The `Config` class accepts an `env_file` arg that can be used to load environment variables from a "dotenv" (`.env`) file. Previously, if the file was not found, the `Config` class would silently pass without any exception. In 0.36, the `Config` class was updated to raise a `FileNotFoundError` exception if `env_file` was not not found. This was a breaking change but was not documented as such (encode/starlette#2422, encode/starlette#2446). In 0.37, the exception handling behavior has been changed again to raise a warning instead of an exception (encode/starlette#2485), which could also be a breaking change if users had rewritten their code to catch the `FileNotFoundError`. See the [fastenv docs](https://fastenv.bws.bio/comparisons#starlette) for a detailed description of the Starlette `Config` class. Note that FastAPI updated the Starlette minor version from 0.36 to 0.37 in the 0.110.1 patch release.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adresses #2422
Let me know if you want a custom Warning and/ or any doc changes.
Checklist