Starlette GraphQL
The starlette GraphQL implement, which support query, mutate and subscription. Based on python-gql.
Requirement
Python 3.7+
Installation
pip install starlette-graphql
Getting started
# app.py
from gql import query, gql
from stargql import GraphQL
type_defs = gql("""
type Query {
hello(name: String!): String!
}
""")
@query
async def hello(parent, info, name: str) -> str:
return name
app = GraphQL(type_defs=type_defs)
Use uvicorn to run app.
uvicorn app:app --reload
Upload File
import uvicorn
from gql import gql, mutate
from stargql import GraphQL
type_defs = gql("""
scalar Upload
type File {
filename: String!
}
type Query {
uploads: [File]
}
type Mutation {
singleUpload(file: Upload!): File!
multiUpload(files: [Upload!]!): [File!]!
}
""")
@mutate
def single_upload(parent, info, file):
return file
@mutate
def multi_upload(parent, info, files):
return files
app = GraphQL(type_defs=type_defs)
if __name__ == '__main__':
uvicorn.run(app, port=8080)
Subscription
For more about subscription, please see gql-subscriptions.
Apollo Federation
For more abount subscription, please see Apollo Federation
Metadata
Release files for starlette-graphql 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| starlette-graphql-0.2.1.tar.gz | 6.6 kB | Without provenance | Details for starlette-graphql-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| starlette_graphql-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for starlette_graphql-0.2.1-py3-none-any.whl |
Total release size: 13.8 kB
Release files / starlette-graphql-0.2.1.tar.gz
| Download URL | starlette-graphql-0.2.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8bb233bf202f8655e849247e29874c7fef2038f88df40acfa47cc9ff9fe5f91
|
|
BLAKE2b-256 checksum How to use checksums |
58f9b64a20747111aa342c13672bacc575db429446aedf96f385b961beacb6f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Darwin/20.3.0
|
Release files / starlette_graphql-0.2.1-py3-none-any.whl
| Download URL | starlette_graphql-0.2.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58226bb8a9b1778c7974bb5e89d8a564135d01add8636a5ff0339ca68291da6b
|
|
BLAKE2b-256 checksum How to use checksums |
4b44d4c8e742e933b8021593dbc0e00d2395b6287383abe57d957171dacbed67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Darwin/20.3.0
|
Security for starlette-graphql 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.