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.93.16

Published by botberry almost 3 years ago

Add support for piping StrawberryUnion and None when annotating types.

For example:

@strawberry.type
class Cat:
    name: str

@strawberry.type
class Dog:
    name: str

Animal = strawberry.union("Animal", (Cat, Dog))

@strawberry.type
class Query:
    animal: Animal | None # This line no longer triggers a TypeError
strawberry - 🍓 0.93.15

Published by botberry almost 3 years ago

This release fixes the conversion of pydantic models with a default_factory
field.

strawberry - 🍓 0.93.14

Published by botberry almost 3 years ago

This release allows conversion of pydantic models with mutable default fields into strawberry types.
Also fixes bug when converting a pydantic model field with default_factory. Previously it would raise an exception when fields with a default_factory were declared before fields without defaults.

strawberry - 🍓 0.93.13

Published by botberry almost 3 years ago

This release updates the Decimal and UUID scalar parsers to exclude the original_error exception and format the error message similar to other builtin scalars.

strawberry - 🍓 0.93.12

Published by botberry almost 3 years ago

Fix mypy plugin crushes when _get_type_for_expr is used on var nodes

strawberry - 🍓 0.93.11

Published by botberry almost 3 years ago

This release fixes a bug in the annotation parser that prevents using strict typinh for Optional arguments which have their default set to UNSET.

strawberry - 🍓 0.93.10

Published by botberry almost 3 years ago

This release adds support for mypy 0.920.

strawberry - 🍓 0.93.9

Published by botberry almost 3 years ago

This releases fixes a bug with the opentracing extension
where the tracer wasn't replacing the field name correctly.

strawberry - 🍓 0.93.8

Published by botberry almost 3 years ago

This release modifies the internal utility function await_maybe towards updating mypy to 0.920.

strawberry - 🍓 0.93.7

Published by botberry almost 3 years ago

Change context_getter in strawberry.fastapi.GraphQLRouter to merge, rather than overwrite, default and custom getters.

This mean now you can always access the request instance from info.context, even when using
a custom context getter.

strawberry - 🍓 0.93.6

Published by botberry almost 3 years ago

This release changes when we fetch the event loop in dataloaders
to prevent using the wrong event loop in some occasions.

strawberry - 🍓 0.93.5

Published by botberry almost 3 years ago

This release fixes an issue that prevented from lazily importing
enum types using LazyType.

strawberry - 🍓 0.93.4

Published by botberry almost 3 years ago

This release allows running strawberry as a script, for example, you can start the debug server with the following command:

python -m strawberry server schema
strawberry - 🍓 0.93.3

Published by botberry almost 3 years ago

This release adds support for uvicorn 0.16

strawberry - 🍓 0.93.2

Published by botberry almost 3 years ago

This fixes the previous release that introduced a direct dependency on Django.

strawberry - 🍓 0.93.1

Published by botberry almost 3 years ago

This release adds support for Django 4.0

strawberry - 🍓 0.93.0

Published by botberry almost 3 years ago

This release operation_type to the ExecutionContext type that is available
in extensions. It also gets the operation_name from the query if one isn't
provided by the client.

strawberry - 🍓 0.92.2

Published by botberry almost 3 years ago

This release adds support for passing json_encoder and json_dumps_params to Django JsonResponse via a view.

from json import JSONEncoder

from django.urls import path
from strawberry.django.views import AsyncGraphQLView

from .schema import schema

# Pass the JSON params to `.as_view`
urlpatterns = [
    path(
        "graphql",
        AsyncGraphQLView.as_view(
            schema=schema,
            json_encoder=JSONEncoder,
            json_dumps_params={"separators": (",", ":")},
        ),
    ),
]

# … or set them in a custom view
class CustomAsyncGraphQLView(AsyncGraphQLView):
    json_encoder = JSONEncoder
    json_dumps_params = {"separators": (",", ":")}
strawberry - 🍓 0.92.1

Published by botberry almost 3 years ago

Fix cross-module type resolving for fields and resolvers

The following two issues are now fixed:

  • A field with a generic (typeless) resolver looks up the
    type relative to the resolver and not the class the field is
    defined in. (#1448)

  • When inheriting fields from another class the origin of the
    fields are set to the inheriting class and not the class the
    field is defined in.

Both these issues could lead to a rather undescriptive error message:

TypeError: (...) fields cannot be resolved. Unexpected type 'None'

strawberry - 🍓 0.92.0

Published by botberry almost 3 years ago

This releases fixes an issue where you were not allowed
to return a non-strawberry type for fields that return
an interface. Now this works as long as each type
implementing the interface implements an is_type_of
classmethod. Previous automatic duck typing on types
that implement an interface now requires explicit
resolution using this classmethod.

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