22 lib ,
33 stdenv ,
44 buildPythonPackage ,
5- fetchPypi ,
65 fetchFromGitHub ,
7- fetchpatch ,
8- pythonOlder ,
96 writeShellScriptBin ,
107 gradio ,
118
12- # pyproject
9+ # build-system
1310 hatchling ,
1411 hatch-requirements-txt ,
1512 hatch-fancy-pypi-readme ,
1916 nodejs ,
2017 pnpm_9 ,
2118
22- # runtime
19+ # dependencies
2320 setuptools ,
2421 aiofiles ,
2522 anyio ,
2623 diffusers ,
2724 fastapi ,
2825 ffmpy ,
2926 gradio-client ,
27+ groovy ,
3028 httpx ,
3129 huggingface-hub ,
3230 importlib-resources ,
5351 authlib ,
5452 itsdangerous ,
5553
56- # check
54+ # tests
5755 pytestCheckHook ,
5856 hypothesis ,
5957 altair ,
6866 tqdm ,
6967 transformers ,
7068 vega-datasets ,
69+ writableTmpDirAsHomeHook ,
7170} :
7271
7372buildPythonPackage rec {
7473 pname = "gradio" ;
75- version = "5.11 .0" ;
74+ version = "5.20 .0" ;
7675 pyproject = true ;
7776
78- disabled = pythonOlder "3.7" ;
79-
80- # unfortunately no fetchPypi due to https://github.com/gradio-app/gradio/pull/9778
8177 src = fetchFromGitHub {
8278 owner = "gradio-app" ;
8379 repo = "gradio" ;
8480 tag = "gradio@${ version } " ;
85- hash = "sha256-HW0J7oSkCo4DIHpU4LUoBZ2jmmrv5Xd64floA4uyo5A =" ;
81+ hash = "sha256-gAAyhsnc1LUcAvlUC5hftsWN1kSiRWqcQ4iKGpSIL+U =" ;
8682 } ;
8783
8884 pnpmDeps = pnpm_9 . fetchDeps {
8985 inherit pname version src ;
90- hash = "sha256-9fAkP2zV3OfyROdtvmS94ujpkGmlB0wGOaWS13LgJTM=" ;
91- } ;
92-
93- # fix packaging.ParserSyntaxError, which can't handle comments
94- postPatch = ''
95- sed -i -e "s/ #.*$//g" requirements*.txt
96- '' ;
86+ hash = "sha256-y0Bdupn19gEtwatc6Q3KD7aekXDk0xrq04LaG7gxMFI=" ;
87+ } ;
9788
9889 pythonRelaxDeps = [
99- "tomlkit"
10090 "aiofiles"
10191 "markupsafe"
102- "pillow"
10392 ] ;
10493
10594 pythonRemoveDeps = [
106- # our package is presented as a binary, not a python lib - and
10795 # this isn't a real runtime dependency
10896 "ruff"
10997 ] ;
@@ -128,6 +116,7 @@ buildPythonPackage rec {
128116 fastapi
129117 ffmpy
130118 gradio-client
119+ groovy
131120 httpx
132121 huggingface-hub
133122 importlib-resources
@@ -156,26 +145,30 @@ buildPythonPackage rec {
156145 itsdangerous
157146 ] ;
158147
159- nativeCheckInputs = [
160- pytestCheckHook
161- hypothesis
162- altair
163- boto3
164- gradio-pdf
165- ffmpeg
166- ipython
167- pytest-asyncio
168- respx
169- scikit-image
170- # shap is needed as well, but breaks too often
171- torch
172- tqdm
173- transformers
174- vega-datasets
175-
176- # mock calls to `shutil.which(...)`
177- ( writeShellScriptBin "npm" "false" )
178- ] ++ optional-dependencies . oauth ++ pydantic . optional-dependencies . email ;
148+ nativeCheckInputs =
149+ [
150+ pytestCheckHook
151+ hypothesis
152+ altair
153+ boto3
154+ gradio-pdf
155+ ffmpeg
156+ ipython
157+ pytest-asyncio
158+ respx
159+ scikit-image
160+ # shap is needed as well, but breaks too often
161+ torch
162+ tqdm
163+ transformers
164+ vega-datasets
165+
166+ # mock calls to `shutil.which(...)`
167+ ( writeShellScriptBin "npm" "false" )
168+ writableTmpDirAsHomeHook
169+ ]
170+ ++ optional-dependencies . oauth
171+ ++ pydantic . optional-dependencies . email ;
179172
180173 preBuild = ''
181174 pnpm build
@@ -191,11 +184,10 @@ buildPythonPackage rec {
191184 # We additionally xfail FileNotFoundError, since the gradio devs often fail to upload test assets to pypi.
192185 preCheck =
193186 ''
194- export HOME=$TMPDIR
195187 cat ${ ./conftest-skip-network-errors.py } >> test/conftest.py
196188 ''
189+ # OSError: [Errno 24] Too many open files
197190 + lib . optionalString stdenv . hostPlatform . isDarwin ''
198- # OSError: [Errno 24] Too many open files
199191 ulimit -n 4096
200192 '' ;
201193
@@ -326,8 +318,7 @@ buildPythonPackage rec {
326318 ] ;
327319
328320 # check the binary works outside the build env
329- doInstallCheck = true ;
330- postInstallCheck = ''
321+ postCheck = ''
331322 env --ignore-environment $out/bin/gradio environment >/dev/null
332323 '' ;
333324
0 commit comments