10000 Deprecate built-in GraphQL support by JayH5 · Pull Request #1135 · encode/starlette · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Deprecate built-in GraphQL support #1135

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

Merged
merged 3 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/graphql.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@

!!! Warning

GraphQL support in Starlette is **deprecated** as of version 0.15 and will
be removed in a future release. Please consider using a third-party library
to provide GraphQL support. This is usually done by mounting a GraphQL ASGI
application. See [#619](https://github.com/encode/starlette/issues/619).
Some example libraries are:

* [Ariadne](https://ariadnegraphql.org/docs/asgi)
* [`tartiflette-asgi`](https://tartiflette.github.io/tartiflette-asgi/)
* [Strawberry](https://strawberry.rocks/docs/integrations/asgi)
* [`starlette-graphene3`](https://github.com/ciscorn/starlette-graphene3)

Starlette includes optional support for GraphQL, using the `graphene` library.

Here's an example of integrating the support into your application.
Expand Down
2 changes: 0 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ It is production-ready, and gives you the following:

* Seriously impressive performance.
* WebSocket support.
* GraphQL support.
* In-process background tasks.
* Startup and shutdown events.
* Test client built on `requests`.
Expand Down Expand Up @@ -88,7 +87,6 @@ Starlette does not have any hard dependencies, but the following are optional:
* [`python-multipart`][python-multipart] - Required if you want to support form parsing, with `request.form()`.
* [`itsdangerous`][itsdangerous] - Required for `SessionMiddleware` support.
* [`pyyaml`][pyyaml] - Required for `SchemaGenerator` support.
* [`graphene`][graphene] - Required for `GraphQLApp` support.

You can install all of these with `pip3 install starlette[full]`.

Expand Down
9 changes: 9 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 0.15.0

Unreleased

### Deprecated

* Built-in GraphQL support via the `GraphQLApp` class has been deprecated and will be removed in a
future release. Please see [#619](https://github.com/encode/starlette/issues/619).

## 0.14.2

February 2, 2021
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ markdown_extensions:
- markdown.extensions.codehilite:
guess_lang: false
- mkautodoc
- admonition
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to get the nice warning message to render:
Screenshot 2021-02-03 at 22 00 21


extra_javascript:
- 'js/chat.js'
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ filterwarnings=
error
# https://github.com/Tinche/aiofiles/issues/81
ignore: "@coroutine" decorator is deprecated.*:DeprecationWarning
# https://github.com/graphql-python/graphene/issues/1055
# Deprecated GraphQL (including https://github.com/graphql-python/graphene/issues/1055)
ignore: GraphQLApp is deprecated and will be removed in a future release\..*:DeprecationWarning
ignore: Using or importing the ABCs from 'collections' instead of from 'collections\.abc' is deprecated.*:DeprecationWarning
ignore: The 'context' alias has been deprecated. Please use 'context_value' instead\.:DeprecationWarning
ignore: The 'variables' alias has been deprecated. Please use 'variable_values' instead\.:DeprecationWarning
8 changes: 8 additions & 0 deletions starlette/graphql.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import typing
import warnings

from starlette import status
from starlette.background import BackgroundTasks
Expand All @@ -8,6 +9,13 @@
from starlette.responses import HTMLResponse, JSONResponse, PlainTextResponse, Response
from starlette.types import Receive, Scope, Send

warnings.warn(
"GraphQLApp is deprecated and will be removed in a future release. "
"Consider using a third-party GraphQL implementation. "
"See https://github.com/encode/starlette/issues/619.",
DeprecationWarning,
)

try:
import graphene
from graphql.error import GraphQLError, format_error as format_graphql_error
Expand Down
0