Package: tartiflette-asgi
tartiflette-asgiis a wrapper that provides ASGI support for theTartiflettePython GraphQL engine.It is ideal for serving a GraphQL API over HTTP, or adding a GraphQL API endpoint to an existing ASGI application (e.g. FastAPI, Starlette, Quart, etc).Full documentation is available at:https://tartiflette.github.io/tartiflette-asgiRequirementstartiflette-asgiis compatible with:Python 3.6+.Tartiflette 1.x.QuickstartFirst, install Tartiflette's external dependencies, as explained in theTartiflette tutorial.Then, you can install Tartiflette andtartiflette-asgiusingpip:pipinstalltartiflette"tartiflette-asgi==0.*"You'll also need anASGI web server. We'll useUvicornhere:pipinstalluvicornCreate an application that exposes aTartifletteAppinstance:fromtartifletteimportResolverfromtartiflette_asgiimportTartifletteApp@Resolver("Query.hello")asyncdefhello(parent,args,context,info):name=args["name"]returnf"Hello,{name}!"sdl="type Query { hello(name: String): String }"app=TartifletteApp(sdl=sdl,path="/graphql")Save this file asgraphql.py, then start the server:uvicorngraphql:appMake an HTTP request containing a GraphQL query:curlhttp://localhost:8000/graphql-d'{ hello(name: "Chuck") }'-H"Content-Type: application/graphql"You should get the following JSON response:{"data":{"hello":"Hello, Chuck!"}}To learn more about usingtartiflette-asgi, head to the documentation:https://tartiflette.github.io/tartiflette-asgiContributingWant to contribute? Awesome! Be sure to read ourContributing guidelines.ChangelogChanges to this project are recorded in thechangelog.LicenseMITChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelog,
and this project adheres toSemantic Versioning.0.12.0 - 2022-05-13AddedAdd support for variables in query parameters. (Pull #176)0.11.0 - 2021-09-03AddedAdd official compatibility with Tartiflette 1.4.x. (Pull #153)ChangedUpdate dependency on Starlette to0.16.*. (Pull #154)Update httpx requirement to0.19.*(Pull #159)0.10.0 - 2021-01-19AddedAdd official compatibility with Tartiflette 1.3.x. (Pull #132)0.9.0 - 2020-06-10RemovedDrop deprecatedmounthelpers module. Prefer using the mounting mechanism of your ASGI framework. (Pull #119)ChangedUpdate dependency on Starlette to0.13.*. (Pull #106)Convert internal modules to private naming. All public API should be accessed from the top-leveltartiflette_asgipackage. (Pull #117)AddedAdd compatibility with Starlette0.13.*. (Pull #106)0.8.0 - 2020-06-04AddedAdd support for Tartiflette 1.2.x. (Pull #115)FixedFix GraphiQL subscriptions endpoint when using ASGI sub-mounting. (Pull #98)Fix protocol mismatch error when serving GraphiQL over HTTPS. (Pull #114)0.7.1 - 2019-10-28FixedRequests containing malformed JSON now return a 400 Bad Request error response instead of 500 Internal Server Error. (Pull #81)0.7.0 - 2019-10-27ChangedRenamed project totartiflette-asgi.0.6.0 - 2019-10-18AddedAdd support for Tartiflette 1.x. (Pull #58)Officialize support for Python 3.8. (Pull #80)RemovedDrop support for Tartiflette 0.x. (Pull #58)0.5.2 - 2019-10-09AddedAdd support for Python 3.8. (Pull #55)FixedType annotations are now correctly detected bymypy. (Pull #66)Fix a bug that prevented the GraphiQL web interface from making queries when the application was mounted on a parent ASGI app. (Pull #51)0.5.1 - 2019-07-16FixedFixed a bug that prevented accessing the GraphiQL interface when subscriptions were not enabled.0.5.0 - 2019-07-12AddedWebSocket subscriptions, configurable with the newsubscriptionsoption onTartifletteApp.Pass extra context to resolvers using the newcontextoption onTartifletteApp.0.4.0 - 2019-07-04AddedSupport for Tartiflette 0.12.x.Add amountmodule with submounting helpers.Addmount.starlette().ChangedDue to the newengine cooking APIin Tartiflette 0.12,TartifletteAppnow includes a startup event handler responsible for building the GraphQL engine. If submounting, itmustbe registered on the parent ASGI app. Helpers in themountmodule take care of this for you.RemovedDrop support for Tartiflette 0.11.x and below.0.3.0 - 2019-07-03AddedGraphiQL configuration via theGraphiQLhelper. Options:path,default_query,default_headers,default_variables,template.ChangedInternal refactoring that leverages more of Starlette's capabilities.Documentation improvements.0.2.0 - 2019-06-10AddedSupport forstarlette>=0.12(previously>=0.12.0b3).Tartiflette is now installed too when installingtartiflette-asgi.ChangedThe defaultpathis now""(previously"/").The request is now accessible in the GraphQL context viacontext["req"](previouslycontext["request"]).If no error occurred, theerrorsfield is not present in the response anymore (previously wasNone).FixedMore robust URL matching onTartifletteApp.0.1.1 - 2019-04-28FixedAdd missinggraphiql.htmlpackage asset.0.1.0 - 2019-04-26AddedFeatures:TartifletteAppASGI application.Built-in GraphiQL client.Project-related additions:Package setup.Changelog.Contributing guide.README and documentation.