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

Published by botberry about 1 year ago

TypingUnionType import error check is reraised because TypingGenericAlias is checked at the same time which is checked under 3.9 instead of under 3.10

Fix by separating TypingUnionType and TypingGenericAlias imports in their own try-catch

Releases contributed by @tjeerddie via #3023

strawberry - 🍓 0.202.0

Published by botberry about 1 year ago

This release updates Strawberry's codebase to use new features in Python 3.8.
It also removes backports.cached-property from our dependencies, as we can
now rely on the standard library's functools.cached_property.

Releases contributed by @bellini666 via #2995

strawberry - 🍓 0.201.1

Published by botberry about 1 year ago

Fix strawberry mypy plugin for pydantic v1

Releases contributed by @tjeerddie via #3019

strawberry - 🍓 0.201.0

Published by botberry about 1 year ago

Fix import error in strawberry.ext.mypy_plugin for users who don't use pydantic.

Releases contributed by @davidnemec via #3018

strawberry - 🍓 0.200.0

Published by botberry about 1 year ago

Adds initial support for pydantic V2.

This is extremely experimental for wider initial testing.

We do not encourage using this in production systems yet.

Releases contributed by @thejaminator via #2972

strawberry - 🍓 0.199.3

Published by botberry about 1 year ago

This release fixes an issue on relay.ListConnection where async iterables that returns
non async iterable objects after being sliced where producing errors.

This should fix an issue with async strawberry-graphql-django when returning already
prefetched QuerySets.

Releases contributed by @bellini666 via #3014

strawberry - 🍓 0.199.2

Published by botberry about 1 year ago

This releases improves how we handle Annotated and async types
(used in subscriptions). Previously we weren't able to use
unions with names inside subscriptions, now that's fixed 😊

Example:

@strawberry.type
class A:
    a: str


@strawberry.type
class B:
    b: str


@strawberry.type
class Query:
    x: str = "Hello"


@strawberry.type
class Subscription:
    @strawberry.subscription
    async def example_with_union(self) -> AsyncGenerator[Union[A, B], None]:
        yield A(a="Hi")

Releases contributed by @patrick91 via #3008

strawberry - 🍓 0.199.1

Published by botberry about 1 year ago

This release fixes an issue in the graphql-ws implementation
where sending a null payload would cause the connection
to be closed.

Releases contributed by @patrick91 via #3007

strawberry - 🍓 0.199.0

Published by botberry about 1 year ago

This release changes how we handle generic type vars, bringing
support to the new generic syntax in Python 3.12 (which will be out in October).

This now works:

@strawberry.type
class Edge[T]:
    cursor: strawberry.ID
    node_field: T


@strawberry.type
class Query:
    @strawberry.field
    def example(self) -> Edge[int]:
        return Edge(cursor=strawberry.ID("1"), node_field=1)


schema = strawberry.Schema(query=Query)

Releases contributed by @patrick91 via #2993

strawberry - 🍓 0.198.0

Published by botberry about 1 year ago

This release adds support for returning interfaces directly in resolvers:

@strawberry.interface
class Node:
    id: strawberry.ID

    @classmethod
    def resolve_type(cls, obj: Any, *args: Any, **kwargs: Any) -> str:
        return "Video" if obj.id == "1" else "Image"


@strawberry.type
class Video(Node):
    ...


@strawberry.type
class Image(Node):
    ...


@strawberry.type
class Query:
    @strawberry.field
    def node(self, id: strawberry.ID) -> Node:
        return Node(id=id)


schema = strawberry.Schema(query=Query, types=[Video, Image])

Releases contributed by @patrick91 via #2989

strawberry - 🍓 0.197.0

Published by botberry about 1 year ago

This release removes support for Python 3.7 as its end of life
was on 27 Jun 2023.

This will allow us to reduce the number of CI jobs we have,
and potentially use newer features of Python. ⚡

Releases contributed by @devkral via #2907

strawberry - 🍓 0.196.2

Published by botberry about 1 year ago

This release fixes an issue when trying to use Annotated[strawberry.auto, ...]
on python 3.10 or older, which got evident after the fix from 0.196.1.

Previously we were throwing the type away, since it usually is Any, but python
3.10 and older will validate that the first argument passed for Annotated
is callable (3.11+ does not do that anymore), and StrawberryAuto is not.

This changes it to keep that Any, which is also what someone would expect
when resolving the annotation using our custom eval_type function.

Releases contributed by @bellini666 via #2990

strawberry - 🍓 0.196.1

Published by botberry about 1 year ago

This release fixes an issue where annotations resolution for auto and lazy fields
using Annotated where not preserving the remaining arguments because of a
typo in the arguments filtering.

Releases contributed by @bellini666 via #2983

strawberry - 🍓 0.196.0

Published by botberry about 1 year ago

This release adds support for union with a single member, they are
useful for future proofing your schema in cases you know a field
will be part of a union in future.

import strawberry

from typing import Annotated


@strawberry.type
class Audio:
    duration: int


@strawberry.type
class Query:
    # note: Python's Union type doesn't support single members,
    # Union[Audio] is exactly the same as Audio, so we use
    # use Annotated and strawberry.union to tell Strawberry this is
    # a union with a single member
    latest_media: Annotated[Audio, strawberry.union("MediaItem")]


schema = strawberry.Schema(query=Query)

Releases contributed by @patrick91 via #2982

strawberry - 🍓 0.195.3

Published by botberry about 1 year ago

This release no longer requires an upperbound pin for uvicorn, ensuring
compatibility with future versions of uvicorn without the need for updating
Strawberry.

Releases contributed by @patrick91 via #2968

strawberry - 🍓 0.195.2

Published by botberry over 1 year ago

This release introduces a bug fix for relay connection where previously they wouldn't work without padding the first argument.

Releases contributed by @devkral via #2938

strawberry - 🍓 0.195.1

Published by botberry over 1 year ago

This release fixes a bug where returning a generic type from a field
that was returning an interface would throw an error.

Releases contributed by @patrick91 via #2955

strawberry - 🍓 0.195.0

Published by botberry over 1 year ago

Improve the time complexity of strawberry.interface using resolve_type.
Achieved time complexity is now O(1) with respect to the number of
implementations of an interface. Previously, the use of is_type_of resulted
in a worst-case performance of O(n).

Before:

---------------------------------------------------------------------------
Name (time in ms)                         Min                 Max
---------------------------------------------------------------------------
test_interface_performance[1]         18.0224 (1.0)       50.3003 (1.77)
test_interface_performance[16]        22.0060 (1.22)      28.4240 (1.0)
test_interface_performance[256]       69.1364 (3.84)      76.1349 (2.68)
test_interface_performance[4096]     219.6461 (12.19)    231.3732 (8.14)
---------------------------------------------------------------------------

After:

---------------------------------------------------------------------------
Name (time in ms)                        Min                Max
---------------------------------------------------------------------------
test_interface_performance[1]        14.3921 (1.0)      46.2064 (2.79)
test_interface_performance[16]       14.8669 (1.03)     16.5732 (1.0)
test_interface_performance[256]      15.8977 (1.10)     24.4618 (1.48)
test_interface_performance[4096]     18.7340 (1.30)     21.2899 (1.28)
---------------------------------------------------------------------------

Releases contributed by @skilkis via #1949

strawberry - 🍓 0.194.4

Published by botberry over 1 year ago

This release makes sure that Schema.process_errors() is called once for every error
which happens with graphql-transport-ws operations.

Releases contributed by @kristjanvalur via #2899

strawberry - 🍓 0.194.3

Published by botberry over 1 year ago

Added default argument to the typer Argument function, this adds
support for older versions of typer.

Releases contributed by @jaimecp89 via #2906

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