strawberry-graphql 0.271.1__py3-none-any.whl → 0.272.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import warnings
2
2
 
3
3
  from .add_validation_rules import AddValidationRules
4
4
  from .base_extension import LifecycleStep, SchemaExtension
5
+ from .disable_introspection import DisableIntrospection
5
6
  from .disable_validation import DisableValidation
6
7
  from .field_extension import FieldExtension
7
8
  from .mask_errors import MaskErrors
@@ -29,6 +30,7 @@ def __getattr__(name: str) -> type[SchemaExtension]:
29
30
 
30
31
  __all__ = [
31
32
  "AddValidationRules",
33
+ "DisableIntrospection",
32
34
  "DisableValidation",
33
35
  "FieldExtension",
34
36
  "IgnoreContext",
@@ -0,0 +1,36 @@
1
+ from graphql.validation import NoSchemaIntrospectionCustomRule
2
+
3
+ from strawberry.extensions import AddValidationRules
4
+
5
+
6
+ class DisableIntrospection(AddValidationRules):
7
+ """Disable introspection queries.
8
+
9
+ Example:
10
+
11
+ ```python
12
+ import strawberry
13
+ from strawberry.extensions import DisableIntrospection
14
+
15
+
16
+ @strawberry.type
17
+ class Query:
18
+ @strawberry.field
19
+ def hello(self) -> str:
20
+ return "Hello, world!"
21
+
22
+
23
+ schema = strawberry.Schema(
24
+ Query,
25
+ extensions=[
26
+ DisableIntrospection(),
27
+ ],
28
+ )
29
+ ```
30
+ """
31
+
32
+ def __init__(self) -> None:
33
+ super().__init__([NoSchemaIntrospectionCustomRule])
34
+
35
+
36
+ __all__ = ["DisableIntrospection"]
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import TYPE_CHECKING, Optional, cast
3
+ from typing import TYPE_CHECKING, Optional
4
4
 
5
5
  from graphql.language import OperationDefinitionNode
6
6
 
@@ -27,7 +27,8 @@ def get_operation_type(
27
27
 
28
28
  if operation_name:
29
29
  for d in graphql_document.definitions:
30
- d = cast("OperationDefinitionNode", d)
30
+ if not isinstance(d, OperationDefinitionNode):
31
+ continue
31
32
  if d.name and d.name.value == operation_name:
32
33
  definition = d
33
34
  break
@@ -1,23 +1,17 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.271.1
3
+ Version: 0.272.0
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  Keywords: graphql,api,rest,starlette,async
7
7
  Author: Patrick Arminio
8
8
  Author-email: patrick.arminio@gmail.com
9
- Requires-Python: >=3.9
9
+ Requires-Python: >=3.9,<4.0
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Programming Language :: Python :: 3.13
19
12
  Classifier: Topic :: Software Development :: Libraries
20
13
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Classifier: License :: OSI Approved :: MIT License
21
15
  Provides-Extra: aiohttp
22
16
  Provides-Extra: asgi
23
17
  Provides-Extra: chalice
@@ -35,31 +29,41 @@ Provides-Extra: pyinstrument
35
29
  Provides-Extra: quart
36
30
  Provides-Extra: sanic
37
31
  Requires-Dist: Django (>=3.2) ; extra == "django"
38
- Requires-Dist: aiohttp (>=3.7.4.post0,<4.0.0) ; extra == "aiohttp"
39
- Requires-Dist: asgiref (>=3.2,<4.0) ; extra == "django" or extra == "channels"
32
+ Requires-Dist: aiohttp (>=3.7.4.post0,<4) ; extra == "aiohttp"
33
+ Requires-Dist: asgiref (>=3.2,<4.0) ; extra == "channels"
34
+ Requires-Dist: asgiref (>=3.2,<4.0) ; extra == "django"
40
35
  Requires-Dist: chalice (>=1.22,<2.0) ; extra == "chalice"
41
36
  Requires-Dist: channels (>=3.0.5) ; extra == "channels"
42
37
  Requires-Dist: fastapi (>=0.65.2) ; extra == "fastapi"
43
38
  Requires-Dist: flask (>=1.1) ; extra == "flask"
44
- Requires-Dist: graphql-core (>=3.2.0,<3.4.0) ; python_version >= "3.9" and python_version < "4.0"
45
- Requires-Dist: libcst (>=0.4.7,<1.8.0) ; extra == "debug" or extra == "debug-server" or extra == "cli"
46
- Requires-Dist: litestar (>=2) ; (python_version >= "3.10" and python_version < "4.0") and (extra == "litestar")
39
+ Requires-Dist: graphql-core (>=3.2.0,<3.4.0)
40
+ Requires-Dist: libcst (>=0.4.7,<1.8.0) ; extra == "cli"
41
+ Requires-Dist: libcst (>=0.4.7,<1.8.0) ; extra == "debug"
42
+ Requires-Dist: libcst (>=0.4.7,<1.8.0) ; extra == "debug-server"
43
+ Requires-Dist: litestar (>=2) ; (python_version ~= "3.10") and (extra == "litestar")
47
44
  Requires-Dist: opentelemetry-api (<2) ; extra == "opentelemetry"
48
45
  Requires-Dist: opentelemetry-sdk (<2) ; extra == "opentelemetry"
49
46
  Requires-Dist: packaging (>=23)
50
47
  Requires-Dist: pydantic (>1.6.1) ; extra == "pydantic"
51
- Requires-Dist: pygments (>=2.3,<3.0) ; extra == "debug-server" or extra == "cli"
48
+ Requires-Dist: pygments (>=2.3,<3.0) ; extra == "cli"
49
+ Requires-Dist: pygments (>=2.3,<3.0) ; extra == "debug-server"
52
50
  Requires-Dist: pyinstrument (>=4.0.0) ; extra == "pyinstrument"
53
- Requires-Dist: python-dateutil (>=2.7.0,<3.0.0)
54
- Requires-Dist: python-multipart (>=0.0.7) ; extra == "asgi" or extra == "debug-server" or extra == "fastapi"
51
+ Requires-Dist: python-dateutil (>=2.7,<3.0)
52
+ Requires-Dist: python-multipart (>=0.0.7) ; extra == "asgi"
53
+ Requires-Dist: python-multipart (>=0.0.7) ; extra == "debug-server"
54
+ Requires-Dist: python-multipart (>=0.0.7) ; extra == "fastapi"
55
55
  Requires-Dist: quart (>=0.19.3) ; extra == "quart"
56
- Requires-Dist: rich (>=12.0.0) ; extra == "debug" or extra == "debug-server" or extra == "cli"
56
+ Requires-Dist: rich (>=12.0.0) ; extra == "cli"
57
+ Requires-Dist: rich (>=12.0.0) ; extra == "debug"
58
+ Requires-Dist: rich (>=12.0.0) ; extra == "debug-server"
57
59
  Requires-Dist: sanic (>=20.12.2) ; extra == "sanic"
58
- Requires-Dist: starlette (>=0.18.0) ; extra == "asgi" or extra == "debug-server"
59
- Requires-Dist: typer (>=0.7.0) ; extra == "debug-server" or extra == "cli"
60
+ Requires-Dist: starlette (>=0.18.0) ; extra == "asgi"
61
+ Requires-Dist: starlette (>=0.18.0) ; extra == "debug-server"
62
+ Requires-Dist: typer (>=0.7.0) ; extra == "cli"
63
+ Requires-Dist: typer (>=0.7.0) ; extra == "debug-server"
60
64
  Requires-Dist: typing-extensions (>=4.5.0)
61
65
  Requires-Dist: uvicorn (>=0.11.6) ; extra == "debug-server"
62
- Requires-Dist: websockets (>=15.0.1,<16.0.0) ; extra == "debug-server"
66
+ Requires-Dist: websockets (>=15.0.1,<16) ; extra == "debug-server"
63
67
  Project-URL: Changelog, https://strawberry.rocks/changelog
64
68
  Project-URL: Documentation, https://strawberry.rocks/
65
69
  Project-URL: Discord, https://discord.com/invite/3uQ2PaY
@@ -166,17 +170,6 @@ urlpatterns = [
166
170
  ]
167
171
  ```
168
172
 
169
- ## WebSockets
170
-
171
- To support graphql Subscriptions over WebSockets you need to provide a WebSocket
172
- enabled server. The debug server can be made to support WebSockets with these
173
- commands:
174
-
175
- ```shell
176
- pip install 'strawberry-graphql[debug-server]'
177
- pip install 'uvicorn[standard]'
178
- ```
179
-
180
173
  ## Examples
181
174
 
182
175
  * [Various examples on how to use Strawberry](https://github.com/strawberry-graphql/examples)
@@ -88,11 +88,12 @@ strawberry/ext/dataclasses/README.md,sha256=WE3523o9gBGpa18ikiQhgEUNuuBJWR5tMKmj
88
88
  strawberry/ext/dataclasses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
89
  strawberry/ext/dataclasses/dataclasses.py,sha256=bTW8nRwflW7_JtGhzXiKhe9Kajha_fgCfR0jVKrCzBw,2287
90
90
  strawberry/ext/mypy_plugin.py,sha256=KqpEWUnQftmmlC0CtK33H1FMR7P-WdI-F9Evnc60Mm0,20458
91
- strawberry/extensions/__init__.py,sha256=5U5A4HEXyJHT74MP6j_zx7Mom6S7ooklK-c9xA-kdHQ,1224
91
+ strawberry/extensions/__init__.py,sha256=2TXnEVXumViXzBe-9ppb0CX90Wbc6644IE7aJQAEAXs,1308
92
92
  strawberry/extensions/add_validation_rules.py,sha256=YwC_27jUpQ6DWcCB1RsuE1JD8R5rV7LAu5fVjdLchYs,1358
93
93
  strawberry/extensions/base_extension.py,sha256=ihsbUrhYt-x4X1j5a34FASmNF661Xev-3w4Qc5gUbHw,2351
94
94
  strawberry/extensions/context.py,sha256=9hTWNjxk-Kyr4RkpKE3BY05dkgS4WLRjJKj4tq28Lj8,7185
95
95
  strawberry/extensions/directives.py,sha256=F-ayBAImKHFap61WUJ_XO02COOFn3nWyN7cLkV9Dph0,3032
96
+ strawberry/extensions/disable_introspection.py,sha256=7FmktNvc9CzOJG9xf_nYG3LThs0cv-g2P-Kzlerna7w,717
96
97
  strawberry/extensions/disable_validation.py,sha256=WaA7x6Q-K4IMnvx35OQ1UtokIKaxkWvO_OJO9fFM_vA,750
97
98
  strawberry/extensions/field_extension.py,sha256=VUwUBbf57Vp_Ukc3Rh9eZDRuF2ubzRRipzsU-w5bAFc,5561
98
99
  strawberry/extensions/mask_errors.py,sha256=xPGN24l6C_zZ174jHQbOhSShTqqAB58ithhuTZjBXGQ,1481
@@ -227,11 +228,11 @@ strawberry/utils/graphql_lexer.py,sha256=JUVJrJ6Ax0t7m6-DTWFzf4cvXrC02VPmL1NS2zM
227
228
  strawberry/utils/importer.py,sha256=NtTgNaNSW4TnlLo_S34nxXq14RxUAec-QlEZ0LON28M,629
228
229
  strawberry/utils/inspect.py,sha256=-aFT65PkQ9KXo5w8Q2uveBJ8jEpi40sTqRipRQVdYR8,3406
229
230
  strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,746
230
- strawberry/utils/operation.py,sha256=s7ajvLg_q6v2mg47kEMQPjO_J-XluMKTCwo4d47mGvE,1195
231
+ strawberry/utils/operation.py,sha256=CCIREeh3-CzjvjyjhmYPRCVDZUX36jAxF6LbK8r5wEw,1222
231
232
  strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
232
233
  strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
233
- strawberry_graphql-0.271.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
234
- strawberry_graphql-0.271.1.dist-info/METADATA,sha256=Dn6jseflDfaS2Sixkjia853q8LgYKt5P5WrkVGyaLqg,7757
235
- strawberry_graphql-0.271.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
236
- strawberry_graphql-0.271.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
237
- strawberry_graphql-0.271.1.dist-info/RECORD,,
234
+ strawberry_graphql-0.272.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
235
+ strawberry_graphql-0.272.0.dist-info/METADATA,sha256=x6fAPZtfxCR9xdkVpPIFsgWmHLDYPTpJmZfKoMU0kpI,7444
236
+ strawberry_graphql-0.272.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
237
+ strawberry_graphql-0.272.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
238
+ strawberry_graphql-0.272.0.dist-info/RECORD,,