2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
nix-update-script,
|
|
|
|
pythonOlder,
|
|
|
|
pythonRelaxDepsHook,
|
|
|
|
# pyproject
|
|
|
|
hatchling,
|
|
|
|
hatch-requirements-txt,
|
|
|
|
hatch-fancy-pypi-readme,
|
|
|
|
# runtime
|
|
|
|
setuptools,
|
|
|
|
fsspec,
|
|
|
|
httpx,
|
|
|
|
huggingface-hub,
|
|
|
|
packaging,
|
|
|
|
requests,
|
|
|
|
typing-extensions,
|
|
|
|
websockets,
|
|
|
|
# checkInputs
|
|
|
|
pytestCheckHook,
|
|
|
|
pytest-asyncio,
|
|
|
|
pydub,
|
|
|
|
rich,
|
|
|
|
tomlkit,
|
|
|
|
gradio,
|
2023-10-09 19:29:22 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2024-01-13 08:15:51 +00:00
|
|
|
pname = "gradio-client";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "1.0.1";
|
2024-05-15 15:35:15 +00:00
|
|
|
pyproject = true;
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
|
|
|
# no tests on pypi
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gradio-app";
|
|
|
|
repo = "gradio";
|
2024-06-20 14:57:18 +00:00
|
|
|
# not to be confused with @gradio/client@${version}
|
|
|
|
rev = "refs/tags/gradio_client@${version}";
|
2023-10-09 19:29:22 +00:00
|
|
|
sparseCheckout = [ "client/python" ];
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-nbOWg2ZPcXTft7e4tR5p5xecVU62en0hEdXqAgLDZF4=";
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
|
|
|
prePatch = ''
|
|
|
|
cd client/python
|
|
|
|
'';
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
# 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"
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
build-system = [
|
2023-10-09 19:29:22 +00:00
|
|
|
hatchling
|
|
|
|
hatch-requirements-txt
|
|
|
|
hatch-fancy-pypi-readme
|
2024-01-13 08:15:51 +00:00
|
|
|
pythonRelaxDepsHook
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
2023-10-09 19:29:22 +00:00
|
|
|
setuptools # needed for 'pkg_resources'
|
|
|
|
fsspec
|
|
|
|
httpx
|
|
|
|
huggingface-hub
|
|
|
|
packaging
|
|
|
|
typing-extensions
|
|
|
|
websockets
|
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeCheckInputs = [
|
2023-10-09 19:29:22 +00:00
|
|
|
pytestCheckHook
|
|
|
|
pytest-asyncio
|
|
|
|
pydub
|
2024-01-13 08:15:51 +00:00
|
|
|
rich
|
|
|
|
tomlkit
|
|
|
|
gradio.sans-reverse-dependencies
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
2024-01-13 08:15:51 +00:00
|
|
|
# ensuring we don't propagate this intermediate build
|
|
|
|
disallowedReferences = [ gradio.sans-reverse-dependencies ];
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
"test/"
|
2024-01-13 08:15:51 +00:00
|
|
|
"-m 'not flaky'"
|
2023-10-09 19:29:22 +00:00
|
|
|
#"-x" "-W" "ignore" # uncomment for debugging help
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "gradio_client" ];
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.updateScript = nix-update-script {
|
2024-06-20 14:57:18 +00:00
|
|
|
extraArgs = [ "--version-regex" "gradio_client@(.*)" ];
|
2024-06-05 15:53:02 +00:00
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.gradio.app/";
|
|
|
|
description = "Lightweight library to use any Gradio app as an API";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ pbsds ];
|
|
|
|
};
|
|
|
|
}
|