GraphQL lexer and parser written in pure Python, produces AST. Features:
- Complies with latest working draft of GraphQL specification;
- Fast enough, built on PLY;
- Tested vs. Python 2.7, 3.4 - 3.9, and PyPy
$ pip install graphql-py
from graphql.parser import GraphQLParser
parser = GraphQLParser()
ast = parser.parse("""
query UserQuery {
user(id: 4) {
id
name
profilePic
avatar: profilePic(width: 30, height: 30)
}
}
""")
print(ast)
MIT