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

Bump fastapi from 0.73.0 to 0.74.0 #306

Merged
merged 1 commit into from Feb 21, 2022

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Feb 21, 2022

Bumps fastapi from 0.73.0 to 0.74.0.

Release notes

Sourced from fastapi's releases.

0.74.0

Breaking Changes

  • ✨ Update internal AsyncExitStack to fix context for dependencies with yield. PR #4575 by @​tiangolo.

Dependencies with yield can now catch HTTPException and custom exceptions. For example:

async def get_database():
    with Session() as session:
        try:
            yield session
        except HTTPException:
            session.rollback()
            raise
        finally:
            session.close()

After the dependency with yield handles the exception (or not) the exception is raised again. So that any exception handlers can catch it, or ultimately the default internal ServerErrorMiddleware.

If you depended on exceptions not being received by dependencies with yield, and receiving an exception breaks the code after yield, you can use a block with try and finally:

async def do_something():
    try:
        yield something
    finally:
        some_cleanup()

...that way the finally block is run regardless of any exception that might happen.

Features

  • The same PR #4575 from above also fixes the contextvars context for the code before and after yield. This was the main objective of that PR.

This means that now, if you set a value in a context variable before yield, the value would still be available after yield (as you would intuitively expect). And it also means that you can reset the context variable with a token afterwards.

For example, this works correctly now:

from contextvars import ContextVar
from typing import Any, Dict, Optional
legacy_request_state_context_var: ContextVar[Optional[Dict[str, Any]]] = ContextVar(
"legacy_request_state_context_var", default=None
)
</tr></table>

... (truncated)

Commits
  • 1ce16c2 🔖 Release version 0.74.0
  • 03d4d4c 📝 Update release notes
  • 2d2f1de 📝 Update release notes
  • 59e3648 🔧 Add Striveworks sponsor (#4596)
  • 4fcb003 📝 Update release notes
  • 9d56a3c ✨ Update internal AsyncExitStack to fix context for dependencies with `yiel...
  • 78b07cb 📝 Update release notes
  • 6034f80 💚 Only build docs on push when on master to avoid duplicate runs from PRs (#4...
  • b93f8a7 📝 Update release notes
  • 618c99d 👥 Update FastAPI People (#4502)
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.73.0 to 0.74.0.
- [Release notes](https://github.com/tiangolo/fastapi/releases)
- [Commits](tiangolo/fastapi@0.73.0...0.74.0)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Feb 21, 2022
@MartinHjelmare MartinHjelmare merged commit 0780f7b into master Feb 21, 2022
@dependabot dependabot bot deleted the dependabot/pip/fastapi-0.74.0 branch February 21, 2022 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant