diff --git a/pkgs/development/python-modules/gradio-pdf/default.nix b/pkgs/development/python-modules/gradio-pdf/default.nix index 0bcfd0586459..1b86c84fbef3 100644 --- a/pkgs/development/python-modules/gradio-pdf/default.nix +++ b/pkgs/development/python-modules/gradio-pdf/default.nix @@ -1,7 +1,7 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, hatch-fancy-pypi-readme, hatch-requirements-txt, hatchling, @@ -9,15 +9,18 @@ gradio-client, }: -buildPythonPackage rec { +buildPythonPackage { pname = "gradio-pdf"; - version = "0.0.19"; + version = "0.0.22"; pyproject = true; - src = fetchPypi { - pname = "gradio_pdf"; - inherit version; - hash = "sha256-UVHNyKU2cl/0HZqntnyBOFmgeIJ6UjJejEqKqFIPdoo="; + src = fetchFromGitHub { + owner = "freddyaboulton"; + repo = "gradio-pdf"; + # No source release on Pypi + # No tags on GitHub + rev = "8833e9cd419d2a5eeff98e3ae8cbe690913bcfce"; + hash = "sha256-z9rfVnH2qANDp2ukUGSogADbwqQQzCkB7Cp/04UtEpM="; }; build-system = [ diff --git a/pkgs/development/python-modules/gradio/client.nix b/pkgs/development/python-modules/gradio/client.nix index beb94dd7eb25..ae0f5f94e01f 100644 --- a/pkgs/development/python-modules/gradio/client.nix +++ b/pkgs/development/python-modules/gradio/client.nix @@ -4,12 +4,13 @@ buildPythonPackage, fetchFromGitHub, nix-update-script, - pythonOlder, - # pyproject + + # build-system hatchling, hatch-requirements-txt, hatch-fancy-pypi-readme, - # runtime + + # dependencies setuptools, fsspec, httpx, @@ -17,23 +18,23 @@ packaging, typing-extensions, websockets, - # checkInputs - pytestCheckHook, - pytest-asyncio, - pydub, - rich, - tomlkit, + + # tests gradio, + pydub, + pytest-asyncio, + pytestCheckHook, + rich, safehttpx, + tomlkit, + writableTmpDirAsHomeHook, }: buildPythonPackage rec { pname = "gradio-client"; - version = "1.5.3"; + version = "1.7.2"; pyproject = true; - disabled = pythonOlder "3.8"; - # no tests on pypi src = fetchFromGitHub { owner = "gradio-app"; @@ -41,11 +42,10 @@ buildPythonPackage rec { # not to be confused with @gradio/client@${version} tag = "gradio_client@${version}"; sparseCheckout = [ "client/python" ]; - hash = "sha256-u4GQYtCeAMDqRRbZGtjfqIHwuHyxUpw6kRE75SJMALg="; + hash = "sha256-9hEls6f3aBNg7W2RGhu68mJSGlUScpNqMGsdHxTGyRY="; }; - prePatch = '' - cd client/python - ''; + + sourceRoot = "${src.name}/client/python"; # upstream adds upper constraints because they can, not because the need to # https://github.com/gradio-app/gradio/pull/4885 @@ -71,20 +71,20 @@ buildPythonPackage rec { ]; nativeCheckInputs = [ - pytestCheckHook - pytest-asyncio - pydub - rich - tomlkit - safehttpx gradio.sans-reverse-dependencies + pydub + pytest-asyncio + pytestCheckHook + rich + safehttpx + tomlkit + writableTmpDirAsHomeHook ]; # 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 = '' - export HOME=$TMPDIR cat ${./conftest-skip-network-errors.py} >> test/conftest.py ''; diff --git a/pkgs/development/python-modules/gradio/default.nix b/pkgs/development/python-modules/gradio/default.nix index cdc4ccbece6f..0184f539e946 100644 --- a/pkgs/development/python-modules/gradio/default.nix +++ b/pkgs/development/python-modules/gradio/default.nix @@ -2,14 +2,11 @@ lib, stdenv, buildPythonPackage, - fetchPypi, fetchFromGitHub, - fetchpatch, - pythonOlder, writeShellScriptBin, gradio, - # pyproject + # build-system hatchling, hatch-requirements-txt, hatch-fancy-pypi-readme, @@ -19,7 +16,7 @@ nodejs, pnpm_9, - # runtime + # dependencies setuptools, aiofiles, anyio, @@ -27,6 +24,7 @@ fastapi, ffmpy, gradio-client, + groovy, httpx, huggingface-hub, importlib-resources, @@ -53,7 +51,7 @@ authlib, itsdangerous, - # check + # tests pytestCheckHook, hypothesis, altair, @@ -68,42 +66,32 @@ tqdm, transformers, vega-datasets, + writableTmpDirAsHomeHook, }: buildPythonPackage rec { pname = "gradio"; - version = "5.11.0"; + version = "5.20.0"; pyproject = true; - disabled = pythonOlder "3.7"; - - # unfortunately no fetchPypi due to https://github.com/gradio-app/gradio/pull/9778 src = fetchFromGitHub { owner = "gradio-app"; repo = "gradio"; tag = "gradio@${version}"; - hash = "sha256-HW0J7oSkCo4DIHpU4LUoBZ2jmmrv5Xd64floA4uyo5A="; + hash = "sha256-gAAyhsnc1LUcAvlUC5hftsWN1kSiRWqcQ4iKGpSIL+U="; }; pnpmDeps = pnpm_9.fetchDeps { inherit pname version src; - hash = "sha256-9fAkP2zV3OfyROdtvmS94ujpkGmlB0wGOaWS13LgJTM="; - }; - - # fix packaging.ParserSyntaxError, which can't handle comments - postPatch = '' - sed -i -e "s/ #.*$//g" requirements*.txt - ''; + hash = "sha256-y0Bdupn19gEtwatc6Q3KD7aekXDk0xrq04LaG7gxMFI="; + }; pythonRelaxDeps = [ - "tomlkit" "aiofiles" "markupsafe" - "pillow" ]; pythonRemoveDeps = [ - # our package is presented as a binary, not a python lib - and # this isn't a real runtime dependency "ruff" ]; @@ -128,6 +116,7 @@ buildPythonPackage rec { fastapi ffmpy gradio-client + groovy httpx huggingface-hub importlib-resources @@ -156,26 +145,30 @@ buildPythonPackage rec { itsdangerous ]; - nativeCheckInputs = [ - pytestCheckHook - hypothesis - altair - boto3 - gradio-pdf - ffmpeg - ipython - pytest-asyncio - respx - scikit-image - # shap is needed as well, but breaks too often - torch - tqdm - transformers - vega-datasets + nativeCheckInputs = + [ + pytestCheckHook + hypothesis + altair + boto3 + gradio-pdf + ffmpeg + ipython + pytest-asyncio + respx + scikit-image + # shap is needed as well, but breaks too often + torch + tqdm + transformers + vega-datasets - # mock calls to `shutil.which(...)` - (writeShellScriptBin "npm" "false") - ] ++ optional-dependencies.oauth ++ pydantic.optional-dependencies.email; + # mock calls to `shutil.which(...)` + (writeShellScriptBin "npm" "false") + writableTmpDirAsHomeHook + ] + ++ optional-dependencies.oauth + ++ pydantic.optional-dependencies.email; preBuild = '' pnpm build @@ -191,11 +184,10 @@ buildPythonPackage rec { # We additionally xfail FileNotFoundError, since the gradio devs often fail to upload test assets to pypi. preCheck = '' - export HOME=$TMPDIR cat ${./conftest-skip-network-errors.py} >> test/conftest.py '' + # OSError: [Errno 24] Too many open files + lib.optionalString stdenv.hostPlatform.isDarwin '' - # OSError: [Errno 24] Too many open files ulimit -n 4096 ''; @@ -250,6 +242,16 @@ buildPythonPackage rec { "test_get_executable_path" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType' + "test_component_example_values" + "test_component_functions" + "test_public_request_pass" + + # Failed: DID NOT RAISE + # test.conftest.NixNetworkAccessDeniedError + "test_private_request_fail" + "test_theme_builder_launches" + # flaky on darwin (depend on port availability) "test_all_status_messages" "test_async_generators" @@ -316,8 +318,7 @@ buildPythonPackage rec { ]; # check the binary works outside the build env - doInstallCheck = true; - postInstallCheck = '' + postCheck = '' env --ignore-environment $out/bin/gradio environment >/dev/null ''; diff --git a/pkgs/development/python-modules/groovy/default.nix b/pkgs/development/python-modules/groovy/default.nix new file mode 100644 index 000000000000..6a616a754e6e --- /dev/null +++ b/pkgs/development/python-modules/groovy/default.nix @@ -0,0 +1,41 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + hatchling, + gradio, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "groovy"; + version = "0.1.2"; + pyproject = true; + + src = fetchPypi { + inherit pname version; + hash = "sha256-JcHcCbP51+KSRYqnYsa+uW6gNwcb9ekX/IH7eNIjEIM="; + }; + + build-system = [ + hatchling + ]; + + pythonImportsCheck = [ "groovy" ]; + + nativeCheckInputs = [ + gradio + pytestCheckHook + ]; + + # Attempts to load a cert file + # FileNotFoundError: [Errno 2] No such file or directory + doCheck = false; + + meta = { + description = "Small Python library created to help developers protect their applications from Server Side Request Forgery (SSRF) attacks"; + homepage = "https://pypi.org/project/groovy"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ccc3fb12e80c..b427816903d0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5724,6 +5724,8 @@ self: super: with self; { groestlcoin-hash = callPackage ../development/python-modules/groestlcoin-hash { }; + groovy = callPackage ../development/python-modules/groovy { }; + grpc-google-iam-v1 = callPackage ../development/python-modules/grpc-google-iam-v1 { }; grpc-interceptor = callPackage ../development/python-modules/grpc-interceptor { };