Skip to main content

modelresolvers

modelresolvers is a python grapqhl package(inspired by type-graphql) on top of strawberry to structure your project by feature(model) instead of operation type(mutation and query) to manage it easier.

Requirement

python3.10 and above

Install by the following command

pip install modelresolvers

Documentation: https://cikay.github.io/modelresolvers/

Examples

Put the following example to main.py

import strawberry
from modelresolvers import ModelResolvers, Schema


user_resolvers = ModelResolvers()


@strawberry.type
class User:
    firstname: str
    lastname: str


users = [
    User(firstname="John", lastname="Doe"),
    User(firstname="Jahe", lastname="Doe"),
]


@user_resolvers.query(name="user")
def user() -> User:
    return users[0]


@user_resolvers.mutation(name="add_user")
def add_user(firstname: str, lastname: str) -> User:
    user = User(firstname=firstname, lastname=lastname)
    users.append(user)
    return user


schema = Schema(models_resolvers=[user_resolvers]).strawberry_schema

Run strawberry server main

Go to http://0.0.0.0:8000/graphql and try your mutations and queries.

Release files for modelresolvers 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modelresolvers 0.2.2
File Size Uploaded
modelresolvers-0.2.2.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for modelresolvers 0.2.2
File Interpreter ABI Platform
modelresolvers-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.0 kB

Release files / modelresolvers-0.2.2.tar.gz

Download URL modelresolvers-0.2.2.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d914b8db09af9fe6dd7fe22cac817fb655e8e92bfab5bc4c5330f644005c5594
BLAKE2b-256 checksum
How to use checksums
a37c49b523a8510aa35178e27bec4ed0ca88194470a543564e315c4812fff47d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.2 Linux/6.2.0-1012-azure

Release files / modelresolvers-0.2.2-py3-none-any.whl

Download URL modelresolvers-0.2.2-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
563d14cc751c51cb01cab6b90db30ab1a0541d79ad04841bcb9309cca9ded8af
BLAKE2b-256 checksum
How to use checksums
208d8ddc71fcbca24da072254f8e433672caf98bf909c43523ac2671ef4a7c72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.2 Linux/6.2.0-1012-azure

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page