{ "info": { "author": "Tzu-sing Gwo", "author_email": "zi-xing.guo@ubisoft.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development" ], "description": "# Pygraphy\nA modern pythonic GraphQL implementation, painless GraphQL developing experience for Pythonista.\n\n[![Build Status](https://travis-ci.org/ethe/pygraphy.svg?branch=master)](https://travis-ci.org/ethe/pygraphy)\n[![codecov](https://codecov.io/gh/ethe/pygraphy/branch/master/graph/badge.svg)](https://codecov.io/gh/ethe/pygraphy)\n[![pypi](https://badge.fury.io/py/pygraphy.svg)](https://pypi.org/project/pygraphy/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pygraphy.svg)](https://pypi.org/project/pygraphy/)\n\n\n## Document\n\nSee [official docs](https://pygraphy.org/).\n\n\n## Quick Review\nAll the behaviors of Pygraphy are no difference from your intuition.\n```python\nimport asyncio\nimport pygraphy\nfrom typing import List, Optional\nfrom starlette.applications import Starlette\nimport uvicorn\n\n\napp = Starlette(debug=True)\n\n\nclass Episode(pygraphy.Enum):\n NEWHOPE = 4\n EMPIRE = 5\n JEDI = 6\n\n\nclass Character(pygraphy.Interface):\n \"\"\"\n Character interface contains human and droid\n \"\"\"\n id: str\n name: str\n appears_in: List[Episode]\n\n @pygraphy.field\n def friends(self) -> Optional[List['Character']]:\n return []\n\n\nclass Human(pygraphy.Object, Character):\n \"\"\"\n Human object\n \"\"\"\n home_planet: str\n\n\nclass Droid(pygraphy.Object, Character):\n \"\"\"\n Driod object\n \"\"\"\n primary_function: str\n\n\nclass Query(pygraphy.Query):\n\n @pygraphy.field\n async def hero(self, episode: Episode) -> Optional[Character]:\n await asyncio.sleep(1)\n return Droid(\n id=\"2001\",\n name=\"R2-D2\",\n appears_in=[Episode.NEWHOPE, Episode.EMPIRE, Episode.JEDI],\n primary_function=\"Astromech\",\n )\n\n\n@app.route('/')\nclass Schema(pygraphy.Schema):\n query: Optional[Query]\n\n\nif __name__ == '__main__':\n uvicorn.run(app, host='0.0.0.0', port=8000)\n\n```\n\n\n## Installation\n\n### Web Server Required\n`pip install 'pygraphy[web]'`\n\n### Standalone Model and Query Handler\n`pip install 'pygraphy'`\n\n\n## Features\n\n- Clean room Pythonic schema definition system\n- Model definition bases on Python Dataclass\n- Python Asyncio support\n- Context management bases on Python Context Variables\n- Introspection and GraphQL Playground support\n\n\n## Comparation with GraphQL-Core(-Next)\n\n### Advantages\n\n[GraphQL-Core-Next](https://github.com/graphql-python/graphql-core-next) is the official supporting implementation of GraphQL, and it is only a basic library. Generally, you should use Graphene or other wrapper libraries bases on it. Pygraphy is an integrated library that includes data mapping and model definition.\n\nGraphQL-Core-Next is directly translated from GraphQL.js, this leads to some weird behaviors such as [graphql-core-next/issues/37](https://github.com/graphql-python/graphql-core-next/issues/37#issuecomment-511633135), and it is too tough to make a wrapper for walking around. Pygraphy rewrites the schema definition system in a more pythonic way. By using Python Metaclass, Pygraphy supports class-style schema definition naturally. There is no more inharmony between lambda function resolver (ugly Js style) and instance method resolver.\n\nBy using Context Variables which is added into Python in version 3.7, Pygraphy does not need to pass context through the call chain like graphql-core-next.\n\nAlso, Pygraphy is faster than graphql-core-next, you can check benchmark results as below.\n\nAnd more, Pygraphy clearly support stateful subscription method with Python Asynchronous Generators, which is not elaborate in graphql-core-next.\n\n### Disadvantages\n\nPygraphy is still in pre-alpha version, and need stable, welcome feedback.\n\nPygraphy **does not support** full features of GraphQL according to Spec right now, the rest part of Spec will be integrated literally in the future, it contains\n - Derectives\n - ID Scalar\n - Type Extensions\n - Some Validation Check\n\nMost of features are already implemented so do not panic.\n\n\n## Benchmark\n\nCompare with Strawberry / graphql-core-next, Pygraphy is 4.5 times faster than it.\n\n```\n\u21b3 uname -a\nDarwin Workstation.local 19.0.0 Darwin Kernel Version 19.0.0: Thu Jul 11 18:37:36 PDT 2019; root:xnu-6153.0.59.141.4~1/RELEASE_X86_64 x86_64\n\u21b3 python -V\nPython 3.7.2\n\u21b3 time python benchmark/test_pygraphy.py\npython benchmark/test_pygraphy.py 3.48s user 0.10s system 99% cpu 3.596 total\n\u21b3 time python benchmark/test_strawberry.py\npython benchmark/test_strawberry.py 16.05s user 0.16s system 99% cpu 16.257 total\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ethe/pygraphy", "keywords": "python graphql", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pygraphy", "package_url": "https://pypi.org/project/pygraphy/", "platform": "", "project_url": "https://pypi.org/project/pygraphy/", "project_urls": { "Homepage": "https://github.com/ethe/pygraphy" }, "release_url": "https://pypi.org/project/pygraphy/0.1.5/", "requires_dist": [ "GraphQL-core-next (<1.2.0,>=1.1.0)", "flake8 (>=3.7.7) ; extra == 'dev'", "pytest (>=5.0.0) ; extra == 'dev'", "starlette (<0.13.0,>=0.12.1) ; extra == 'web'" ], "requires_python": ">=3.7,<4", "summary": "A modern pythonic implementation of GraphQL.", "version": "0.1.5" }, "last_serial": 5860714, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e959312e8874df215847914b8bc108dd", "sha256": "eb3b58efcb9d4715c3b627b0e5eed983f55fce6ba772ef8a7df8ff08a6ec1b5e" }, "downloads": -1, "filename": "pygraphy-0.0.1-py3.7.egg", "has_sig": false, "md5_digest": "e959312e8874df215847914b8bc108dd", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": ">=3.7", "size": 42106, "upload_time": "2019-07-10T16:58:32", "url": "https://files.pythonhosted.org/packages/f5/01/3aacd8f3c27fdcd1c51f1e7b4c73245789b88be2713381d70aacc7066eef/pygraphy-0.0.1-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "aa2ba896459de8844c15dceee0524c19", "sha256": "9aac4097c9cfdb5f1ffd398dcd07d879192a08b2f675df793d67b991e8b66347" }, "downloads": -1, "filename": "pygraphy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "aa2ba896459de8844c15dceee0524c19", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 16498, "upload_time": "2019-07-10T16:58:34", "url": "https://files.pythonhosted.org/packages/25/e9/34706f0ca31502c19a72f20f82230307bbdfb10b1d1cf756519e2fd2b2c2/pygraphy-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "b3f87526e02ed6875deebb5a35cdbd4f", "sha256": "668ee9e39aa90f360139e94d159ad0becf3c547ce2cc890c9b557ad71b5edc20" }, "downloads": -1, "filename": "pygraphy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "b3f87526e02ed6875deebb5a35cdbd4f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 53131, "upload_time": "2019-07-13T11:27:32", "url": "https://files.pythonhosted.org/packages/f0/42/44347336e67342810ea892e268c9012efebb3d5011b42d821834b534f7ea/pygraphy-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "5e67d248b5baf9e08abe22dfbcd693f9", "sha256": "81fbbd69b45ae69a9c9c1c6eeaf9689bb988d656cab8b4af9d0553473a863813" }, "downloads": -1, "filename": "pygraphy-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "5e67d248b5baf9e08abe22dfbcd693f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 30451, "upload_time": "2019-07-13T12:20:50", "url": "https://files.pythonhosted.org/packages/f8/9f/74db300e4c75027251435278ffe87608b1173361ef11eae88593e92f1ae9/pygraphy-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "d6ba8543b2906af883c9f28905aec6e0", "sha256": "4fcc99a9a5bf8238b0848ede4eb0110af7ad7b85564470b5a97bfa31efdbb96c" }, "downloads": -1, "filename": "pygraphy-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "d6ba8543b2906af883c9f28905aec6e0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 18722, "upload_time": "2019-07-13T16:52:06", "url": "https://files.pythonhosted.org/packages/e7/a6/2c9a47c98a2bde903bcbb59143f4fdb241b4c1e5d536791047c659987666/pygraphy-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "4205d6db81674ecb5ce7893e5366068c", "sha256": "d91745d80a72cee483e56472f3bfb2fbf9b5e9cf643db5ce13b414e9c004d19b" }, "downloads": -1, "filename": "pygraphy-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "4205d6db81674ecb5ce7893e5366068c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 21968, "upload_time": "2019-07-17T09:38:33", "url": "https://files.pythonhosted.org/packages/a1/9c/037c809ed56d1ce046f7a2efb2b8de056860703b4096f471035c392d3562/pygraphy-0.0.5-py3-none-any.whl" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "6e24a3ec8b22d638168834f1efcf9e4c", "sha256": "7a69ce004da32f6b4e8cae769c42d43d04e8c1e1ee639863102d4df39d9e7259" }, "downloads": -1, "filename": "pygraphy-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6e24a3ec8b22d638168834f1efcf9e4c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 23232, "upload_time": "2019-07-19T15:51:16", "url": "https://files.pythonhosted.org/packages/83/fc/8890c546c5d692d11583865c6bcfef6807f03002e19dca833ddbaa609bf2/pygraphy-0.1.0-py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "955f96975d82d1511d3a8bed44b54738", "sha256": "159bf8bbc99985fe29e3bbf9968ad633f5422c98dc5ba280257f15aa1c1ca49a" }, "downloads": -1, "filename": "pygraphy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "955f96975d82d1511d3a8bed44b54738", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 23257, "upload_time": "2019-07-20T19:22:10", "url": "https://files.pythonhosted.org/packages/9c/51/87433d253cd5a8377699e3b8d3e5021fe8d4cb23a68f3a0a9ce16e95857d/pygraphy-0.1.1-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "afd123f150f301ad8997f743cc2c6561", "sha256": "086e4dff0ae2254a3c9353b29ee97640edd83a2d93aa6d471727aa726a02802b" }, "downloads": -1, "filename": "pygraphy-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "afd123f150f301ad8997f743cc2c6561", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 22919, "upload_time": "2019-07-25T13:00:32", "url": "https://files.pythonhosted.org/packages/3d/4d/7f840dae3073e15a9cebec5edf121328746c93b62ee04af2ff6963c95fab/pygraphy-0.1.2-py3-none-any.whl" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "50681f9a56e68a634e186518fea232b1", "sha256": "caf520f768b4de726d524cf665f7ab69868ae79e1084ec61df82278c70628c83" }, "downloads": -1, "filename": "pygraphy-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "50681f9a56e68a634e186518fea232b1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 22961, "upload_time": "2019-07-25T13:57:59", "url": "https://files.pythonhosted.org/packages/9b/57/8896cd715d399ebf2974da4e374d25dffdac4279259561dd734c7a2b5eb8/pygraphy-0.1.3-py3-none-any.whl" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "f4f2ba1b37db196654858039bc48fcd0", "sha256": "3246703bb24a687957a16fe9b47615f180a4f2947da2f5af7108251d4dcc5145" }, "downloads": -1, "filename": "pygraphy-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "f4f2ba1b37db196654858039bc48fcd0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 22987, "upload_time": "2019-08-13T08:06:32", "url": "https://files.pythonhosted.org/packages/bc/ce/d0a868d99ed3ebca69f13bfeb51908a91baba3c14b32b657ee318a1bd865/pygraphy-0.1.4-py3-none-any.whl" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "cf2a69a61f6c9fe8ce3b6c17717fd0ac", "sha256": "022651328ce8b0468adcc9c1b02e98ee6c4caa9dd5b7a1ee2855ed88265b3519" }, "downloads": -1, "filename": "pygraphy-0.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "cf2a69a61f6c9fe8ce3b6c17717fd0ac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 22985, "upload_time": "2019-09-20T08:13:10", "url": "https://files.pythonhosted.org/packages/de/a2/4c40bd3cccc90ade3f3855b6f511cdc2b028630abcc75b51bcf619386550/pygraphy-0.1.5-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cf2a69a61f6c9fe8ce3b6c17717fd0ac", "sha256": "022651328ce8b0468adcc9c1b02e98ee6c4caa9dd5b7a1ee2855ed88265b3519" }, "downloads": -1, "filename": "pygraphy-0.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "cf2a69a61f6c9fe8ce3b6c17717fd0ac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4", "size": 22985, "upload_time": "2019-09-20T08:13:10", "url": "https://files.pythonhosted.org/packages/de/a2/4c40bd3cccc90ade3f3855b6f511cdc2b028630abcc75b51bcf619386550/pygraphy-0.1.5-py3-none-any.whl" } ] }