strawberry

A GraphQL library for Python that leverages type annotations 🍓

MIT License

Downloads
1.1M
Stars
3.8K
Committers
260

Bot releases are hidden (Show)

strawberry - 🍓 0.104.0

Published by botberry over 2 years ago

Add is_auto utility for checking if a type is strawberry.auto,
considering the possibility of it being a StrawberryAnnotation or
even being used inside Annotated.

strawberry - 🍓 0.103.9

Published by botberry over 2 years ago

This release moves the console plugin for the codegen command
to be last one, allowing to run code before writing files to
disk.

strawberry - 🍓 0.103.8

Published by botberry over 2 years ago

This release adds a python_type to the codegen GraphQLEnum class
to allow access to the original python enum when generating code

strawberry - 🍓 0.103.7

Published by botberry over 2 years ago

Fix an issue where there was no clean way to mark a Pydantic field as deprecated, add permission classes, or add directives. Now you can use the short field syntax to do all three.

import pydantic
import strawberry

class MyModel(pydantic.BaseModel):
    age: int
    name: str

@strawberry.experimental.pydantic.type(MyModel)
class MyType:
    age: strawberry.auto
    name: strawberry.auto = strawberry.field(
        deprecation_reason="Because",
        permission_classes=[MyPermission],
        directives=[MyDirective],
    )
strawberry - 🍓 0.103.6

Published by botberry over 2 years ago

This release adds a missing __init__.py inside cli/commands

strawberry - 🍓 0.103.5

Published by botberry over 2 years ago

This release fixes an issue that prevented using generic types
with interfaces.

strawberry - 🍓 0.103.4

Published by botberry over 2 years ago

This release fixes a couple of more issues with codegen:

  1. Adds support for boolean values in input fields
  2. Changes how we unwrap types in order to add full support for LazyTypes, Optionals and Lists
  3. Improve also how we generate types for unions, now we don't generate a Union type if the selection is for only one type
strawberry - 🍓 0.103.3

Published by botberry over 2 years ago

The return type annotation for DataLoader.load and load_many no longer
includes any exceptions directly returned by the load_fn. The ability to
handle errors by returning them as elements from load_fn is now documented too.

strawberry - 🍓 0.103.2

Published by botberry over 2 years ago

This release add supports for LazyTypes in the codegen command

strawberry - 🍓 0.103.1

Published by botberry over 2 years ago

This release adds support for MyPy 0.941 under Python 3.10

strawberry - 🍓 0.103.0

Published by botberry over 2 years ago

This release adds an experimental codegen feature for queries.
It allows to combine a graphql query and Strawberry schema to generate
Python types or TypeScript types.

You can use the following command:

strawberry codegen --schema schema --output-dir ./output -p python query.graphql

to generate python types that correspond to your GraphQL query.

strawberry - 🍓 0.102.3

Published by botberry over 2 years ago

This release makes StrawberryOptional and StrawberryList hashable,
allowing to use strawberry types with libraries like dacite and
dataclasses_json.

strawberry - 🍓 0.102.2

Published by botberry over 2 years ago

Add support for postponed evaluation of annotations
(PEP-563) to strawberry.Private
annotated fields.

Example

This release fixes Issue #1586 using schema-conversion time filtering of
strawberry.Private fields for PEP-563. This means the following is now
supported:

@strawberry.type
class Query:
    foo: "strawberry.Private[int]"

Forward references are supported as well:

from __future__ import annotations

from dataclasses import dataclass

@strawberry.type
class Query:
    private_foo: strawberry.Private[SensitiveData]

    @strawberry.field
    def foo(self) -> int:
        return self.private_foo.visible

@dataclass
class SensitiveData:
    visible: int
    not_visible int
strawberry - 🍓 0.102.1

Published by botberry over 2 years ago

This PR improves the support for scalars when using MyPy.

strawberry - 🍓 0.102.0

Published by botberry over 2 years ago

Added the response object to get_context on the flask view. This means that in fields, something like this can be used;

@strawberry.field
def response_check(self, info: Info) -> bool:
    response: Response = info.context["response"]
    response.status_code = 401

    return True
strawberry - 🍓 0.101.0

Published by botberry over 2 years ago

This release adds support for graphql-transport-ws single result operations.

Single result operations allow clients to execute queries and mutations over an existing WebSocket connection.

strawberry - 🍓 0.100.0

Published by botberry over 2 years ago

Change strawberry.auto to be a type instead of a sentinel.
This not only removes the dependency on sentinel from the project, but also fixes
some related issues, like the fact that only types can be used with Annotated.

Also, custom scalars will now trick static type checkers into thinking they
returned their wrapped type. This should fix issues with pyright 1.1.224+ where
it doesn't allow non-type objects to be used as annotations for dataclasses and
dataclass-alike classes (which is strawberry's case). The change to strawberry.auto
also fixes this issue for it.

strawberry - 🍓 0.99.3

Published by botberry over 2 years ago

This release adds support for flask 2.x and also relaxes the requirements for Django, allowing to install newer version of Django without having to wait for Strawberry to update its supported dependencies list.

strawberry - 🍓 0.99.2

Published by botberry over 2 years ago

This fixes the schema printer to add support for schema
directives on input types.

strawberry - 🍓 0.99.1

Published by botberry over 2 years ago

This release fixed a false positive deprecation warning related to our AIOHTTP class based view.

Package Rankings
Top 1.15% on Pypi.org
Top 16.1% on Conda-forge.org
Badges
Extracted from project README
CircleCI Discord PyPI
Related Projects