Unverified Commit 2ffed2bc authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python312Packages.gradio: 5.11.0 -> 5.20.0 (#382974)

parents 172dc331 78f5404e
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
{
  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 = [
+20 −20
Original line number Diff line number Diff line
@@ -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,

  # tests
  gradio,
  pydub,
  pytest-asyncio,
  pytestCheckHook,
  rich,
  tomlkit,
  gradio,
  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
    gradio.sans-reverse-dependencies
    pydub
    pytest-asyncio
    pytestCheckHook
    rich
    tomlkit
    safehttpx
    gradio.sans-reverse-dependencies
    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
  '';

+46 −45
Original line number Diff line number Diff line
@@ -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=";
    hash = "sha256-y0Bdupn19gEtwatc6Q3KD7aekXDk0xrq04LaG7gxMFI=";
  };

  # fix packaging.ParserSyntaxError, which can't handle comments
  postPatch = ''
    sed -i -e "s/ #.*$//g" requirements*.txt
  '';

  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,7 +145,8 @@ buildPythonPackage rec {
    itsdangerous
  ];

  nativeCheckInputs = [
  nativeCheckInputs =
    [
      pytestCheckHook
      hypothesis
      altair
@@ -175,7 +165,10 @@ buildPythonPackage rec {

      # mock calls to `shutil.which(...)`
      (writeShellScriptBin "npm" "false")
  ] ++ optional-dependencies.oauth ++ pydantic.optional-dependencies.email;
      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
    ''
    + lib.optionalString stdenv.hostPlatform.isDarwin ''
    # OSError: [Errno 24] Too many open files
    + lib.optionalString stdenv.hostPlatform.isDarwin ''
      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 <class 'ValueError'>
      # 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
  '';

+41 −0
Original line number Diff line number Diff line
{
  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 ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -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 { };