From 6722aa294f2e3fc859a8b75e87eef6eaacd4dc61 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 17 Dec 2023 00:16:26 +0100 Subject: [PATCH] python3Packages.gradio-pdf: init at 0.0.3 --- .../python-modules/gradio-pdf/default.nix | 50 +++++++++++++++++++ .../python-modules/gradio/client.nix | 27 ++-------- .../python-modules/gradio/default.nix | 17 +++++++ pkgs/top-level/python-packages.nix | 2 + 4 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 pkgs/development/python-modules/gradio-pdf/default.nix diff --git a/pkgs/development/python-modules/gradio-pdf/default.nix b/pkgs/development/python-modules/gradio-pdf/default.nix new file mode 100644 index 000000000000..d2bbfecefdc3 --- /dev/null +++ b/pkgs/development/python-modules/gradio-pdf/default.nix @@ -0,0 +1,50 @@ +{ lib +, buildPythonPackage +, fetchPypi +, hatch-fancy-pypi-readme +, hatch-requirements-txt +, hatchling +, gradio +, gradio-client +}: + +buildPythonPackage rec { + pname = "gradio-pdf"; + version = "0.0.3"; + format = "pyproject"; + + src = fetchPypi { + pname = "gradio_pdf"; + inherit version; + hash = "sha256-l9bcH/6paEdKk9Q7HM3ap9MI1Qi7rPZ/ucAibBUEPKI="; + }; + + nativeBuildInputs = [ + hatch-fancy-pypi-readme + hatch-requirements-txt + hatchling + ]; + + propagatedBuildInputs = [ + gradio-client + ]; + + buildInputs = [ + gradio.sans-reverse-dependencies + ]; + disallowedReferences = [ + gradio.sans-reverse-dependencies + ]; + + pythonImportsCheck = [ "gradio_pdf" ]; + + # tested in `gradio` + doCheck = false; + + meta = with lib; { + description = "Python library for easily interacting with trained machine learning models"; + homepage = "https://pypi.org/project/gradio-pdf/"; + license = licenses.asl20; + maintainers = with maintainers; [ pbsds ]; + }; +} diff --git a/pkgs/development/python-modules/gradio/client.nix b/pkgs/development/python-modules/gradio/client.nix index b2d88af22e6e..e68f793f7301 100644 --- a/pkgs/development/python-modules/gradio/client.nix +++ b/pkgs/development/python-modules/gradio/client.nix @@ -25,24 +25,6 @@ , gradio }: -let - - # Cyclic dependencies are fun! - # This is gradio without gradio-client, only needed for checkPhase - gradio' = (gradio.override (old: { - gradio-client = null; - })).overridePythonAttrs (old: { - pname = old.pname + "-sans-client"; - nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ pythonRelaxDepsHook ]; - pythonRemoveDeps = (old.pythonRemoveDeps or []) ++ [ "gradio-client" ]; - doInstallCheck = false; - doCheck = false; - pythonImportsCheck = null; - dontCheckRuntimeDeps = true; - }); - -in - buildPythonPackage rec { pname = "gradio-client"; version = "0.7.3"; @@ -87,17 +69,16 @@ buildPythonPackage rec { websockets ]; - nativeCheckInputs =[ + nativeCheckInputs = [ pytestCheckHook pytest-asyncio pydub rich tomlkit - gradio' - ]; - disallowedReferences = [ - gradio' # ensuring we don't propagate this intermediate build + gradio.sans-reverse-dependencies ]; + # ensuring we don't propagate this intermediate build + disallowedReferences = [ gradio.sans-reverse-dependencies ]; # Add a pytest hook skipping tests that access network, marking them as "Expected fail" (xfail). preCheck = '' diff --git a/pkgs/development/python-modules/gradio/default.nix b/pkgs/development/python-modules/gradio/default.nix index faaf6db0c527..9495d52cbec8 100644 --- a/pkgs/development/python-modules/gradio/default.nix +++ b/pkgs/development/python-modules/gradio/default.nix @@ -3,6 +3,7 @@ , fetchPypi , pythonOlder , pythonRelaxDepsHook +, gradio # pyproject , hatchling @@ -165,6 +166,22 @@ buildPythonPackage rec { pythonImportsCheck = [ "gradio" ]; + # Cyclic dependencies are fun! + # This is gradio without gradio-client and gradio-pdf + passthru = { + sans-reverse-dependencies = (gradio.override (old: { + gradio-client = null; + })).overridePythonAttrs (old: { + pname = old.pname + "-sans-client"; + nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ pythonRelaxDepsHook ]; + pythonRemoveDeps = (old.pythonRemoveDeps or []) ++ [ "gradio-client" ]; + doInstallCheck = false; + doCheck = false; + pythonImportsCheck = null; + dontCheckRuntimeDeps = true; + }); + }; + meta = with lib; { homepage = "https://www.gradio.app/"; description = "Python library for easily interacting with trained machine learning models"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1dca36b64be2..c9827b79d281 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4821,6 +4821,8 @@ self: super: with self; { gradio-client = callPackage ../development/python-modules/gradio/client.nix { }; + gradio-pdf = callPackage ../development/python-modules/gradio-pdf { }; + grafanalib = callPackage ../development/python-modules/grafanalib/default.nix { }; grammalecte = callPackage ../development/python-modules/grammalecte { };