Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python-updates] python3Packages.gradio-client: 0.5.0 -> 0.7.3 #274322

Merged
merged 13 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pkgs/development/libraries/google-cloud-cpp/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, c-ares
, cmake
, crc32c
Expand All @@ -18,6 +19,7 @@
, staticOnly ? stdenv.hostPlatform.isStatic
}:
let
# defined in cmake/GoogleapisConfig.cmake
googleapisRev = "85f8c758016c279fb7fa8f0d51ddc7ccc0dd5e05";
googleapis = fetchFromGitHub {
name = "googleapis-src";
Expand All @@ -39,6 +41,15 @@ stdenv.mkDerivation rec {
sha256 = "sha256-0SoOaAqvk8cVC5W3ejTfe4O/guhrro3uAzkeIpAkCpg=";
};

patches = [
# https://github.com/googleapis/google-cloud-cpp/pull/12554, tagged in 2.16.0
(fetchpatch {
name = "prepare-for-GCC-13.patch";
url = "https://github.com/googleapis/google-cloud-cpp/commit/ae30135c86982c36e82bb0f45f99baa48c6a780b.patch";
hash = "sha256-L0qZfdhP8Zt/gYBWvJafteVgBHR8Kup49RoOrLDtj3k=";
})
];

postPatch = ''
substituteInPlace external/googleapis/CMakeLists.txt \
--replace "https://github.com/googleapis/googleapis/archive/\''${_GOOGLE_CLOUD_CPP_GOOGLEAPIS_COMMIT_SHA}.tar.gz" "file://${googleapis}"
Expand Down Expand Up @@ -69,7 +80,7 @@ stdenv.mkDerivation rec {
];

# https://hydra.nixos.org/build/222679737/nixlog/3/tail
NIX_CFLAGS_COMPILE = if stdenv.isAarch64 then "-Wno-error=maybe-uninitialized" else null;
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isAarch64 "-Wno-error=maybe-uninitialized";

doInstallCheck = true;

Expand Down
11 changes: 10 additions & 1 deletion pkgs/development/libraries/intel-media-sdk/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, gtest, libdrm, libpciaccess, libva, libX11
, libXau, libXdmcp, libpthreadstubs }:
, libXau, libXdmcp, libpthreadstubs, fetchpatch }:

stdenv.mkDerivation rec {
pname = "intel-media-sdk";
Expand All @@ -12,6 +12,15 @@ stdenv.mkDerivation rec {
hash = "sha256-wno3a/ZSKvgHvZiiJ0Gq9GlrEbfHCizkrSiHD6k/Loo=";
};

patches = [
# https://github.com/Intel-Media-SDK/MediaSDK/pull/3005
(fetchpatch {
name = "include-cstdint-explicitly.patch";
url = "https://github.com/Intel-Media-SDK/MediaSDK/commit/a4f37707c1bfdd5612d3de4623ffb2d21e8c1356.patch";
hash = "sha256-OPwGzcMTctJvHcKn5bHqV8Ivj4P7+E4K9WOKgECqf04=";
})
];

nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [
libdrm libva libpciaccess libX11 libXau libXdmcp libpthreadstubs
Expand Down
6 changes: 6 additions & 0 deletions pkgs/development/python-modules/datasets/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ buildPythonPackage rec {
hash = "sha256-Q8cSgupfj6xKD0bYgL6bvYBwdYDdNaiWEWWUrRvwc4g=";
};

# remove pyarrow<14.0.1 vulnerability fix
postPatch = ''
substituteInPlace src/datasets/features/features.py \
--replace "import pyarrow_hotfix" "#import pyarrow_hotfix"
'';

propagatedBuildInputs = [
aiohttp
dill
Expand Down
50 changes: 50 additions & 0 deletions pkgs/development/python-modules/gradio-pdf/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
48 changes: 21 additions & 27 deletions pkgs/development/python-modules/gradio/client.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,14 @@
, pytestCheckHook
, pytest-asyncio
, pydub
, rich
, tomlkit
, 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: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ pythonRelaxDepsHook ];
pythonRemoveDeps = (old.pythonRemoveDeps or []) ++ [ "gradio_client" ];
doInstallCheck = false;
doCheck = false;
pythonImportsCheck = null;
});

in

buildPythonPackage rec {
pname = "gradio_client";
version = "0.5.0";
pname = "gradio-client";
version = "0.7.3";
format = "pyproject";

disabled = pythonOlder "3.8";
Expand All @@ -51,18 +37,26 @@ buildPythonPackage rec {
owner = "gradio-app";
repo = "gradio";
#rev = "refs/tags/v${gradio.version}";
rev = "ba4c6d9e65138c97062d1757d2a588c4fc449daa"; # v3.43.1 is not tagged...
rev = "dc131b64f05062447643217819ca630e483a11df"; # v4.9.1 is not tagged...
sparseCheckout = [ "client/python" ];
hash = "sha256-savka4opyZKSWPeBqc2LZqvwVXLYIZz5dS1OWJSwvHo=";
hash = "sha256-Zp1Zl53Va0pyyZEHDUpnldi4dtH2uss7PZQD+Le8+cA=";
};
prePatch = ''
cd client/python
'';

# upstream adds upper constraints because they can, not because the need to
# https://github.com/gradio-app/gradio/pull/4885
pythonRelaxDeps = [
# only backward incompat is dropping py3.7 support
"websockets"
];

nativeBuildInputs = [
hatchling
hatch-requirements-txt
hatch-fancy-pypi-readme
pythonRelaxDepsHook
];

propagatedBuildInputs = [
Expand All @@ -71,20 +65,20 @@ buildPythonPackage rec {
httpx
huggingface-hub
packaging
requests
typing-extensions
websockets
];

nativeCheckInputs =[
nativeCheckInputs = [
pytestCheckHook
pytest-asyncio
pydub
gradio'
];
disallowedReferences = [
gradio' # ensuring we don't propagate this intermediate build
rich
tomlkit
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 = ''
Expand All @@ -94,7 +88,7 @@ buildPythonPackage rec {

pytestFlagsArray = [
"test/"
#"-m" "not flaky" # doesn't work, even when advertised
"-m 'not flaky'"
#"-x" "-W" "ignore" # uncomment for debugging help
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def iterate_exc_chain(exc: Exception):
for exc in iterate_exc_chain(call.excinfo.value):
if isinstance(exc, NixNetworkAccessDeniedError):
tr.outcome, tr.wasxfail = 'skipped', "reason: Requires network access."
if isinstance(exc, httpx.ConnectError):
tr.outcome, tr.wasxfail = 'skipped', "reason: Requires network access."
if isinstance(exc, FileNotFoundError): # gradio specific
tr.outcome, tr.wasxfail = 'skipped', "reason: Pypi dist bad."
return tr
Expand Down
55 changes: 44 additions & 11 deletions pkgs/development/python-modules/gradio/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
, fetchPypi
, pythonOlder
, pythonRelaxDepsHook
, writeShellScriptBin
, gradio

# pyproject
, hatchling
Expand Down Expand Up @@ -31,15 +33,16 @@
, python-multipart
, pydub
, pyyaml
, requests
, semantic-version
, typing-extensions
, uvicorn
, websockets
, typer
, tomlkit

# check
, pytestCheckHook
, boto3
, gradio-pdf
, ffmpeg
, ipython
, pytest-asyncio
Expand All @@ -53,23 +56,30 @@

buildPythonPackage rec {
pname = "gradio";
version = "4.7.1";
version = "4.9.1";
format = "pyproject";

disabled = pythonOlder "3.7";

# We use the Pypi release, as it provides prebuilt webui assets,
# and has more frequent releases compared to github tags
# We use the Pypi release, since it provides prebuilt webui assets,
# and upstream has stopped tagging releases since 3.41.0
src = fetchPypi {
inherit pname version;
hash = "sha256-6uEFj/3Urc/CWWmoAJA6y/9LWLUOcpPed9FnVg8G41Y=";
hash = "sha256-KosxlmU5pYvuy5zysscuWM25IGXin7RLGEM9V2xPQrU=";
};

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

# they bundle deps?
rm -rf venv/
'';

pythonRelaxDeps = [
"tomlkit"
];

nativeBuildInputs = [
pythonRelaxDepsHook
hatchling
Expand Down Expand Up @@ -99,16 +109,17 @@ buildPythonPackage rec {
python-multipart
pydub
pyyaml
requests
semantic-version
typing-extensions
uvicorn
websockets
];
typer
tomlkit
] ++ typer.passthru.optional-dependencies.all;

nativeCheckInputs = [
pytestCheckHook
boto3
gradio-pdf
ffmpeg
ipython
pytest-asyncio
Expand All @@ -119,7 +130,10 @@ buildPythonPackage rec {
tqdm
transformers
vega-datasets
];

# mock npm to make `shutil.which("npm")` pass
(writeShellScriptBin "npm" "false")
] ++ pydantic.passthru.optional-dependencies.email;

# Add a pytest hook skipping tests that access network, marking them as "Expected fail" (xfail).
# We additionally xfail FileNotFoundError, since the gradio devs often fail to upload test assets to pypi.
Expand Down Expand Up @@ -148,12 +162,14 @@ buildPythonPackage rec {
"test_shapley_text"
];
disabledTestPaths = [
# 100% touches network
"test/test_networking.py"
# makes pytest freeze 50% of the time
"test/test_interfaces.py"
];
pytestFlagsArray = [
"-x" # abort on first failure
#"-m" "not flaky" # doesn't work, even when advertised
"-m 'not flaky'"
#"-W" "ignore" # uncomment for debugging help
];

Expand All @@ -165,6 +181,23 @@ 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;
gradio-pdf = 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";
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/python-modules/numcodecs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ buildPythonPackage rec {

nativeCheckInputs = [
pytestCheckHook
msgpack
];

pytestFlagsArray = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/development/python-modules/psygnal/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, toolz
, typing-extensions
, wrapt
, attrs
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -43,6 +44,7 @@ buildPythonPackage rec {
pytestCheckHook
toolz
wrapt
attrs
];

pythonImportsCheck = [
Expand Down
Loading