From 60078df07f38c0ef90ef2ba90f8e3272b92c9e3d Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Tue, 30 Jan 2024 13:30:27 -0800 Subject: [PATCH] Fix test requirements to be compatible with python 3.11 (#7225) * stash pop * lint fix * add changeset * changes * add changeset * exclude * fix * tokenizers, transformers fix * changes --------- Co-authored-by: gradio-pr-bot --- .changeset/strong-bugs-stick.md | 5 +++++ gradio/themes/base.py | 6 +++--- pyproject.toml | 3 ++- test/requirements.in | 3 +-- test/requirements.txt | 33 +++++++-------------------------- 5 files changed, 18 insertions(+), 32 deletions(-) create mode 100644 .changeset/strong-bugs-stick.md diff --git a/.changeset/strong-bugs-stick.md b/.changeset/strong-bugs-stick.md new file mode 100644 index 0000000000..aea8745f89 --- /dev/null +++ b/.changeset/strong-bugs-stick.md @@ -0,0 +1,5 @@ +--- +"gradio": patch +--- + +feat:Fix test requirements to be compatible with python 3.11 diff --git a/gradio/themes/base.py b/gradio/themes/base.py index 405f34be02..3b0a1a1ada 100644 --- a/gradio/themes/base.py +++ b/gradio/themes/base.py @@ -4,9 +4,9 @@ import json import re import tempfile import textwrap +import warnings from pathlib import Path from typing import Iterable -import warnings import huggingface_hub import semantic_version as semver @@ -95,8 +95,8 @@ class ThemeClass: return f"{css_code}\n{dark_css_code}" def _get_computed_value(self, property: str, depth=0) -> str: - MAX_DEPTH = 100 - if depth > MAX_DEPTH: + max_depth = 100 + if depth > max_depth: warnings.warn(f"Cannot resolve '{property}' - circular reference detected.") return "" is_dark = property.endswith("_dark") diff --git a/pyproject.toml b/pyproject.toml index de2c336ac7..0090772ab5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,7 +100,8 @@ exclude = [ "gradio/_frontend_code/", "gradio/components/*_plot.py", "gradio/ipython_ext.py", - "gradio/node" + "gradio/node/*.py", + "gradio/_frontend_code/*.py" ] [tool.ruff] diff --git a/test/requirements.in b/test/requirements.in index e3e683d548..eae77f5f49 100644 --- a/test/requirements.in +++ b/test/requirements.in @@ -9,14 +9,13 @@ gradio_pdf==0.0.3 httpx huggingface_hub polars==0.20.5 -pydantic +pydantic[email] pytest pytest-asyncio pytest-cov ruff>=0.1.7 respx scikit-image -shap torch tqdm transformers diff --git a/test/requirements.txt b/test/requirements.txt index 886c17a49c..15a93a7130 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -32,8 +32,6 @@ certifi==2022.6.15 # requests charset-normalizer==2.1.0 # via requests -cloudpickle==2.1.0 - # via shap decorator==5.1.1 # via ipython entrypoints==0.4 @@ -79,27 +77,21 @@ joblib==1.1.0 # via scikit-learn jsonschema==4.7.2 # via altair -llvmlite==0.38.1 - # via numba markupsafe==2.1.1 # via jinja2 matplotlib-inline==0.1.3 # via ipython networkx==2.6.3 # via scikit-image -numba==0.55.2 - # via shap -numpy==1.21.6 +numpy==1.24.4 # via # altair # imageio - # numba # pandas # pywavelets # scikit-image # scikit-learn # scipy - # shap # tifffile # transformers packaging==22.0 @@ -107,12 +99,10 @@ packaging==22.0 # huggingface-hub # pytest # scikit-image - # shap # transformers pandas==1.5.3 # via # altair - # shap # vega-datasets parso==0.8.3 # via jedi @@ -134,6 +124,8 @@ polars==0.20.5 # via -r requirements.in py==1.11.0 # via pytest +pydantic[email] + # via requirements.in pyparsing==3.0.9 # via packaging pyrsistent==0.18.1 @@ -177,19 +169,12 @@ s3transfer==0.6.0 # via boto3 scikit-image==0.19.3 # via -r requirements.in -scikit-learn==1.0.2 - # via shap -scipy==1.7.3 +scipy==1.10.0 # via # scikit-image # scikit-learn - # shap -shap==0.41.0 - # via -r requirements.in six==1.16.0 # via python-dateutil -slicer==0.0.7 - # via shap sniffio==1.2.0 # via # anyio @@ -201,26 +186,25 @@ threadpoolctl==3.1.0 # via scikit-learn tifffile==2021.11.2 # via scikit-image -tokenizers==0.12.1 +tokenizers==0.15.1 # via transformers tomli==2.0.1 # via # pytest toolz==0.12.0 # via altair -torch==1.12.0 +torch==2.1.2 # via -r requirements.in tqdm==4.64.0 # via # -r requirements.in # huggingface-hub - # shap # transformers traitlets==5.3.0 # via # ipython # matplotlib-inline -transformers==4.20.1 +transformers==4.37.2 # via -r requirements.in urllib3==1.26.10 # via @@ -230,6 +214,3 @@ vega-datasets==0.9.0 # via -r requirements.in wcwidth==0.2.5 # via prompt-toolkit -pydantic[email] -# The following packages are considered to be unsafe in a requirements file: -# setuptools