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

Add flask async view #1907

Merged

Conversation

scottweitzner
Copy link
Contributor

Description

MR to address issue #1903

Adds a new async-enabled view for use with Flask. This is specifically helpful when using async dataloaders to handle n+1 cases in your schema

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

#1903

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@botberry
Copy link
Member

botberry commented May 11, 2022

Thanks for adding the RELEASE.md file!

Here's a preview of the changelog:


This release adds a new flask view to allow for aysnc dispatching of requests.

This is especially useful when using dataloaders with flask.

from strawberry.flask.views import AsyncGraphQLView

...

app.add_url_rule("/graphql", view_func=AsyncGraphQLView.as_view("graphql_view", schema=schema, **kwargs))

Here's the preview release card for twitter:

Here's the tweet text:

🆕 Release (next) is out! Thanks to Scott Weitzner for the PR 👏

Get it here 👉 https://github.com/strawberry-graphql/strawberry/releases/tag/(next)

@codecov
Copy link

codecov bot commented May 11, 2022

Codecov Report

Merging #1907 (2b45b61) into main (05c94ae) will decrease coverage by 0.13%.
The diff coverage is 75.00%.

@@            Coverage Diff             @@
##             main    #1907      +/-   ##
==========================================
- Coverage   98.17%   98.04%   -0.14%     
==========================================
  Files         143      143              
  Lines        5530     5562      +32     
  Branches     1017     1023       +6     
==========================================
+ Hits         5429     5453      +24     
- Misses         50       56       +6     
- Partials       51       53       +2     

Copy link
Member

@patrick91 patrick91 left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Can you add some docs here? https://strawberry.rocks/docs/integrations/flask

then it will be ready to merge 😊

RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
strawberry/flask/views.py Show resolved Hide resolved
@scottweitzner
Copy link
Contributor Author

@patrick91 Added a few more tests to get that coverage up and also added the docs. Thank you for making this an enjoyable process to contribute back. Looking forward to making more contributions down the line

Copy link
Member

@estyxx estyxx left a comment

Choose a reason for hiding this comment

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

Thank you for this PR! I added a couple of comments :)

docs/integrations/flask.md Outdated Show resolved Hide resolved
Copy link
Member

@patrick91 patrick91 left a comment

Choose a reason for hiding this comment

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

Looks great! I took the liberty of applying @estyxx suggestions 😊 will merge in a bit :)

@patrick91 patrick91 merged commit 7575763 into strawberry-graphql:main May 15, 2022
@botberry
Copy link
Member

Thanks for contributing to Strawberry! 🎉 You've been invited to join
the Strawberry GraphQL organisation 😊

You can also request a free sticker by filling this form: https://forms.gle/dmnfQUPoY5gZbVT67

And don't forget to join our discord server: https://strawberry.rocks/discord 🔥

@scottweitzner
Copy link
Contributor Author

Looks great! I took the liberty of applying @estyxx suggestions 😊 will merge in a bit :)

Thanks all!

@DoctorJohn DoctorJohn mentioned this pull request May 27, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants