Skip to content

Commit

Permalink
Bumped python-multipart to >=0.0.7 (#3375)
Browse files Browse the repository at this point in the history
* Bumped python-multipart to >=0.0.7

* Bumped python-multipart to >=0.0.7

* Update RELEASE.md

* Update ruff and config

* Ignore lint issue

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Patrick Arminio <patrick.arminio@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 6, 2024
1 parent 6123d62 commit af6ae1f
Show file tree
Hide file tree
Showing 63 changed files with 1,345 additions and 1,108 deletions.
6 changes: 3 additions & 3 deletions .github/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.ruff]
extend = "../pyproject.toml"
extend-ignore = [
"T201",
]

[tool.ruff.lint]
extend-ignore = ["T201"]
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.2.1
hooks:
- id: ruff-format
exclude: ^tests/\w+/snapshots/
Expand Down
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"proseWrap": "always",
"printWidth": 80
}
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Release type: patch

This releases updates the dependency of `python-multipart` to be at least `0.0.7` (which includes a security fix).

It also removes the upper bound for `python-multipart` so you can always install the latest version (if compatible) 😊
25 changes: 13 additions & 12 deletions docs/breaking-changes/0.180.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ title: 0.180.0 Breaking changes

# v0.180.0 introduces a breaking change for the Django Channels HTTP integration

The context object is now a `dict`. This means that you should access the context
value using the `["key"]` syntax instead of the `.key` syntax.
The context object is now a `dict`. This means that you should access the
context value using the `["key"]` syntax instead of the `.key` syntax.

For the HTTP integration, there is also no `ws` key anymore and `request` is a custom
request object containing the full request instead of a `GraphQLHTTPConsumer` instance.
If you need to access the `GraphQLHTTPConsumer` instance in a HTTP connection, you can
access it via `info.context["request"].consumer`.
For the HTTP integration, there is also no `ws` key anymore and `request` is a
custom request object containing the full request instead of a
`GraphQLHTTPConsumer` instance. If you need to access the `GraphQLHTTPConsumer`
instance in a HTTP connection, you can access it via
`info.context["request"].consumer`.

For the WebSockets integration, the context keys did not change, e.g. the values for
`info.context["ws"]`, `info.context["request"]` and `info.context["connection_params"]`
are the same as before.
For the WebSockets integration, the context keys did not change, e.g. the values
for `info.context["ws"]`, `info.context["request"]` and
`info.context["connection_params"]` are the same as before.

If you still want to use the `.key` syntax, you can override `get_context()`
to return a custom dataclass there. See the Channels integration documentation
for an example.
If you still want to use the `.key` syntax, you can override `get_context()` to
return a custom dataclass there. See the Channels integration documentation for
an example.
6 changes: 4 additions & 2 deletions docs/breaking-changes/0.213.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ title: 0.213.0 Deprecation
# v0.213.0 introduces a deprecation for `graphiql` parameter

All HTTP integration now will use `graphql_ide` instead of `graphiql` parameter.
If you're not using the `graphiql` parameter, you can safely ignore this deprecation.
If you're not using the `graphiql` parameter, you can safely ignore this
deprecation.

If you're using the `graphiql` parameter, you should change it to `graphql_ide` instead.
If you're using the `graphiql` parameter, you should change it to `graphql_ide`
instead.

Here's an example of the changes:

Expand Down
4 changes: 2 additions & 2 deletions docs/codegen/query-codegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ class QueryCodegenPlugin:

### Console plugin

There is also a plugin that helps to orchestrate the codegen process and notify the
user about what the current codegen process is doing.
There is also a plugin that helps to orchestrate the codegen process and notify
the user about what the current codegen process is doing.

The interface for the ConsolePlugin looks like:

Expand Down
8 changes: 4 additions & 4 deletions docs/concepts/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ title: Async

# Async

Async is a concurrent programming design that has been supported in Python
since version 3.4. To learn more about async in Python refer to
Async is a concurrent programming design that has been supported in Python since
version 3.4. To learn more about async in Python refer to
[Real Python’s Async walkthrough](https://realpython.com/async-io-python/).

Strawberry supports both async and non async resolvers, so you can mix and
match them in your code. Here’s an example of an async resolver:
Strawberry supports both async and non async resolvers, so you can mix and match
them in your code. Here’s an example of an async resolver:

```python
import asyncio
Expand Down
4 changes: 2 additions & 2 deletions docs/editors/vscode.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ title: Visual studio code
Strawberry comes with support for both MyPy and Pylance, Microsoft's own
language server for Python.

This guide will explain how to configure Visual Studio Code and Pylance to
work with Strawberry.
This guide will explain how to configure Visual Studio Code and Pylance to work
with Strawberry.

## Install Pylance

Expand Down
4 changes: 2 additions & 2 deletions docs/errors/missing-arguments-annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class Query:
schema = strawberry.Schema(query=Query)
```

This happens because Strawberry needs to know the type of every argument to be able to
generate the correct GraphQL type.
This happens because Strawberry needs to know the type of every argument to be
able to generate the correct GraphQL type.

## How to fix this error

Expand Down
8 changes: 4 additions & 4 deletions docs/errors/node-id-annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ title: Node ID annotation error

## Description

This error is thrown when a `relay.Node` implemented type can't resolve its
`id` field, due to it being missing or multiple annotated fields being found.
This error is thrown when a `relay.Node` implemented type can't resolve its `id`
field, due to it being missing or multiple annotated fields being found.

The following code will throw this error:

Expand All @@ -25,8 +25,8 @@ class Fruit(relay.Node):
This happens because `relay.Node` don't know which field should be used to
resolve to generate its `GlobalID` field.

The following would also throw this errors because multiple candidates
were found:
The following would also throw this errors because multiple candidates were
found:

```python
import strawberry
Expand Down
11 changes: 6 additions & 5 deletions docs/errors/permission-fail-silently-requires-optional.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ title: Using silent permissions on optional fields

## Description

This error is thrown when a permission extension is configured to use silent permissions on a field that is
required and not a list:
This error is thrown when a permission extension is configured to use silent
permissions on a field that is required and not a list:

```python
import strawberry
Expand All @@ -28,9 +28,10 @@ class Query:
schema = strawberry.Schema(query=Query)
```

This happens because fail_silently is suppsed to hide the field from a user without an error in case of no permissions.
However, non-nullable fields always raise an error when they are set to null.
The only exception to that is a list, because an empty list can be returned.
This happens because fail_silently is suppsed to hide the field from a user
without an error in case of no permissions. However, non-nullable fields always
raise an error when they are set to null. The only exception to that is a list,
because an empty list can be returned.

## How to fix this error

Expand Down
8 changes: 4 additions & 4 deletions docs/errors/relay-wrong-annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ title: Relay wrong annotation Error

## Description

This error is thrown when a field on a relay connection has a wrong
type annotation. For example, the following code will throw this error:
This error is thrown when a field on a relay connection has a wrong type
annotation. For example, the following code will throw this error:

```python
from typing import List
Expand Down Expand Up @@ -36,8 +36,8 @@ class Query:

## How to fix this error

You can fix this error by properly annotating your attribute or resolver
with `relay.Connection` type subclass.
You can fix this error by properly annotating your attribute or resolver with
`relay.Connection` type subclass.

For example:

Expand Down
12 changes: 6 additions & 6 deletions docs/errors/relay-wrong-resolver-annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ title: Relay wrong resolver annotation Error

## Description

This error is thrown when a field on a relay connection was defined with
a resolver that returns something that is not compatible with pagination.
This error is thrown when a field on a relay connection was defined with a
resolver that returns something that is not compatible with pagination.

For example, the following code would throw this error:

Expand Down Expand Up @@ -68,9 +68,9 @@ class Query:

<Note>

Note that if you are returning a type different than the connection type,
you will need to subclass the connection type and override its
`resolve_node` method to convert it to the correct type, as explained in
the [relay guide](../guides/relay).
Note that if you are returning a type different than the connection type, you
will need to subclass the connection type and override its `resolve_node` method
to convert it to the correct type, as explained in the
[relay guide](../guides/relay).

<Note/>
4 changes: 3 additions & 1 deletion docs/extensions/add-validation-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ tags: validation,security

This extension allows you add custom validation rules.

See [graphql.validation.rules.custom](https://github.com/graphql-python/graphql-core/tree/main/src/graphql/validation/rules/custom) for some custom rules that can be added from GraphQl-core.
See
[graphql.validation.rules.custom](https://github.com/graphql-python/graphql-core/tree/main/src/graphql/validation/rules/custom)
for some custom rules that can be added from GraphQl-core.

## Usage example:

Expand Down
7 changes: 5 additions & 2 deletions docs/extensions/apollo-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ tags: tracing

# `ApolloTracingExtension`

This extension adds [tracing information](https://github.com/apollographql/apollo-tracing) to your response for [Apollo Engine](https://www.apollographql.com/platform/).
This extension adds
[tracing information](https://github.com/apollographql/apollo-tracing) to your
response for [Apollo Engine](https://www.apollographql.com/platform/).

## Usage example:

Expand All @@ -24,7 +26,8 @@ schema = strawberry.Schema(

<Note>

If you are not running in an Async context then you'll need to use the sync version:
If you are not running in an Async context then you'll need to use the sync
version:

```python
import strawberry
Expand Down
3 changes: 2 additions & 1 deletion docs/extensions/datadog.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ _No arguments_

### Overriding the `create_span` method

You can customize any of the spans or add tags to them by overriding the `create_span` method.
You can customize any of the spans or add tags to them by overriding the
`create_span` method.

Example:

Expand Down
10 changes: 6 additions & 4 deletions docs/extensions/disable-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ tags: performance,validation

# `DisableValidation`

This extensions disables all query validation. This can be useful to improve performance in some specific cases, for example when dealing with internal APIs where queries can be trusted.
This extensions disables all query validation. This can be useful to improve
performance in some specific cases, for example when dealing with internal APIs
where queries can be trusted.

<Warning>

Only do this if you know what you are doing! Disabling validation breaks the safety of having typed schema. If you are trying to
improve performance you might want to consider using the
[ValidationCache](./validation-cache) instead.
Only do this if you know what you are doing! Disabling validation breaks the
safety of having typed schema. If you are trying to improve performance you
might want to consider using the [ValidationCache](./validation-cache) instead.

</Warning>

Expand Down
6 changes: 4 additions & 2 deletions docs/extensions/max-aliases-limiter.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
title: MaxAliasesLimiter
summary: Add a validator to limit the maximum number of aliases in a GraphQL document.
summary:
Add a validator to limit the maximum number of aliases in a GraphQL document.
tags: security
---

# `MaxAliasesLimiter`

This extension adds a validator to limit the maximum number of aliases in a GraphQL document.
This extension adds a validator to limit the maximum number of aliases in a
GraphQL document.

## Usage example:

Expand Down
9 changes: 6 additions & 3 deletions docs/extensions/max-tokens-limiter.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
title: MaxTokensLimiter
summary: Add a validator to limit the maximum number of tokens in a GraphQL document.
summary:
Add a validator to limit the maximum number of tokens in a GraphQL document.
tags: security
---

# `MaxTokensLimiter`

This extension adds a validator to limit the maximum number of tokens in a GraphQL document sent to the server.
This extension adds a validator to limit the maximum number of tokens in a
GraphQL document sent to the server.

## Usage example:

Expand All @@ -22,7 +24,8 @@ schema = strawberry.Schema(
)
```

With the above configuration, if a client sends a query with more than 1000 tokens, the server will respond with an error message.
With the above configuration, if a client sends a query with more than 1000
tokens, the server will respond with an error message.

## API reference:

Expand Down
22 changes: 13 additions & 9 deletions docs/extensions/query-depth-limiter.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,30 @@ The maximum allowed depth for any operation in a GraphQL document.

#### `callback: Optional[Callable[[Dict[str, int]], None]`

Called each time validation runs. Receives a dictionary which is a
map of the depths for each operation.
Called each time validation runs. Receives a dictionary which is a map of the
depths for each operation.

#### `should_ignore: Optional[Callable[[IgnoreContext], bool]]`

Called at each field to determine whether the field should be ignored or not.
Must be implemented by the user and returns `True` if the field should be ignored
and `False` otherwise.
Must be implemented by the user and returns `True` if the field should be
ignored and `False` otherwise.

The `IgnoreContext` class has the following attributes:

- `field_name` of type `str`: the name of the field to be compared against
- `field_args` of type `strawberry.extensions.query_depth_limiter.FieldArgumentsType`: the arguments of the field to be compared against
- `field_args` of type
`strawberry.extensions.query_depth_limiter.FieldArgumentsType`: the arguments
of the field to be compared against
- `query` of type `graphql.language.Node`: the query string
- `context` of type `graphql.validation.ValidationContext`: the context passed to the query
- `context` of type `graphql.validation.ValidationContext`: the context passed
to the query

This argument is injected, regardless of name, by the `QueryDepthLimiter` class and should not be passed by the user.
This argument is injected, regardless of name, by the `QueryDepthLimiter` class
and should not be passed by the user.

Instead, the user should write business logic to determine whether a field should be ignored or not by
the attributes of the `IgnoreContext` class.
Instead, the user should write business logic to determine whether a field
should be ignored or not by the attributes of the `IgnoreContext` class.

## Example with field_name:

Expand Down
5 changes: 3 additions & 2 deletions docs/extensions/sentry-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ tags: tracing

<Warning>

As of Sentry 1.32.0, Strawberry is now supported by default. This extension is no longer necessary.
For more details, please refer to the [release notes](https://github.com/getsentry/sentry-python/releases/tag/1.32.0).
As of Sentry 1.32.0, Strawberry is now supported by default. This extension is
no longer necessary. For more details, please refer to the
[release notes](https://github.com/getsentry/sentry-python/releases/tag/1.32.0).

Below is the revised usage example:

Expand Down
6 changes: 4 additions & 2 deletions docs/extensions/validation-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ tags: performance,caching,validation

# `ValidationCache`

This extension adds LRU caching to the validation step of query execution to improve performance by caching the validation errors in memory.
This extension adds LRU caching to the validation step of query execution to
improve performance by caching the validation errors in memory.

## Usage example:

Expand All @@ -30,7 +31,8 @@ class ValidationCache(maxsize=None): ...

#### `maxsize: Optional[int] = None`

Set the maxsize of the cache. If `maxsize` is set to `None` then the cache will grow without bound.
Set the maxsize of the cache. If `maxsize` is set to `None` then the cache will
grow without bound.

More info: https://docs.python.org/3/library/functools.html#functools.lru_cache

Expand Down
Loading

0 comments on commit af6ae1f

Please sign in to comment.