From 935a862001564b951ebb3447d26a366d365eefb2 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 24 Jun 2022 16:37:00 +0300 Subject: [PATCH] Add strawberry to repo --- default.nix | 9 +++ pkgs/selfprivacy-api/default.nix | 4 ++ pkgs/strawberry-graphql/default.nix | 30 +++++++++ .../strawberry-graphql.patch | 65 +++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 pkgs/strawberry-graphql/default.nix create mode 100644 pkgs/strawberry-graphql/strawberry-graphql.patch diff --git a/default.nix b/default.nix index 7843e34..d137115 100644 --- a/default.nix +++ b/default.nix @@ -3,5 +3,14 @@ let in self: super: rec { + python39 = super.python39.override { + packageOverrides = self: super: { + strawberry_graphql = callPackage ./strawberry_graphql/default.tix { + buildPythonPackage = super.buildPythonPackage + } + }; + }; + + python39Packages = python39.pkgs; selfprivacy-api = super.callPackage ./pkgs/selfprivacy-api {}; } diff --git a/pkgs/selfprivacy-api/default.nix b/pkgs/selfprivacy-api/default.nix index c82f236..2c83f99 100644 --- a/pkgs/selfprivacy-api/default.nix +++ b/pkgs/selfprivacy-api/default.nix @@ -19,6 +19,9 @@ let , huey , gevent , mnemonic + , pydantic + , typing-extensions + , strawberry_graphql }: buildPythonPackage rec { pname = "selfprivacy-api"; @@ -42,6 +45,7 @@ let huey gevent mnemonic + strawberry_graphql ]; meta = { description = '' diff --git a/pkgs/strawberry-graphql/default.nix b/pkgs/strawberry-graphql/default.nix new file mode 100644 index 0000000..78dde12 --- /dev/null +++ b/pkgs/strawberry-graphql/default.nix @@ -0,0 +1,30 @@ +{ lib, buildPythonPackage } + +buildPythonPackage rec { + pname = "strawberry-graphql"; + version = "0.114.5"; + format = "pyproject"; + patches = [ + ./strawberry-graphql.patch + ]; + propagatedBuildInputs = [ + typing-extensions + graphql-core + python-multipart + python-dateutil + flask + pydantic + pygments + poetry + ]; + + src = fetchPypi { + inherit pname version; + sha256 = "b6e007281cf29a66eeba66a512744853d8aa53b4ca2525befb6f350bb7b24df6"; + }; + + meta = with lib; { + homepage = "https://strawberry.rocks/"; + license = "MIT"; + }; +} diff --git a/pkgs/strawberry-graphql/strawberry-graphql.patch b/pkgs/strawberry-graphql/strawberry-graphql.patch new file mode 100644 index 0000000..3608342 --- /dev/null +++ b/pkgs/strawberry-graphql/strawberry-graphql.patch @@ -0,0 +1,65 @@ +diff --git a/pyproject.toml b/pyproject.toml +index 3283fce..89d3e8c 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -45,7 +45,6 @@ python-multipart = "^0.0.5" + sanic = {version = ">=20.12.2,<22.0.0", optional = true} + aiohttp = {version = "^3.7.4.post0", optional = true} + fastapi = {version = ">=0.65.2", optional = true} +-"backports.cached-property" = "^1.0.1" + + [tool.poetry.dev-dependencies] + pytest = "^7.1" +diff --git a/strawberry/field.py b/strawberry/field.py +index 4e7ee4b..06c2044 100644 +--- a/strawberry/field.py ++++ b/strawberry/field.py +@@ -1,5 +1,6 @@ + import builtins + import dataclasses ++from functools import cached_property + import inspect + import sys + from typing import ( +@@ -18,7 +19,6 @@ from typing import ( + overload, + ) + +-from backports.cached_property import cached_property + from typing_extensions import Literal + + from strawberry.annotation import StrawberryAnnotation +diff --git a/strawberry/types/fields/resolver.py b/strawberry/types/fields/resolver.py +index 0409233..f4fbe9a 100644 +--- a/strawberry/types/fields/resolver.py ++++ b/strawberry/types/fields/resolver.py +@@ -1,13 +1,12 @@ + from __future__ import annotations as _ + + import builtins ++from functools import cached_property + import inspect + import sys + from inspect import isasyncgenfunction, iscoroutinefunction + from typing import Callable, Dict, Generic, List, Mapping, Optional, TypeVar, Union + +-from backports.cached_property import cached_property +- + from strawberry.annotation import StrawberryAnnotation + from strawberry.arguments import StrawberryArgument + from strawberry.exceptions import MissingArgumentsAnnotationsError +diff --git a/strawberry/types/info.py b/strawberry/types/info.py +index a172c04..475a3ee 100644 +--- a/strawberry/types/info.py ++++ b/strawberry/types/info.py +@@ -1,9 +1,8 @@ + import dataclasses ++from functools import cached_property + import warnings + from typing import TYPE_CHECKING, Any, Dict, Generic, List, Optional, TypeVar, Union + +-from backports.cached_property import cached_property +- + from graphql import GraphQLResolveInfo, OperationDefinitionNode + from graphql.language import FieldNode + from graphql.pyutils.path import Path