From 0bd48eae0dad5f4b65d970a754aae579517d10a6 Mon Sep 17 00:00:00 2001 From: Letgamer Date: Sun, 12 Apr 2026 16:54:40 +0200 Subject: [PATCH] python3Packages.gradient: overhaul package --- .../python-modules/gradient/default.nix | 95 +++++++------------ 1 file changed, 34 insertions(+), 61 deletions(-) diff --git a/pkgs/development/python-modules/gradient/default.nix b/pkgs/development/python-modules/gradient/default.nix index a03dd7d1de8a..47af6704df75 100644 --- a/pkgs/development/python-modules/gradient/default.nix +++ b/pkgs/development/python-modules/gradient/default.nix @@ -1,83 +1,56 @@ { lib, - attrs, - boto3, buildPythonPackage, - click-completion, - click-didyoumean, - click-help-colors, - colorama, - fetchPypi, - gradient-statsd, - gradient-utils, - gql, - halo, - marshmallow, - progressbar2, - pyopenssl, - pyyaml, - requests, - requests-toolbelt, - terminaltables, - websocket-client, + fetchFromGitHub, + hatchling, + hatch-fancy-pypi-readme, + httpx, + pydantic, + typing-extensions, + anyio, + distro, + sniffio, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "gradient"; version = "3.10.1"; - format = "setuptools"; + pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-TL9Jbo9UvQhgG9aT3wjLD8DvTY48Os04DdaUfNAwcu4="; + src = fetchFromGitHub { + owner = "digitalocean"; + repo = "gradient-python"; + rev = "v${finalAttrs.version}"; + hash = "sha256-Psre4HdF4/cgQ5CcM3H6PC+6asej4Is4+932Gvym774="; }; postPatch = '' - substituteInPlace setup.py \ - --replace 'attrs<=' 'attrs>=' \ - --replace 'colorama==' 'colorama>=' \ - --replace 'gql[requests]==3.0.0a6' 'gql' \ - --replace 'PyYAML==5.*' 'PyYAML' \ - --replace 'marshmallow<' 'marshmallow>=' \ - --replace 'websocket-client==0.57.*' 'websocket-client' + substituteInPlace pyproject.toml \ + --replace-fail "hatchling==1.26.3" "hatchling" ''; - propagatedBuildInputs = [ - attrs - boto3 - click-completion - click-didyoumean - click-help-colors - colorama - gql - gradient-statsd - gradient-utils - halo - marshmallow - progressbar2 - pyopenssl - pyyaml - requests - requests-toolbelt - terminaltables - websocket-client + nativeBuildInputs = [ + hatchling + hatch-fancy-pypi-readme ]; - # Tries to use /homeless-shelter to mimic container usage, etc - doCheck = false; + dependencies = [ + httpx + pydantic + typing-extensions + anyio + distro + sniffio + ]; - # marshmallow.exceptions.StringNotCollectionError: "only" should be a collection of strings. - # Support for marshmallow > 3 - # pythonImportsCheck = [ - # "gradient" - # ]; + pythonImportsCheck = [ "gradient" ]; meta = { - description = "Command line interface for Gradient"; + description = "Python API library for Gradient"; mainProgram = "gradient"; - homepage = "https://github.com/Paperspace/gradient-cli"; - license = lib.licenses.isc; + homepage = "https://github.com/digitalocean/gradient-python"; + license = lib.licenses.asl20; platforms = lib.platforms.unix; maintainers = with lib.maintainers; [ thoughtpolice ]; }; -} +})