strawberry-graphql 0.230.0.dev1716318708__py3-none-any.whl → 0.231.1__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.
- strawberry/cli/__init__.py +12 -8
- strawberry/exceptions/__init__.py +2 -0
- strawberry/exceptions/missing_dependencies.py +20 -0
- strawberry/utils/typing.py +7 -1
- {strawberry_graphql-0.230.0.dev1716318708.dist-info → strawberry_graphql-0.231.1.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.230.0.dev1716318708.dist-info → strawberry_graphql-0.231.1.dist-info}/RECORD +9 -8
- {strawberry_graphql-0.230.0.dev1716318708.dist-info → strawberry_graphql-0.231.1.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.230.0.dev1716318708.dist-info → strawberry_graphql-0.231.1.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.230.0.dev1716318708.dist-info → strawberry_graphql-0.231.1.dist-info}/entry_points.txt +0 -0
strawberry/cli/__init__.py
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
-
|
2
|
-
from .
|
3
|
-
from .commands.
|
4
|
-
from .commands.
|
5
|
-
from .commands.schema_codegen import schema_codegen as schema_codegen # noqa
|
1
|
+
try:
|
2
|
+
from .app import app
|
3
|
+
from .commands.codegen import codegen as codegen # noqa
|
4
|
+
from .commands.export_schema import export_schema as export_schema # noqa
|
5
|
+
from .commands.schema_codegen import schema_codegen as schema_codegen # noqa
|
6
|
+
from .commands.server import server as server # noqa
|
7
|
+
from .commands.upgrade import upgrade as upgrade # noqa
|
6
8
|
|
7
|
-
|
9
|
+
def run() -> None:
|
10
|
+
app()
|
8
11
|
|
12
|
+
except ModuleNotFoundError as exc:
|
13
|
+
from strawberry.exceptions import MissingOptionalDependenciesError
|
9
14
|
|
10
|
-
|
11
|
-
app()
|
15
|
+
raise MissingOptionalDependenciesError(extras=["cli"]) from exc
|
@@ -12,6 +12,7 @@ from .handler import setup_exception_handler
|
|
12
12
|
from .invalid_argument_type import InvalidArgumentTypeError
|
13
13
|
from .invalid_union_type import InvalidTypeForUnionMergeError, InvalidUnionTypeError
|
14
14
|
from .missing_arguments_annotations import MissingArgumentsAnnotationsError
|
15
|
+
from .missing_dependencies import MissingOptionalDependenciesError
|
15
16
|
from .missing_field_annotation import MissingFieldAnnotationError
|
16
17
|
from .missing_return_annotation import MissingReturnAnnotationError
|
17
18
|
from .not_a_strawberry_enum import NotAStrawberryEnumError
|
@@ -186,4 +187,5 @@ __all__ = [
|
|
186
187
|
"MissingFieldAnnotationError",
|
187
188
|
"DuplicatedTypeName",
|
188
189
|
"StrawberryGraphQLError",
|
190
|
+
"MissingOptionalDependenciesError",
|
189
191
|
]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
|
6
|
+
class MissingOptionalDependenciesError(Exception):
|
7
|
+
"""Some optional dependencies that are required for a particular
|
8
|
+
task are missing."""
|
9
|
+
|
10
|
+
def __init__(
|
11
|
+
self,
|
12
|
+
*,
|
13
|
+
packages: Optional[list[str]] = None,
|
14
|
+
extras: Optional[list[str]] = None,
|
15
|
+
) -> None:
|
16
|
+
packages = packages or []
|
17
|
+
if extras:
|
18
|
+
packages.append(f"'strawberry-graphql[{','.join(extras)}]'")
|
19
|
+
hint = f" (hint: pip install {' '.join(packages)})" if packages else ""
|
20
|
+
self.message = f"Some optional dependencies are missing{hint}"
|
strawberry/utils/typing.py
CHANGED
@@ -278,6 +278,12 @@ def _get_namespace_from_ast(
|
|
278
278
|
|
279
279
|
for elt in cast(ast.Tuple, expr_slice).elts:
|
280
280
|
extra.update(_get_namespace_from_ast(elt, globalns, localns))
|
281
|
+
elif (
|
282
|
+
isinstance(expr, ast.Subscript)
|
283
|
+
and isinstance(expr.value, ast.Name)
|
284
|
+
and expr.value.id in {"list", "List"}
|
285
|
+
):
|
286
|
+
extra.update(_get_namespace_from_ast(expr.slice, globalns, localns))
|
281
287
|
elif (
|
282
288
|
isinstance(expr, ast.Subscript)
|
283
289
|
and isinstance(expr.value, ast.Name)
|
@@ -302,7 +308,7 @@ def _get_namespace_from_ast(
|
|
302
308
|
# here to resolve lazy types by execing the annotated args, resolving the
|
303
309
|
# type directly and then adding it to extra namespace, so that _eval_type
|
304
310
|
# can properly resolve it later
|
305
|
-
type_name = args[0].strip()
|
311
|
+
type_name = args[0].strip(" '\"\n")
|
306
312
|
for arg in args[1:]:
|
307
313
|
evaled_arg = eval(arg, globalns, localns) # noqa: PGH001, S307
|
308
314
|
if isinstance(evaled_arg, StrawberryLazyReference):
|
{strawberry_graphql-0.230.0.dev1716318708.dist-info → strawberry_graphql-0.231.1.dist-info}/RECORD
RENAMED
@@ -26,7 +26,7 @@ strawberry/channels/handlers/http_handler.py,sha256=i-E8dwiDaKQJEQDCak0AzOdYBGgY
|
|
26
26
|
strawberry/channels/handlers/ws_handler.py,sha256=Hi96i4hefjLuHlvS0__PW_LZ1_JQcbHYWMSyADB_csY,4658
|
27
27
|
strawberry/channels/router.py,sha256=kuz6N9PamkVdRn8J5Lkh_TKT_aMwg8zvlEyGYSoz3Jw,1935
|
28
28
|
strawberry/channels/testing.py,sha256=JtXQgNHqiMLVsswJnILXVtv3JlUbP7qslkI9247H1o4,5676
|
29
|
-
strawberry/cli/__init__.py,sha256=
|
29
|
+
strawberry/cli/__init__.py,sha256=byS5VrEiTJatAH6YS4V1Kd4SOwMRAQO2M1oJdIddivg,585
|
30
30
|
strawberry/cli/app.py,sha256=tTMBV1pdWqMcwjWO2yn-8oLDhMhfJvUzyQtWs75LWJ0,54
|
31
31
|
strawberry/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
32
|
strawberry/cli/commands/codegen.py,sha256=f3TKQVeg0iMYV3qcSXlvTNgG73ZWC60zjbeuK_RkQ3M,3825
|
@@ -60,7 +60,7 @@ strawberry/django/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPd
|
|
60
60
|
strawberry/django/test/client.py,sha256=lPEbe_4lNL1pSgtywq4O-b6n7ALCW3U9_uvoWz3EaSM,592
|
61
61
|
strawberry/django/views.py,sha256=zp_4a2i1I7ngK0_9znvvHbo-JWviGWq1aptRhn9RQ2A,9187
|
62
62
|
strawberry/enum.py,sha256=ufChUVwXM5KsphCkuLCzCewL8YT8RI_nzXVokMYwFnA,4255
|
63
|
-
strawberry/exceptions/__init__.py,sha256=
|
63
|
+
strawberry/exceptions/__init__.py,sha256=S-ZwZEvIwAyw4Kj-4xPQdnqzaXKjUAPjFu_KHsec-do,6337
|
64
64
|
strawberry/exceptions/conflicting_arguments.py,sha256=68f6kMSXdjuEjZkoe8o2I9PSIjwTS1kXsSGaQBPk_hI,1587
|
65
65
|
strawberry/exceptions/duplicated_type_name.py,sha256=FYJ2f0sivw8UU2kO2W1Rpbn_KskXjPxOt8WiuFcEcGI,2209
|
66
66
|
strawberry/exceptions/exception.py,sha256=1NrsTAzko1fUrSpXjYpNoCk2XuYJerEKj_CDeqGe_eA,3447
|
@@ -69,6 +69,7 @@ strawberry/exceptions/handler.py,sha256=Ka-uFyyNtduNVnz_SXZrthSNLN6HCzHtMXV4_fAb
|
|
69
69
|
strawberry/exceptions/invalid_argument_type.py,sha256=0WEZSv8MI2yWEMl1Scecq7uHWxhERTb-eB2HzEhw1vk,2195
|
70
70
|
strawberry/exceptions/invalid_union_type.py,sha256=jCRFjDfNkqh_QRVdnNIbjEkAsD4QcJT4MW_KIAu_Qwc,3608
|
71
71
|
strawberry/exceptions/missing_arguments_annotations.py,sha256=9eCpMsdIo_lOmyQKAfOfEjJHW2APu0pTIdHpw96nDJk,2012
|
72
|
+
strawberry/exceptions/missing_dependencies.py,sha256=DjVWwhiOxY2mubi7giwVLLBP3ljPHWWKWUw1u_F8OFo,637
|
72
73
|
strawberry/exceptions/missing_field_annotation.py,sha256=sZ94_b7GlFZ-KR2S1VyXFx8MV2E7uFITg9wcvWhv1Mk,1338
|
73
74
|
strawberry/exceptions/missing_return_annotation.py,sha256=M67VaWf9OSK_eeIeyWCIrZDClIfhj7IUlcgQh7vYuHM,1404
|
74
75
|
strawberry/exceptions/not_a_strawberry_enum.py,sha256=MC7zbNvINTluywuVGX4oBFJzPw9Uy2M0a4A3VkQqDYI,1105
|
@@ -243,9 +244,9 @@ strawberry/utils/inspect.py,sha256=6z-tJpiWWm6E4-O6OUfhu689W9k1uY0m3FDwAfVCiNs,2
|
|
243
244
|
strawberry/utils/logging.py,sha256=flS7hV0JiIOEdXcrIjda4WyIWix86cpHHFNJL8gl1y4,713
|
244
245
|
strawberry/utils/operation.py,sha256=Um-tBCPl3_bVFN2Ph7o1mnrxfxBes4HFCj6T0x4kZxE,1135
|
245
246
|
strawberry/utils/str_converters.py,sha256=avIgPVLg98vZH9mA2lhzVdyyjqzLsK2NdBw9mJQ02Xk,813
|
246
|
-
strawberry/utils/typing.py,sha256=
|
247
|
-
strawberry_graphql-0.
|
248
|
-
strawberry_graphql-0.
|
249
|
-
strawberry_graphql-0.
|
250
|
-
strawberry_graphql-0.
|
251
|
-
strawberry_graphql-0.
|
247
|
+
strawberry/utils/typing.py,sha256=K31YP0DftNDBhsk1yhW0BmYoEegU8nWOD26dvkRx2Xo,13717
|
248
|
+
strawberry_graphql-0.231.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
249
|
+
strawberry_graphql-0.231.1.dist-info/METADATA,sha256=Jjt0kCgkYL87HHt7YZdAupKFIbeWEAgn97nKERtP8Ig,7821
|
250
|
+
strawberry_graphql-0.231.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
251
|
+
strawberry_graphql-0.231.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
252
|
+
strawberry_graphql-0.231.1.dist-info/RECORD,,
|
{strawberry_graphql-0.230.0.dev1716318708.dist-info → strawberry_graphql-0.231.1.dist-info}/LICENSE
RENAMED
File without changes
|
{strawberry_graphql-0.230.0.dev1716318708.dist-info → strawberry_graphql-0.231.1.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|