graphene 3.4.3


pip install graphene

  Latest version

Released: Nov 09, 2024

Project Links

Meta
Author: Syrus Akbary

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers

Topic
  • Software Development :: Libraries

Programming Language
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Graphene Logo Graphene PyPI version Coverage Status

���� Join the community on Discord

We are looking for contributors! Please check the current issues to see how you can help ������

Introduction

Graphene is an opinionated Python library for building GraphQL schemas/types fast and easily.

  • Easy to use: Graphene helps you use GraphQL in Python without effort.
  • Relay: Graphene has builtin support for Relay.
  • Data agnostic: Graphene supports any kind of data source: SQL (Django, SQLAlchemy), Mongo, custom Python objects, etc. We believe that by providing a complete API you could plug Graphene anywhere your data lives and make your data available through GraphQL.

Integrations

Graphene has multiple integrations with different frameworks:

integration Package
SQLAlchemy graphene-sqlalchemy
Mongo graphene-mongo
Apollo Federation graphene-federation
Django graphene-django

Also, Graphene is fully compatible with the GraphQL spec, working seamlessly with all GraphQL clients, such as Relay, Apollo and gql.

Installation

To install graphene, just run this command in your shell

pip install "graphene>=3.1"

Examples

Here is one example for you to get started:

import graphene

class Query(graphene.ObjectType):
    hello = graphene.String(description='A typical hello world')

    def resolve_hello(self, info):
        return 'World'

schema = graphene.Schema(query=Query)

Then Querying graphene.Schema is as simple as:

query = '''
    query SayHello {
      hello
    }
'''
result = schema.execute(query)

If you want to learn even more, you can also check the following examples:

Documentation

Documentation and links to additional resources are available at https://docs.graphene-python.org/en/latest/

Contributing

After cloning this repo, create a virtualenv and ensure dependencies are installed by running:

virtualenv venv
source venv/bin/activate
pip install -e ".[test]"

Well-written tests and maintaining good test coverage is important to this project. While developing, run new and existing tests with:

pytest graphene/relay/tests/test_node.py # Single file
pytest graphene/relay # All tests in directory

Add the -s flag if you have introduced breakpoints into the code for debugging. Add the -v ("verbose") flag to get more detailed test output. For even more detailed output, use -vv. Check out the pytest documentation for more options and test running controls.

Regularly ensure your pre-commit hooks are up to date and enabled:

pre-commit install

You can also run the benchmarks with:

pytest graphene --benchmark-only

Graphene supports several versions of Python. To make sure that changes do not break compatibility with any of those versions, we use tox to create virtualenvs for each Python version and run tests with that version. To run against all Python versions defined in the tox.ini config file, just run:

tox

If you wish to run against a specific version defined in the tox.ini file:

tox -e py39

Tox can only use whatever versions of Python are installed on your system. When you create a pull request, GitHub Actions pipelines will also be running the same tests and report the results, so there is no need for potential contributors to try to install every single version of Python on their own system ahead of time. We appreciate opening issues and pull requests to make graphene even more stable & useful!

Building Documentation

The documentation is generated using the excellent Sphinx and a custom theme.

An HTML version of the documentation is produced by running:

make docs
3.4.3 Nov 09, 2024
3.4.2 Nov 09, 2024
3.4.1 Oct 27, 2024
3.4 Oct 18, 2024
3.3 Jul 26, 2023
3.2.2 Mar 13, 2023
3.2.1 Dec 11, 2022
3.2 Dec 09, 2022
3.1.1 Sep 08, 2022
3.1 May 30, 2022
3.0 Nov 13, 2021
3.0b8 Sep 30, 2021
3.0b7 Jan 06, 2021
3.0b6 Oct 21, 2020
3.0b5 Aug 06, 2020
3.0b4 Jul 14, 2020
3.0b3 Jun 25, 2020
3.0b2 May 09, 2020
3.0b1 Apr 06, 2020
3.0b0 Mar 04, 2020
3.0a1 Mar 04, 2020
3.0.dev20190817210753 Aug 17, 2019
2.1.9 Jul 16, 2021
2.1.8 Aug 17, 2019
2.1.7 Jul 15, 2019
2.1.6 Jun 14, 2019
2.1.5 Jun 03, 2019
2.1.3 Jul 19, 2018
2.1.2 Jun 14, 2018
2.1.1 May 25, 2018
2.1 Mar 30, 2018
2.0.1 Nov 15, 2017
2.0 Oct 25, 2017
2.0.dev20170802065539 Aug 02, 2017
2.0.dev20170801053013 Aug 01, 2017
2.0.dev20170727061432 Jul 27, 2017
2.0.dev20170727024417 Jul 27, 2017
2.0.dev20170725061556 Jul 25, 2017
2.0.dev20170725043308 Jul 25, 2017
2.0.dev20170724064308 Jul 24, 2017
1.4.2 Oct 28, 2017
1.4.1 Jun 28, 2017
1.4 Apr 20, 2017
1.3 Apr 07, 2017
1.2 Feb 21, 2017
1.1.3 Dec 02, 2016
1.1.2 Nov 23, 2016
1.1.1 Nov 16, 2016
1.1 Nov 15, 2016
1.0.2 Oct 04, 2016
1.0.1 Sep 29, 2016
1.0 Sep 26, 2016
1.0.dev20160922020647 Sep 22, 2016
1.0.dev20160921153356 Sep 21, 2016
1.0.dev20160920070441 Sep 20, 2016
1.0.dev20160920015515 Sep 20, 2016
1.0.dev20160918041239 Sep 18, 2016
1.0.dev20160917190505 Sep 17, 2016
1.0.dev20160911051803 Sep 11, 2016
1.0.dev20160911044410 Sep 11, 2016
1.0.dev20160909055438 Sep 09, 2016
1.0.dev20160909040318 Sep 09, 2016
1.0.dev20160823061102 Aug 23, 2016
1.0.dev20160822080320 Aug 22, 2016
1.0.dev20160816073455 Aug 16, 2016
1.0.dev20160815004752 Aug 15, 2016
0.10.2 Jun 01, 2016
0.10.1 May 23, 2016
0.10.0 May 21, 2016
0.9.1 May 13, 2016
0.9 May 12, 2016
0.9b1 May 12, 2016
0.8.1 Apr 14, 2016
0.8.0 Apr 03, 2016
0.7.3 Feb 13, 2016
0.7.2 Feb 06, 2016
0.7.1 Feb 03, 2016
0.7.0 Jan 26, 2016
0.6.1 Jan 21, 2016
0.6.0 Jan 14, 2016
0.5.0 Dec 11, 2015
0.4.3 Dec 05, 2015
0.4.2 Nov 22, 2015
0.4.1.1 Nov 20, 2015
0.4.1 Nov 20, 2015
0.4.0.1 Nov 18, 2015
0.4.0 Nov 17, 2015
0.3.0 Oct 30, 2015
0.1.6.1 Oct 23, 2015
0.1.6.0 Oct 21, 2015
0.1.6a1 Oct 20, 2015
0.1.5.3 Oct 15, 2015
0.1.5.2 Oct 14, 2015
0.1.5.1 Oct 13, 2015
0.1.5 Oct 11, 2015
0.1.4 Oct 10, 2015
0.1.3 Oct 09, 2015
0.1.2 Oct 08, 2015
0.1.1 Oct 07, 2015
0.1.0 Oct 07, 2015

Wheel compatibility matrix

Platform Python 2 Python 3
any

Files in release

Extras:
Dependencies:
graphql-core (<3.3,>=3.1)
graphql-relay (<3.3,>=3.1)
python-dateutil (<3,>=2.7.0)
typing-extensions (<5,>=4.7.1)