summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-05 04:10:42 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-05 04:10:42 +0000
commitba3b0850020d1da6bbc2572ea39e4281eac1eaeb (patch)
tree69de55f0d9cf435862fd1bf025fa7d05a859c950
parent2a375cd798cfb91a67bd6f43ea0365008a6e8ee3 (diff)
automatic import of python-starlette-graphene3openeuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-starlette-graphene3.spec399
-rw-r--r--sources1
3 files changed, 401 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..194dbd8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/starlette-graphene3-0.6.0.tar.gz
diff --git a/python-starlette-graphene3.spec b/python-starlette-graphene3.spec
new file mode 100644
index 0000000..41dba63
--- /dev/null
+++ b/python-starlette-graphene3.spec
@@ -0,0 +1,399 @@
+%global _empty_manifest_terminate_build 0
+Name: python-starlette-graphene3
+Version: 0.6.0
+Release: 1
+Summary: Use Graphene v3 on Starlette
+License: MIT
+URL: https://github.com/ciscorn/starlette-graphene3
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a9/3c/f216ea04650e56de248bc6995ee87652e7002693198d8edc1076f650c29c/starlette-graphene3-0.6.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-graphene
+Requires: python3-graphql-core
+Requires: python3-starlette
+
+%description
+# starlette-graphene3
+
+A simple ASGI app for using [Graphene](https://github.com/graphql-python/graphene) v3 with [Starlette](https://github.com/encode/starlette) / [FastAPI](https://github.com/tiangolo/fastapi).
+
+![Test](https://github.com/ciscorn/starlette-graphene3/actions/workflows/test.yml/badge.svg?branch=master)
+[![codecov](https://codecov.io/gh/ciscorn/starlette-graphene3/branch/master/graph/badge.svg)](https://codecov.io/gh/ciscorn/starlette-graphene3)
+[![pypi package](https://img.shields.io/pypi/v/starlette-graphene3?color=%2334D058&label=pypi%20package)](https://pypi.org/project/starlette-graphene3)
+
+It supports:
+
+- Queries and Mutations (over HTTP or WebSocket)
+- Subscriptions (over WebSocket)
+- File uploading (https://github.com/jaydenseric/graphql-multipart-request-spec)
+- GraphiQL / GraphQL Playground
+
+File uploading requires `python-multipart` to be installed.
+## Alternatives
+
+- [tartiflette](https://github.com/tartiflette/tartiflette) &mdash; Python GraphQL Engine by dailymotion
+- [tartiflette-asgi](https://github.com/tartiflette/tartiflette-asgi)
+
+
+## Installation
+
+```bash
+pip3 install -U starlette-graphene3
+```
+
+
+## Example
+
+```python
+import asyncio
+
+import graphene
+from graphene_file_upload.scalars import Upload
+
+from starlette.applications import Starlette
+from starlette_graphene3 import GraphQLApp, make_graphiql_handler
+
+
+class User(graphene.ObjectType):
+ id = graphene.ID()
+ name = graphene.String()
+
+
+class Query(graphene.ObjectType):
+ me = graphene.Field(User)
+
+ def resolve_me(root, info):
+ return {"id": "john", "name": "John"}
+
+
+class FileUploadMutation(graphene.Mutation):
+ class Arguments:
+ file = Upload(required=True)
+
+ ok = graphene.Boolean()
+
+ def mutate(self, info, file, **kwargs):
+ return FileUploadMutation(ok=True)
+
+
+class Mutation(graphene.ObjectType):
+ upload_file = FileUploadMutation.Field()
+
+
+class Subscription(graphene.ObjectType):
+ count = graphene.Int(upto=graphene.Int())
+
+ async def subscribe_count(root, info, upto=3):
+ for i in range(upto):
+ yield i
+ await asyncio.sleep(1)
+
+
+app = Starlette()
+schema = graphene.Schema(query=Query, mutation=Mutation, subscription=Subscription)
+
+app.mount("/", GraphQLApp(schema, on_get=make_graphiql_handler())) # Graphiql IDE
+
+# app.mount("/", GraphQLApp(schema, on_get=make_playground_handler())) # Playground IDE
+# app.mount("/", GraphQLApp(schema)) # no IDE
+```
+
+## GraphQLApp
+
+`GraphQLApp(schema, [options...])`
+
+```python
+class GraphQLApp:
+ def __init__(
+ self,
+ schema: graphene.Schema, # Requied
+ *,
+ # Optional keyword parameters
+ on_get: Optional[
+ Callable[[Request], Union[Response, Awaitable[Response]]]
+ ] = None, # optional HTTP handler for GET requests
+ context_value: ContextValue = None,
+ root_value: RootValue = None,
+ middleware: Optional[Middleware] = None,
+ error_formatter: Callable[[GraphQLError], Dict[str, Any]] = format_error,
+ logger_name: Optional[str] = None,
+ playground: bool = False, # deprecating
+ execution_context_class: Optional[Type[ExecutionContext]] = None,
+ ):
+```
+
+
+%package -n python3-starlette-graphene3
+Summary: Use Graphene v3 on Starlette
+Provides: python-starlette-graphene3
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-starlette-graphene3
+# starlette-graphene3
+
+A simple ASGI app for using [Graphene](https://github.com/graphql-python/graphene) v3 with [Starlette](https://github.com/encode/starlette) / [FastAPI](https://github.com/tiangolo/fastapi).
+
+![Test](https://github.com/ciscorn/starlette-graphene3/actions/workflows/test.yml/badge.svg?branch=master)
+[![codecov](https://codecov.io/gh/ciscorn/starlette-graphene3/branch/master/graph/badge.svg)](https://codecov.io/gh/ciscorn/starlette-graphene3)
+[![pypi package](https://img.shields.io/pypi/v/starlette-graphene3?color=%2334D058&label=pypi%20package)](https://pypi.org/project/starlette-graphene3)
+
+It supports:
+
+- Queries and Mutations (over HTTP or WebSocket)
+- Subscriptions (over WebSocket)
+- File uploading (https://github.com/jaydenseric/graphql-multipart-request-spec)
+- GraphiQL / GraphQL Playground
+
+File uploading requires `python-multipart` to be installed.
+## Alternatives
+
+- [tartiflette](https://github.com/tartiflette/tartiflette) &mdash; Python GraphQL Engine by dailymotion
+- [tartiflette-asgi](https://github.com/tartiflette/tartiflette-asgi)
+
+
+## Installation
+
+```bash
+pip3 install -U starlette-graphene3
+```
+
+
+## Example
+
+```python
+import asyncio
+
+import graphene
+from graphene_file_upload.scalars import Upload
+
+from starlette.applications import Starlette
+from starlette_graphene3 import GraphQLApp, make_graphiql_handler
+
+
+class User(graphene.ObjectType):
+ id = graphene.ID()
+ name = graphene.String()
+
+
+class Query(graphene.ObjectType):
+ me = graphene.Field(User)
+
+ def resolve_me(root, info):
+ return {"id": "john", "name": "John"}
+
+
+class FileUploadMutation(graphene.Mutation):
+ class Arguments:
+ file = Upload(required=True)
+
+ ok = graphene.Boolean()
+
+ def mutate(self, info, file, **kwargs):
+ return FileUploadMutation(ok=True)
+
+
+class Mutation(graphene.ObjectType):
+ upload_file = FileUploadMutation.Field()
+
+
+class Subscription(graphene.ObjectType):
+ count = graphene.Int(upto=graphene.Int())
+
+ async def subscribe_count(root, info, upto=3):
+ for i in range(upto):
+ yield i
+ await asyncio.sleep(1)
+
+
+app = Starlette()
+schema = graphene.Schema(query=Query, mutation=Mutation, subscription=Subscription)
+
+app.mount("/", GraphQLApp(schema, on_get=make_graphiql_handler())) # Graphiql IDE
+
+# app.mount("/", GraphQLApp(schema, on_get=make_playground_handler())) # Playground IDE
+# app.mount("/", GraphQLApp(schema)) # no IDE
+```
+
+## GraphQLApp
+
+`GraphQLApp(schema, [options...])`
+
+```python
+class GraphQLApp:
+ def __init__(
+ self,
+ schema: graphene.Schema, # Requied
+ *,
+ # Optional keyword parameters
+ on_get: Optional[
+ Callable[[Request], Union[Response, Awaitable[Response]]]
+ ] = None, # optional HTTP handler for GET requests
+ context_value: ContextValue = None,
+ root_value: RootValue = None,
+ middleware: Optional[Middleware] = None,
+ error_formatter: Callable[[GraphQLError], Dict[str, Any]] = format_error,
+ logger_name: Optional[str] = None,
+ playground: bool = False, # deprecating
+ execution_context_class: Optional[Type[ExecutionContext]] = None,
+ ):
+```
+
+
+%package help
+Summary: Development documents and examples for starlette-graphene3
+Provides: python3-starlette-graphene3-doc
+%description help
+# starlette-graphene3
+
+A simple ASGI app for using [Graphene](https://github.com/graphql-python/graphene) v3 with [Starlette](https://github.com/encode/starlette) / [FastAPI](https://github.com/tiangolo/fastapi).
+
+![Test](https://github.com/ciscorn/starlette-graphene3/actions/workflows/test.yml/badge.svg?branch=master)
+[![codecov](https://codecov.io/gh/ciscorn/starlette-graphene3/branch/master/graph/badge.svg)](https://codecov.io/gh/ciscorn/starlette-graphene3)
+[![pypi package](https://img.shields.io/pypi/v/starlette-graphene3?color=%2334D058&label=pypi%20package)](https://pypi.org/project/starlette-graphene3)
+
+It supports:
+
+- Queries and Mutations (over HTTP or WebSocket)
+- Subscriptions (over WebSocket)
+- File uploading (https://github.com/jaydenseric/graphql-multipart-request-spec)
+- GraphiQL / GraphQL Playground
+
+File uploading requires `python-multipart` to be installed.
+## Alternatives
+
+- [tartiflette](https://github.com/tartiflette/tartiflette) &mdash; Python GraphQL Engine by dailymotion
+- [tartiflette-asgi](https://github.com/tartiflette/tartiflette-asgi)
+
+
+## Installation
+
+```bash
+pip3 install -U starlette-graphene3
+```
+
+
+## Example
+
+```python
+import asyncio
+
+import graphene
+from graphene_file_upload.scalars import Upload
+
+from starlette.applications import Starlette
+from starlette_graphene3 import GraphQLApp, make_graphiql_handler
+
+
+class User(graphene.ObjectType):
+ id = graphene.ID()
+ name = graphene.String()
+
+
+class Query(graphene.ObjectType):
+ me = graphene.Field(User)
+
+ def resolve_me(root, info):
+ return {"id": "john", "name": "John"}
+
+
+class FileUploadMutation(graphene.Mutation):
+ class Arguments:
+ file = Upload(required=True)
+
+ ok = graphene.Boolean()
+
+ def mutate(self, info, file, **kwargs):
+ return FileUploadMutation(ok=True)
+
+
+class Mutation(graphene.ObjectType):
+ upload_file = FileUploadMutation.Field()
+
+
+class Subscription(graphene.ObjectType):
+ count = graphene.Int(upto=graphene.Int())
+
+ async def subscribe_count(root, info, upto=3):
+ for i in range(upto):
+ yield i
+ await asyncio.sleep(1)
+
+
+app = Starlette()
+schema = graphene.Schema(query=Query, mutation=Mutation, subscription=Subscription)
+
+app.mount("/", GraphQLApp(schema, on_get=make_graphiql_handler())) # Graphiql IDE
+
+# app.mount("/", GraphQLApp(schema, on_get=make_playground_handler())) # Playground IDE
+# app.mount("/", GraphQLApp(schema)) # no IDE
+```
+
+## GraphQLApp
+
+`GraphQLApp(schema, [options...])`
+
+```python
+class GraphQLApp:
+ def __init__(
+ self,
+ schema: graphene.Schema, # Requied
+ *,
+ # Optional keyword parameters
+ on_get: Optional[
+ Callable[[Request], Union[Response, Awaitable[Response]]]
+ ] = None, # optional HTTP handler for GET requests
+ context_value: ContextValue = None,
+ root_value: RootValue = None,
+ middleware: Optional[Middleware] = None,
+ error_formatter: Callable[[GraphQLError], Dict[str, Any]] = format_error,
+ logger_name: Optional[str] = None,
+ playground: bool = False, # deprecating
+ execution_context_class: Optional[Type[ExecutionContext]] = None,
+ ):
+```
+
+
+%prep
+%autosetup -n starlette-graphene3-0.6.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-starlette-graphene3 -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.6.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..48bdb8d
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+d40834f268f05bd237c3af4c41e20637 starlette-graphene3-0.6.0.tar.gz