python的graphql引擎

tartiflette的Python项目详细描述


Tartiflette

tartiflette是用python 3.6+构建的graphql服务器实现。

动机

Read this blogpost about our motivations TL;博士 我们达到了石墨烯的极限,我们想建造一些满足特定要求的东西:

  • 提供了更好的开发人员体验尊重python思想
  • 使用sdl (模式定义语言)
  • 使用asyncio作为唯一的执行引擎
  • 100%开源

状态

first milestone在我们后面,我们现在是on the road to the milestone 2

dna

通过我们关于https://tartiflette.io/docs/tutorial/getting-started的精彩教程,您可以发现馅饼

摘要

用法

importasynciofromtartifletteimportResolver,create_engine@Resolver("Query.hello")asyncdefresolver_hello(parent,args,ctx,info):return"hello "+args["name"]asyncdefrun():engine=awaitcreate_engine("""        type Query {            hello(name: String): String        }        """)result=awaitengine.execute(query='query { hello(name: "Chuck") }')print(result)# {'data': {'hello': 'hello Chuck'}}if__name__=="__main__":loop=asyncio.get_event_loop()loop.run_until_complete(run())

有关API Documentation的更多详细信息

安装

pypi.org上提供馅饼。

pip install tartiflette

安装依赖项

因为tartiflette的执行引擎基于libgraphqlparser。在您的环境中,需要使用以下命令才能使用库。cmakebisonflex

macosx

brew install cmake flex bison

ubuntu

apt-get install cmake flex bison

http上的tartiflette

探索我们通过http实现的tartiflette,称为tartiflette-aiohttp

概述

pip install tartiflette-aiohttp
fromaiohttpimportwebfromtartiflette_aiohttpimportregister_graphql_handlerssdl="""    type Query {        hello(name: String): String    }"""ctx={'user_service':user_service}web.run_app(register_graphql_handlers(app=web.Application(),engine_sdl=sdl,engine_schema_name="default",executor_context=ctx,executor_http_endpoint='/graphql',executor_http_methods=['POST','GET']))

路线图

如何为文档做出贡献?

如您所知,文档托管在https://tartiflette.io。这个Fabeous网站的建立要感谢另一个令人惊叹的工具docusaurus

文档的内容托管在这个存储库中,尽可能靠近代码。您将在文件夹/docs中找到所需的一切。

如何在本地运行网站?

我们为文档(docker hub上的tartiflette/tartiflette.io)构建了一个docker映像,它允许我们提供一种在本地启动文档的简单方法,而无需安装特定版本的node。

先决条件

  • 码头工人
  • Docker撰写
  • 制造
make run-docs

您在/docs文件夹中所做的每一个更改都将自动热重新加载。:tada:

已知问题

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带有嵌套JAR的java RCP ClassNotFoundException   java在输入框中设置默认值,crud应用程序使用spring   java如何在Heroku中使用fs创建新文件   java将JPanel放在JFrame中   java这个正则表达式会匹配“i.imgur.com/xxx”吗?   java在片段内创建RecylerView,而无需在Android中设置片段   Android上Groovy导致java错误的双精度浮点精度损失   swing Java查找JFrame属于JPanel的内容   java Spring junit自连线自定义类本身必须有构造函数吗?   java textswitcher支持前面的文本   从Android客户端到JAXRS的java Post自定义对象   java如何检索JSON数据并使用MPAndroidChart绘制折线图,以及在安卓上的改进   拒绝用户“root”@“localhost”的java c3p0访问(使用密码“是”)   使用Selenium Webdriver自动化ExtJS应用程序时java面临的问题