strawberry

A GraphQL library for Python that leverages type annotations 🍓

MIT License

Downloads
1.1M
Stars
3.8K
Committers
260
strawberry - 🍓 0.73.8

Published by botberry about 3 years ago

This releases fixes a MyPy issue that prevented from using types created with
create_type as base classes. This is now allowed and doesn't throw any error:

import strawberry
from strawberry.tools import create_type

@strawberry.field
def name() -> str:
    return "foo"

MyType = create_type("MyType", [name])

class Query(MyType):
    ...
strawberry - 🍓 0.73.7

Published by botberry about 3 years ago

This release fixes an import error when trying to import create_type without having opentelemetry installed.

strawberry - 🍓 0.73.6

Published by botberry about 3 years ago

This release adds support for the latest version of the optional opentelemetry dependency.

strawberry - 🍓 0.73.5

Published by botberry about 3 years ago

This release adds support for the latest version of the optional opentelemetry dependency.

strawberry - 🍓 0.73.4

Published by botberry about 3 years ago

This release allows background tasks to be set with the ASGI integration. Tasks can be set on the response in the context, and will then get run after the query result is returned.

from starlette.background import BackgroundTask

@strawberry.mutation
def create_flavour(self, info: Info) -> str:
    info.context["response"].background = BackgroundTask(...)
strawberry - 🍓 0.73.3

Published by botberry about 3 years ago

This release caches attributes on the Info type which aren't delegated to the core info object.

strawberry - 🍓 0.73.2

Published by botberry about 3 years ago

This releases fixes an issue where you were not allowed
to use duck typing and return a different type that the
type declared on the field when the type was implementing
an interface. Now this works as long as you return a type
that has the same shape as the field type.

strawberry - 🍓 0.73.1

Published by botberry about 3 years ago

This release improves execution performance significantly by lazy loading
attributes on the Info type 🏎

strawberry - 🍓 0.73.0

Published by botberry about 3 years ago

This release adds support for asynchronous hooks to the Strawberry extension-system.
All available hooks can now be implemented either synchronously or asynchronously.

It's also possible to mix both synchronous and asynchronous hooks within one extension.

from strawberry.extensions import Extension

class MyExtension(Extension):
    async def on_request_start(self):
        print("GraphQL request start")

    def on_request_end(self):
        print("GraphQL request end")
strawberry - 🍓 0.72.3

Published by botberry about 3 years ago

This release refactors the reload feature of the built-in debug server. The refactor
made the debug server more responsive and allowed us to remove hupper from the
dependencies.

strawberry - 🍓 0.72.2

Published by botberry about 3 years ago

This releases pins graphql-core to only accept patch versions in order to prevent breaking changes since graphql-core doesn't properly follow semantic versioning.

strawberry - 🍓 0.72.1

Published by botberry about 3 years ago

This release improves the default logging format for errors to include more information about the errors. For example it will show were an error was originated in a request:

GraphQL request:2:5
1 | query {
2 |     example
  |     ^
3 | }
strawberry - 🍓 0.72.0

Published by botberry about 3 years ago

This release adds support for asynchronous permission classes. The only difference to
their synchronous counterpart is that the has_permission method is asynchronous.

from strawberry.permission import BasePermission

class IsAuthenticated(BasePermission):
    message = "User is not authenticated"

    async def has_permission(self, source, info, **kwargs):
        return True
strawberry - 🍓 0.71.3

Published by botberry about 3 years ago

Get a field resolver correctly when extending from a pydantic model

strawberry - 🍓 0.71.2

Published by botberry about 3 years ago

This release adds asgi as an extra dependencies group for Strawberry. Now
you can install the required dependencies needed to use Strawberry with
ASGI by running:

pip install strawberry[asgi]
strawberry - 🍓 0.71.1

Published by botberry about 3 years ago

This releases adds selected_fields on the info objects and it
allows to introspect the fields that have been selected in a GraphQL
operation.

This can become useful to run optimisation based on the queried fields.

strawberry - 🍓 0.71.0

Published by botberry about 3 years ago

This release adds a query depth limit validation rule so that you can guard
against malicious queries:

import strawberry
from strawberry.schema import default_validation_rules
from strawberry.tools import depth_limit_validator


# Add the depth limit validator to the list of default validation rules
validation_rules = (
  default_validation_rules + [depth_limit_validator(3)]
)

result = schema.execute_sync(
    """
    query MyQuery {
      user {
        pets {
          owner {
            pets {
              name
            }
          }
        }
      }
    }
    """,
    validation_rules=validation_rules,
  )
)
assert len(result.errors) == 1
assert result.errors[0].message == "'MyQuery' exceeds maximum operation depth of 3"
strawberry - 🍓 0.70.4

Published by botberry about 3 years ago

Addition of app.add_websocket_route("/subscriptions", graphql_app) to FastAPI example docs

strawberry - 🍓 0.70.3

Published by botberry about 3 years ago

This release changes how we map Pydantic fields to types
to allow using older version of Pydantic.

strawberry - 🍓 0.70.2

Published by botberry about 3 years ago

This release makes the strawberry server command inform the user about missing
dependencies required by the builtin debug server.

Also hupper a package only used by said command has been made optional.

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