From 59f873d2d790e36fcde824a0ed46cdf2f2d31273 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Thu, 16 Mar 2023 17:05:59 -0400 Subject: [PATCH 1/6] Update test requirements and script --- scripts/create_test_requirements.sh | 3 +- test/requirements.txt | 301 ++++++++++++++++------------ 2 files changed, 173 insertions(+), 131 deletions(-) diff --git a/scripts/create_test_requirements.sh b/scripts/create_test_requirements.sh index 60b0ec7535593..ca5a2526d2a19 100644 --- a/scripts/create_test_requirements.sh +++ b/scripts/create_test_requirements.sh @@ -6,7 +6,8 @@ source scripts/helpers.sh pip_required echo "Creating test requirements... -It's recommended to run this script from a Unix-like system in Python 3.7 (or higher) environment." +It's recommended to run this script in a Python 3.7 (or higher) environment." cd test pip install --upgrade pip-tools +rm requirements.txt pip-compile --output-file requirements.txt diff --git a/test/requirements.txt b/test/requirements.txt index 83b362c49aa43..d02144406f8ae 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -1,43 +1,44 @@ # -# This file is autogenerated by pip-compile with Python 3.9 +# This file is autogenerated by pip-compile with Python 3.10 # by the following command: # # pip-compile --output-file=requirements.txt # -alembic==1.8.1 +alembic==1.10.2 # via mlflow -altair==4.2.0 +altair==4.2.2 # via -r requirements.in -anyio==3.6.1 +anyio==3.6.2 # via # httpcore # starlette -appnope==0.1.3 - # via ipython +appdirs==1.4.4 + # via wandb +asttokens==2.2.1 + # via stack-data asyncio==3.4.3 # via -r requirements.in -attrs==21.4.0 +attrs==22.2.0 # via # jsonschema # pytest backcall==0.2.0 # via ipython -black==22.6.0 +black==23.1.0 # via -r requirements.in -boto3==1.26.65 +boto3==1.26.93 # via -r requirements.in -botocore==1.29.87 +botocore==1.29.93 # via # boto3 # s3transfer -certifi==2022.6.15 +certifi==2022.12.7 # via - # dulwich # httpcore # httpx # requests # sentry-sdk -charset-normalizer==2.1.0 +charset-normalizer==3.1.0 # via requests click==8.1.3 # via @@ -46,128 +47,159 @@ click==8.1.3 # flask # mlflow # wandb -cloudpickle==2.1.0 +cloudpickle==2.2.1 # via # mlflow # shap -comet-ml==3.31.6 +colorama==0.4.6 + # via + # click + # ipython + # pytest + # tqdm +comet-ml==3.32.4 # via -r requirements.in -configobj==5.0.6 +configobj==5.0.8 # via everett -coverage[toml]==6.4.2 +contourpy==1.0.7 + # via matplotlib +coverage[toml]==7.2.2 # via # -r requirements.in # pytest-cov -databricks-cli==0.17.0 +cycler==0.11.0 + # via matplotlib +databricks-cli==0.17.5 # via mlflow decorator==5.1.1 # via ipython -docker==5.0.3 +docker==6.0.1 # via mlflow docker-pycreds==0.4.0 # via wandb -dulwich==0.20.45 +dulwich==0.21.3 # via comet-ml entrypoints==0.4 # via # altair # mlflow -everett[ini]==3.0.0 +everett[ini]==3.1.0 # via comet-ml -fastapi==0.87.0 +exceptiongroup==1.1.1 + # via pytest +executing==1.2.0 + # via stack-data +fastapi==0.94.1 # via -r requirements.in -filelock==3.7.1 +filelock==3.10.0 # via # huggingface-hub + # torch # transformers -flake8==4.0.1 +flake8==6.0.0 # via -r requirements.in -flask==2.1.3 - # via - # mlflow - # prometheus-flask-exporter -gitdb==4.0.9 +flask==2.2.3 + # via mlflow +fonttools==4.39.2 + # via matplotlib +gitdb==4.0.10 # via gitpython -gitpython==3.1.27 +gitpython==3.1.31 # via # mlflow # wandb -gunicorn==20.1.0 - # via mlflow -h11==0.12.0 +greenlet==2.0.2 + # via sqlalchemy +h11==0.14.0 # via httpcore -httpcore==0.15.0 +httpcore==0.16.3 # via httpx -httpx==0.23.0 +httpx==0.23.3 # via # -r requirements.in # respx -huggingface-hub==0.13.0 +huggingface-hub==0.13.2 # via # -r requirements.in # transformers -idna==3.3 +idna==3.4 # via # anyio # requests # rfc3986 -imageio==2.19.5 +imageio==2.26.0 # via scikit-image -importlib-metadata==4.2.0 - # via - # flask - # mlflow -iniconfig==1.1.1 +importlib-metadata==6.0.0 + # via mlflow +iniconfig==2.0.0 # via pytest -ipython==7.34.0 +ipython==8.11.0 # via -r requirements.in -isort==5.10.1 +isort==5.12.0 # via -r requirements.in itsdangerous==2.1.2 # via flask -jedi==0.18.1 +jedi==0.18.2 # via ipython jinja2==3.1.2 # via # altair # flask + # mlflow + # torch jmespath==1.0.1 # via # boto3 # botocore -joblib==1.1.0 +joblib==1.2.0 # via scikit-learn -jsonschema==4.7.2 +jsonschema==4.17.3 # via # altair # comet-ml -llvmlite==0.38.1 +kiwisolver==1.4.4 + # via matplotlib +lazy-loader==0.1 + # via scikit-image +llvmlite==0.39.1 # via numba -mako==1.2.1 +mako==1.2.4 # via alembic -markupsafe==2.1.1 +markdown==3.4.1 + # via mlflow +markupsafe==2.1.2 # via # jinja2 # mako -matplotlib-inline==0.1.3 + # werkzeug +matplotlib==3.7.1 + # via mlflow +matplotlib-inline==0.1.6 # via ipython -mccabe==0.6.1 +mccabe==0.7.0 # via flake8 -mlflow==1.27.0 +mlflow==2.2.2 # via -r requirements.in -mypy-extensions==0.4.3 +mpmath==1.3.0 + # via sympy +mypy-extensions==1.0.0 # via black -networkx==2.6.3 - # via scikit-image -numba==0.55.2 +networkx==3.0 + # via + # scikit-image + # torch +numba==0.56.4 # via shap -numpy==1.21.6 +numpy==1.23.5 # via # altair + # contourpy # imageio + # matplotlib # mlflow # numba # pandas + # pyarrow # pywavelets # scikit-image # scikit-learn @@ -175,19 +207,20 @@ numpy==1.21.6 # shap # tifffile # transformers -nvidia-ml-py3==7.352.0 - # via comet-ml -oauthlib==3.2.0 +oauthlib==3.2.2 # via databricks-cli -packaging==21.3 +packaging==23.0 # via + # black + # docker # huggingface-hub + # matplotlib # mlflow # pytest # scikit-image # shap # transformers -pandas==1.3.5 +pandas==1.5.3 # via # altair # mlflow @@ -195,75 +228,73 @@ pandas==1.3.5 # vega-datasets parso==0.8.3 # via jedi -pathspec==0.9.0 +pathspec==0.11.1 # via black pathtools==0.1.2 # via wandb -pexpect==4.8.0 - # via ipython pickleshare==0.7.5 # via ipython -pillow==9.2.0 +pillow==9.4.0 # via # imageio + # matplotlib # scikit-image -platformdirs==2.5.2 +platformdirs==3.1.1 # via black pluggy==1.0.0 # via pytest -prometheus-client==0.14.1 - # via prometheus-flask-exporter -prometheus-flask-exporter==0.20.2 - # via mlflow -promise==2.3 - # via wandb -prompt-toolkit==3.0.30 +prompt-toolkit==3.0.38 # via ipython -protobuf==3.20.1 +protobuf==4.22.1 # via # mlflow # wandb -psutil==5.9.1 +psutil==5.9.4 # via wandb -ptyprocess==0.7.0 - # via pexpect -py==1.11.0 - # via pytest -pycodestyle==2.8.0 +pure-eval==0.2.2 + # via stack-data +pyarrow==11.0.0 + # via mlflow +pycodestyle==2.10.0 # via flake8 -pydantic==1.9.1 +pydantic==1.10.6 # via # -r requirements.in # fastapi -pyflakes==2.4.0 +pyflakes==3.0.1 # via flake8 -pygments==2.12.0 +pygments==2.14.0 # via ipython -pyjwt==2.4.0 +pyjwt==2.6.0 # via databricks-cli pyparsing==3.0.9 - # via packaging -pyrsistent==0.18.1 + # via matplotlib +pyrsistent==0.19.3 # via jsonschema -pytest==7.1.2 +pytest==7.2.2 # via # -r requirements.in # pytest-asyncio # pytest-cov -pytest-asyncio==0.19.0 +pytest-asyncio==0.20.3 # via -r requirements.in -pytest-cov==3.0.0 +pytest-cov==4.0.0 # via -r requirements.in +python-box==6.1.0 + # via comet-ml python-dateutil==2.8.2 # via # botocore + # matplotlib # pandas -pytz==2022.1 +pytz==2022.7.1 # via # mlflow # pandas -pywavelets==1.3.0 +pywavelets==1.4.1 # via scikit-image +pywin32==305 + # via docker pyyaml==6.0 # via # huggingface-hub @@ -272,9 +303,9 @@ pyyaml==6.0 # wandb querystring-parser==1.2.4 # via mlflow -regex==2022.7.9 +regex==2022.10.31 # via transformers -requests==2.28.1 +requests==2.28.2 # via # comet-ml # databricks-cli @@ -284,19 +315,21 @@ requests==2.28.1 # requests-toolbelt # transformers # wandb -requests-toolbelt==0.9.1 +requests-toolbelt==0.10.1 # via comet-ml -respx==0.19.2 +respx==0.20.1 # via -r requirements.in rfc3986[idna2008]==1.5.0 # via httpx s3transfer==0.6.0 # via boto3 -scikit-image==0.19.3 +scikit-image==0.20.0 # via -r requirements.in -scikit-learn==1.0.2 - # via shap -scipy==1.7.3 +scikit-learn==1.2.2 + # via + # mlflow + # shap +scipy==1.10.1 # via # mlflow # scikit-image @@ -304,50 +337,55 @@ scipy==1.7.3 # shap semantic-version==2.10.0 # via comet-ml -sentry-sdk==1.7.2 +sentry-sdk==1.17.0 # via # comet-ml # wandb -setproctitle==1.2.3 +setproctitle==1.3.2 # via wandb shap==0.41.0 - # via -r requirements.in -shortuuid==1.0.9 - # via wandb + # via + # -r requirements.in + # mlflow +simplejson==3.18.4 + # via comet-ml six==1.16.0 # via + # asttokens # comet-ml # configobj # databricks-cli # docker-pycreds - # promise # python-dateutil # querystring-parser - # wandb slicer==0.0.7 # via shap smmap==5.0.0 # via gitdb -sniffio==1.2.0 +sniffio==1.3.0 # via # anyio # httpcore # httpx -sqlalchemy==1.4.39 +sqlalchemy==2.0.6 # via # alembic # mlflow -sqlparse==0.4.2 +sqlparse==0.4.3 # via mlflow -starlette==0.21.0 +stack-data==0.6.2 + # via ipython +starlette==0.26.1 # via fastapi -tabulate==0.8.10 +sympy==1.11.1 + # via torch +tabulate==0.9.0 # via databricks-cli threadpoolctl==3.1.0 # via scikit-learn -tifffile==2021.11.2 +tifffile==2023.3.15 # via scikit-image -tokenizers==0.12.1 +tokenizers==0.13.2 # via transformers tomli==2.0.1 # via @@ -356,50 +394,53 @@ tomli==2.0.1 # pytest toolz==0.12.0 # via altair -torch==1.12.0 +torch==2.0.0 # via -r requirements.in -tqdm==4.64.0 +tqdm==4.65.0 # via # -r requirements.in # huggingface-hub # shap # transformers -traitlets==5.3.0 +traitlets==5.9.0 # via # ipython # matplotlib-inline -transformers==4.20.1 +transformers==4.27.1 # via -r requirements.in -typing-extensions==4.3.0 +typing-extensions==4.5.0 # via - # black + # alembic # huggingface-hub # pydantic - # starlette + # sqlalchemy # torch -urllib3==1.26.10 +urllib3==1.26.15 # via # botocore + # docker # dulwich # requests # sentry-sdk vega-datasets==0.9.0 # via -r requirements.in -wandb==0.12.21 +waitress==2.1.2 + # via mlflow +wandb==0.14.0 # via -r requirements.in -wcwidth==0.2.5 +wcwidth==0.2.6 # via prompt-toolkit websocket-client==1.3.3 # via # comet-ml # docker -werkzeug==2.1.2 +werkzeug==2.2.3 # via flask -wrapt==1.14.1 +wrapt==1.15.0 # via comet-ml -wurlitzer==3.0.2 +wurlitzer==3.0.3 # via comet-ml -zipp==3.8.1 +zipp==3.15.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: From 1c1e67a0f75df679a8907dd1002e5b4e51db4929 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Thu, 16 Mar 2023 17:12:23 -0400 Subject: [PATCH 2/6] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 830385e8c63f5..5a256da7280be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,6 +133,7 @@ By [@aliabid94](https://github.com/aliabid94) in [PR 3466](https://github.com/gr - Pinned `pyright==1.1.298` for stability by [@abidlabs](https://github.com/abidlabs) in [PR 3475](https://github.com/gradio-app/gradio/pull/3475) - Removed `IOComponent.add_interactive_to_config()` by [@space-nuko](https://github.com/space-nuko) in [PR 3476](https://github.com/gradio-app/gradio/pull/3476) - Removed `IOComponent.generate_sample()` by [@space-nuko](https://github.com/space-nuko) in [PR 3475](https://github.com/gradio-app/gradio/pull/3483) +- Updated test `requirements.txt`/script by [@space-nuko](https://github.com/space-nuko) in [PR 3487](https://github.com/gradio-app/gradio/pull/3487) ## Breaking Changes: From 8ee0af627387813255f9f39d75fae1f32b45f470 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Thu, 16 Mar 2023 23:14:43 -0400 Subject: [PATCH 3/6] Fix tests on Windows --- gradio/components.py | 1 + pytest.ini | 3 +++ test/test_routes.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 pytest.ini diff --git a/gradio/components.py b/gradio/components.py index 88d26704659b5..b36c0aa628e67 100644 --- a/gradio/components.py +++ b/gradio/components.py @@ -1790,6 +1790,7 @@ def _segment_by_slic(self, x): compactness=10, sigma=1, start_label=1, + channel_axis=None ) except TypeError: # For skimage 0.16 and older segments_slic = slic( diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000000000..22c84a15fd029 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +minversion = 3.7 +testpaths = test diff --git a/test/test_routes.py b/test/test_routes.py index 374a48fe3a902..62ed986134b5c 100644 --- a/test/test_routes.py +++ b/test/test_routes.py @@ -56,7 +56,7 @@ def test_get_config_route(self, test_client): def test_upload_route(self, test_client): response = test_client.post( - "/upload", files={"files": open("test/test_files/alphabet.txt", "r")} + "/upload", files={"files": open("test/test_files/alphabet.txt", "rb")} ) assert response.status_code == 200 file = response.json()[0] From 7acacdf65bd8f2f1f28c5ef73a9f173709fe4ed2 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Thu, 23 Mar 2023 14:18:11 -0400 Subject: [PATCH 4/6] Update test requirements for Windows --- test/requirements.txt | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/requirements.txt b/test/requirements.txt index d02144406f8ae..fd9b819c561ef 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -26,9 +26,9 @@ backcall==0.2.0 # via ipython black==23.1.0 # via -r requirements.in -boto3==1.26.93 +boto3==1.26.97 # via -r requirements.in -botocore==1.29.93 +botocore==1.29.97 # via # boto3 # s3transfer @@ -69,7 +69,7 @@ coverage[toml]==7.2.2 # pytest-cov cycler==0.11.0 # via matplotlib -databricks-cli==0.17.5 +databricks-cli==0.17.6 # via mlflow decorator==5.1.1 # via ipython @@ -83,15 +83,15 @@ entrypoints==0.4 # via # altair # mlflow -everett[ini]==3.1.0 +everett[ini]==3.2.0 # via comet-ml exceptiongroup==1.1.1 # via pytest executing==1.2.0 # via stack-data -fastapi==0.94.1 +fastapi==0.95.0 # via -r requirements.in -filelock==3.10.0 +filelock==3.10.2 # via # huggingface-hub # torch @@ -118,7 +118,7 @@ httpx==0.23.3 # via # -r requirements.in # respx -huggingface-hub==0.13.2 +huggingface-hub==0.13.3 # via # -r requirements.in # transformers @@ -127,9 +127,9 @@ idna==3.4 # anyio # requests # rfc3986 -imageio==2.26.0 +imageio==2.26.1 # via scikit-image -importlib-metadata==6.0.0 +importlib-metadata==6.1.0 # via mlflow iniconfig==2.0.0 # via pytest @@ -159,13 +159,13 @@ jsonschema==4.17.3 # comet-ml kiwisolver==1.4.4 # via matplotlib -lazy-loader==0.1 +lazy-loader==0.2 # via scikit-image llvmlite==0.39.1 # via numba mako==1.2.4 # via alembic -markdown==3.4.1 +markdown==3.4.3 # via mlflow markupsafe==2.1.2 # via @@ -257,7 +257,7 @@ pyarrow==11.0.0 # via mlflow pycodestyle==2.10.0 # via flake8 -pydantic==1.10.6 +pydantic==1.10.7 # via # -r requirements.in # fastapi @@ -276,7 +276,7 @@ pytest==7.2.2 # -r requirements.in # pytest-asyncio # pytest-cov -pytest-asyncio==0.20.3 +pytest-asyncio==0.21.0 # via -r requirements.in pytest-cov==4.0.0 # via -r requirements.in @@ -303,7 +303,7 @@ pyyaml==6.0 # wandb querystring-parser==1.2.4 # via mlflow -regex==2022.10.31 +regex==2023.3.23 # via transformers requests==2.28.2 # via @@ -367,7 +367,7 @@ sniffio==1.3.0 # anyio # httpcore # httpx -sqlalchemy==2.0.6 +sqlalchemy==2.0.7 # via # alembic # mlflow @@ -383,7 +383,7 @@ tabulate==0.9.0 # via databricks-cli threadpoolctl==3.1.0 # via scikit-learn -tifffile==2023.3.15 +tifffile==2023.3.21 # via scikit-image tokenizers==0.13.2 # via transformers @@ -406,7 +406,7 @@ traitlets==5.9.0 # via # ipython # matplotlib-inline -transformers==4.27.1 +transformers==4.27.2 # via -r requirements.in typing-extensions==4.5.0 # via From c9ff1afa1e6c3dbdd1a159e53a16b18c5abf08e6 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Thu, 23 Mar 2023 14:21:06 -0400 Subject: [PATCH 5/6] `minversion` wasn't what I thought it was (pytest version) --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 22c84a15fd029..113f67f215dcc 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,3 @@ [pytest] -minversion = 3.7 +minversion = 7.0 testpaths = test From d2a83234cb8f863af543e3ddf3eb1478caed2361 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Thu, 23 Mar 2023 14:43:55 -0400 Subject: [PATCH 6/6] `pywin` needs a `sys_platform` specifier Output from pip-tools is going to differ if it's run on a different operating system https://pip-tools.readthedocs.io/en/latest/#cross-environment-usage-of-requirements-in-requirements-txt-and-pip-compile --- test/requirements.in | 3 ++- test/requirements.txt | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/requirements.in b/test/requirements.in index a129c18c32e96..0b6224478c49f 100644 --- a/test/requirements.in +++ b/test/requirements.in @@ -23,4 +23,5 @@ respx fastapi>=0.87.0 altair vega_datasets -tqdm \ No newline at end of file +tqdm +pywin32==305; sys_platform == 'win32' diff --git a/test/requirements.txt b/test/requirements.txt index fd9b819c561ef..bf18128b1a54d 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -293,8 +293,10 @@ pytz==2022.7.1 # pandas pywavelets==1.4.1 # via scikit-image -pywin32==305 - # via docker +pywin32==305 ; sys_platform == "win32" + # via + # -r requirements.in + # docker pyyaml==6.0 # via # huggingface-hub