Skip to main content

Strawberry-based GraphQL API Server for AiiDA

Project description

aiida-graphql

Build Status codecov PyPI

Strawberry-based GraphQL Server for AiiDA

Why GraphQL when there is already the REST API? See https://www.howtographql.com/basics/1-graphql-is-the-better-rest/ ... a lot of possible optimizations and fits the graph-based structure of the AiiDA DB a lot better than a REST API.

Requirements

For development: https://poetry.eustace.io/

Why Strawberry for GraphQL? It uses graphql-core v3 (while graphene is still stuck with v2), uses typings and dataclasses for both validation and schema generation. And it uses modern Python to write the schema, in comparison to the schema-first approach.

Why Python 3.7+? It's the future, and for Strawberry. In fact, were it not for a bug in uvloop this would be Python 3.8+ (for the walrus operator). And given the timeline these projects are running for, we'll probably see Python 3.9 until people effectively start using it.

Why Poetry? I wanted to get away from setuptools and used Poetry already in a different project and liked the virtualenv integration.

Usage

Development

Installing the dependencies:

git clone https://github.com/dev-zero/aiida-graphql.git
cd aiida-graphql

# for poetry installation use the official documentation
poetry install

To run the development server:

$ poetry run strawberry server aiida_graphql.schema

then visit http://localhost:8000/graphql with your browser.

Example query:

{
  computers {
    uuid
    name
    description
    schedulerType
    transportType
  }
}

Query Screenshot

Available fields

Documentation and schema are embedded in the development server.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiida-graphql-0.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiida_graphql-0.0.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file aiida-graphql-0.0.1.tar.gz.

File metadata

  • Download URL: aiida-graphql-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0b2 CPython/3.7.1 Linux/4.15.0-1040-gcp

File hashes

Hashes for aiida-graphql-0.0.1.tar.gz
Algorithm Hash digest
SHA256 678834e14e9b3869abeea6324229e34f1e2302ea04b78cec7ce47e0dfdde24db
MD5 c9a5e9c666582f2742e5d16cb44e95fe
BLAKE2b-256 8802d5525463d6692d0680074037ed2a7fb01f5be63f42473d064619b3c940cf

See more details on using hashes here.

File details

Details for the file aiida_graphql-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: aiida_graphql-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0b2 CPython/3.7.1 Linux/4.15.0-1040-gcp

File hashes

Hashes for aiida_graphql-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 22011d14059c98f5f455e9cd3681d2d9ea494f4dd2f314e08ba24c79e0a5b86a
MD5 9e147c072e013460faee41e084059034
BLAKE2b-256 4da53bace3479a01b3408e6dec1ca42b8cb51fe7f82ff450cbae5e0d0d4fe63b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page