diff --git a/.circleci/config.yml b/.circleci/config.yml index b987698aae..50157d7beb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,12 +3,18 @@ version: 2.1 orbs: browser-tools: circleci/browser-tools@1.4.8 -commands: - test_core: +executors: + docker-container: parameters: - py: - default: "310" + python_version: + description: "python version" + default: "3.10" type: string + docker: + - image: cimg/python:<>-browsers + +commands: + test_core: steps: - checkout - browser-tools/install-chrome @@ -16,21 +22,29 @@ commands: - run: name: Install dependencies command: | - python -m venv venv - . venv/bin/activate - pip install -e . - pip install -r ./test_requirements/requirements_<>_core.txt + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv pip install . + uv pip install -r ./test_requirements/requirements_core.txt + - run: + name: List installed packages and python version + command: | + source .venv/bin/activate + uv pip list + python --version - run: name: Test core command: | - . venv/bin/activate + source .venv/bin/activate python -m pytest tests/test_core no_output_timeout: 20m test_optional: parameters: - py: - default: "310" + pandas_version: + type: string + numpy_version: type: string steps: - checkout @@ -43,21 +57,37 @@ commands: uv venv source .venv/bin/activate uv pip install . - uv pip install -r ./test_requirements/requirements_<>_optional.txt + uv pip install -r ./test_requirements/requirements_optional.txt cd js npm ci npm run build - - run: - name: Install plotly-geo - command: | - source .venv/bin/activate - uv pip install plotly-geo + + - when: + condition: + not: + equal: + - <> + - "" + steps: + - run: + name: Install pandas + command: | + source .venv/bin/activate + uv pip install pip + python -m pip install pandas==<> numpy==<> + - run: name: Test core command: | source .venv/bin/activate python -m pytest tests/test_core no_output_timeout: 20m + - run: + name: List installed packages and python version + command: | + source .venv/bin/activate + uv pip list + python --version - run: name: Test optional command: | @@ -86,42 +116,6 @@ commands: command: | source .venv/bin/activate python -m pytest -x test_init/test_lazy_imports.py - test_orca: - parameters: - py: - default: "310" - type: string - steps: - - checkout - - browser-tools/install-chrome - - browser-tools/install-chromedriver - - run: - name: Install dependencies - command: | - python -m venv venv - . venv/bin/activate - pip install -r ./test_requirements/requirements_<>_optional.txt - - run: - name: Install plotly-geo - command: | - . venv/bin/activate - pip install plotly-geo - - run: - name: Install orca - command: | - npm install electron@1.8.4 - npm install orca - sudo apt-get update - sudo apt-get install -y poppler-utils libxtst6 xvfb libgtk2.0-0 libgconf-2-4 libnss3 libasound2 rename - echo 'export PATH="/home/circleci/project/node_modules/.bin:$PATH"' >> $BASH_ENV - - run: - name: Test orca - command: | - . venv/bin/activate - pytest tests/test_orca - no_output_timeout: 20m - - store_artifacts: - path: tests/test_orca/images/linux/failed jobs: check-code-formatting: @@ -142,110 +136,35 @@ jobs: . venv/bin/activate black --check . --exclude venv - # Core - python_38_core: - docker: - - image: cimg/python:3.8-browsers - steps: - - test_core: - py: "38" - - python_39_core: - docker: - - image: cimg/python:3.9-browsers - steps: - - test_core: - py: "39" - - python_310_core: - docker: - - image: cimg/python:3.10-browsers - steps: - - test_core: - py: "310" - - python_311_core: - docker: - - image: cimg/python:3.11-browsers - steps: - - test_core: - py: "311" - - python_312_core: - docker: - - image: cimg/python:3.12-browsers - steps: - - test_core: - py: "312" - - # Optional - - python_38_optional: - docker: - - image: cimg/python:3.8-browsers - steps: - - test_optional: - py: "38" - - python_39_optional: - docker: - - image: cimg/python:3.9-browsers - steps: - - test_optional: - py: "39" - - python_310_optional: - docker: - - image: cimg/python:3.10-browsers - steps: - - test_optional: - py: "310" - - python_311_optional: - docker: - - image: cimg/python:3.11-browsers - steps: - - test_optional: - py: "311" - - python_312_optional: - docker: - - image: cimg/python:3.12-browsers - steps: - - test_optional: - py: "312" - - # Pandas - - python_39_pandas_2_optional: - docker: - - image: cimg/python:3.9-browsers - steps: - - test_optional: - py: "39_pandas_2" - - # No numpy - python_312_no_numpy: - docker: - - image: cimg/python:3.12-browsers + test_core_py: + parameters: + python_version: + default: "3.10" + type: string + executor: + name: docker-container + python_version: <> steps: - - run: - name: Check that numpy is not installed - command: | - if pip list | grep numpy > /dev/null 2>&1 - then exit 1 - else exit 0 - fi - - test_optional: - py: "312_no_numpy" + - test_core - python_312_np2: - docker: - - image: cimg/python:3.12-browsers + test_optional_py: + parameters: + python_version: + default: "3.10" + type: string + pandas_version: + default: "" + type: string + numpy_version: + default: "" + type: string + executor: + name: docker-container + python_version: <> steps: - test_optional: - py: "312_np2" - + pandas_version: <> + numpy_version: <> # Percy python_39_percy: @@ -267,28 +186,35 @@ jobs: - run: name: Install requirements command: | - python -m venv venv - . venv/bin/activate - pip install -e . - pip install plotly-geo - pip install -r test_requirements/requirements_39_pandas_2_optional.txt + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv pip install -e . + uv pip install -r test_requirements/requirements_optional.txt - run: name: Build html figures (Pandas 2) command: | - . venv/bin/activate + source .venv/bin/activate python tests/percy/plotly-express.py - run: name: Build html figures (Pandas 1) and compare command: | - . venv/bin/activate + source .venv/bin/activate mkdir tests/percy/pandas2 mv tests/percy/*.html tests/percy/pandas2/ # 1.1 is the earliest minor with Py3.9 wheels - pip install "pandas==1.1.5" + uv pip install pip + python -m pip install pandas==1.1.5 numpy==1.26.4 python tests/percy/plotly-express.py python tests/percy/compare-pandas.py rm -rf tests/percy/pandas2 + - run: + name: List installed packages and python version + command: | + source .venv/bin/activate + uv pip list + python --version - run: name: Run percy snapshots command: | @@ -308,36 +234,28 @@ jobs: - run: name: Install dependencies command: | - python -m venv venv - . venv/bin/activate - pip install -e . - pip install -r ./test_requirements/requirements_311_core.txt black inflect - pip install jupyterlab + curl -LsSf https://astral.sh/uv/install.sh | sh + uv venv + source .venv/bin/activate + uv pip install -e . + uv pip install -r ./test_requirements/requirements_core.txt black inflect jupyterlab - run: name: Update plotly.js to dev command: | - . venv/bin/activate + source .venv/bin/activate python commands.py updateplotlyjsdev - run: name: Test core command: | - . venv/bin/activate + source .venv/bin/activate locale pytest -k 'not nodev' tests/test_core no_output_timeout: 20m - - run: - name: Commit - command: | - git config --global user.email "you@example.com" - git config --global user.name "Your Name" - git add -A - git commit -m "Codegen" - when: always - run: name: Build source distribution packages command: | - . venv/bin/activate - pip install build + source .venv/bin/activate + uv pip install build python -m build --sdist --wheel -o dist when: always - store_artifacts: @@ -397,7 +315,7 @@ jobs: - browser-tools/install-chromedriver - run: - name: install dependencies + name: Install dependencies command: | cd doc curl -LsSf https://astral.sh/uv/install.sh | sh @@ -414,14 +332,6 @@ jobs: cd ../doc fi cd .. - - run: - name: Install orca - command: | - npm install electron@1.8.4 - npm install orca - sudo apt-get update - sudo apt-get install -y poppler-utils libxtst6 xvfb libgtk2.0-0 libgconf-2-4 libnss3 libasound2 rename - echo 'export PATH="/home/circleci/project/node_modules/.bin:$PATH"' >> $BASH_ENV - run: name: make html @@ -516,18 +426,28 @@ workflows: build: jobs: - - python_38_core - - python_39_core - - python_310_core - - python_311_core - - python_312_core - - python_38_optional - - python_39_optional - - python_310_optional - - python_311_optional - - python_312_optional - - python_39_pandas_2_optional + - test_core_py: + matrix: + parameters: + python_version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - test_optional_py: + matrix: + parameters: + python_version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - test_optional_py: + name: "test_optional_py-3.9_pandas-1.2.4" + python_version: "3.9" + pandas_version: "1.2.4" + numpy_version: "1.26.4" - python_39_percy - - python_312_no_numpy - - python_312_np2 - build-doc diff --git a/plotly/tools.py b/plotly/tools.py index cbfff43b9e..4a4a6e136d 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -61,9 +61,6 @@ def warning_on_one_line(message, category, filename, lineno, file=None, line=Non warnings.formatwarning = warning_on_one_line -ipython_core_display = optional_imports.get_module("IPython.core.display") -sage_salvus = optional_imports.get_module("sage_salvus") - ### mpl-related tools ### def mpl_to_plotly(fig, resize=False, strip_style=False, verbose=False): diff --git a/test_requirements/requirements_310_core.txt b/test_requirements/requirements_310_core.txt deleted file mode 100644 index a9e44d7480..0000000000 --- a/test_requirements/requirements_310_core.txt +++ /dev/null @@ -1,3 +0,0 @@ -requests==2.25.1 -pytest==7.4.4 -narwhals>=1.15.1 diff --git a/test_requirements/requirements_310_optional.txt b/test_requirements/requirements_310_optional.txt deleted file mode 100644 index f61fef5a5d..0000000000 --- a/test_requirements/requirements_310_optional.txt +++ /dev/null @@ -1,24 +0,0 @@ -requests==2.25.1 -pandas==1.5.3 -numpy==1.23.0 -xarray==0.17.0 -statsmodels==0.14.1 -Pillow==10.2.0 -pytest==7.4.4 -pytz==2023.3.post1 -ipython[all]==7.22.0 -ipykernel==5.5.3 -jupyter==1.0.0 -scipy==1.11.4 -Shapely==2.0.2 -geopandas==0.14.4 -pyshp==2.1.3 -matplotlib==3.8.0 -scikit-image==0.22.0 -psutil==5.7.0 -kaleido -orjson==3.8.12 -polars[timezone] -pyarrow -narwhals>=1.15.1 -anywidget==0.9.13 diff --git a/test_requirements/requirements_311_core.txt b/test_requirements/requirements_311_core.txt deleted file mode 100644 index 1800038868..0000000000 --- a/test_requirements/requirements_311_core.txt +++ /dev/null @@ -1,3 +0,0 @@ -requests==2.25.1 -pytest==7.4.4 -narwhals>=1.15.1 \ No newline at end of file diff --git a/test_requirements/requirements_311_optional.txt b/test_requirements/requirements_311_optional.txt deleted file mode 100644 index 505636afaa..0000000000 --- a/test_requirements/requirements_311_optional.txt +++ /dev/null @@ -1,25 +0,0 @@ -requests==2.25.1 -pandas==1.5.3 -numpy==1.23.2 -xarray==0.17.0 -statsmodels==0.14.1 -Pillow==10.2.0 -pytest==7.4.4 -pytz==2023.3.post1 -ipython[all]==7.22.0 -ipykernel==5.5.3 -jupyter==1.0.0 -scipy==1.11.4 -Shapely==2.0.2 -geopandas==0.14.4 -pyshp==2.1.3 -matplotlib==3.8.0 -scikit-image==0.22.0 -psutil==5.7.0 -orjson==3.8.12 -narwhals>=1.15.1 -anywidget==0.9.13 -polars[timezone] -pyarrow -kaleido -plotly-geo diff --git a/test_requirements/requirements_312_core.txt b/test_requirements/requirements_312_core.txt deleted file mode 100644 index a9e44d7480..0000000000 --- a/test_requirements/requirements_312_core.txt +++ /dev/null @@ -1,3 +0,0 @@ -requests==2.25.1 -pytest==7.4.4 -narwhals>=1.15.1 diff --git a/test_requirements/requirements_312_no_numpy_optional.txt b/test_requirements/requirements_312_no_numpy_optional.txt deleted file mode 100644 index 9786aea5f6..0000000000 --- a/test_requirements/requirements_312_no_numpy_optional.txt +++ /dev/null @@ -1,24 +0,0 @@ -requests==2.31.0 -pandas -xarray==2023.12.0 -statsmodels -Pillow==10.2.0 -pytest==7.4.4 -pytz==2023.3.post1 -ipython[all] -ipykernel -jupyter -scipy==1.11.4 -Shapely==2.0.2 -geopandas==0.14.4 -pyshp==2.3.1 -matplotlib==3.8.2 -scikit-image==0.22.0 -psutil==5.9.7 -kaleido -orjson==3.9.10 -polars[timezone] -pyarrow -narwhals>=1.15.1 -anywidget==0.9.13 -jupyter-console==6.4.4 diff --git a/test_requirements/requirements_312_np2_optional.txt b/test_requirements/requirements_312_np2_optional.txt deleted file mode 100644 index 1e02e3a836..0000000000 --- a/test_requirements/requirements_312_np2_optional.txt +++ /dev/null @@ -1,25 +0,0 @@ -requests==2.31.0 -pandas -numpy>2 -xarray==2024.10.0 -statsmodels -Pillow==10.2.0 -pytest==7.4.4 -pytz==2023.3.post1 -ipython[all] -ipywidgets -ipykernel -jupyter -scipy==1.14.1 -Shapely==2.0.2 -geopandas==0.14.4 -pyshp==2.3.1 -matplotlib==3.9.2 -scikit-image==0.24.0 -psutil==5.9.7 -kaleido -orjson==3.9.10 -polars[timezone] -pyarrow -narwhals>=1.15.1 -anywidget==0.9.13 diff --git a/test_requirements/requirements_312_optional.txt b/test_requirements/requirements_312_optional.txt deleted file mode 100644 index 0e85492bb8..0000000000 --- a/test_requirements/requirements_312_optional.txt +++ /dev/null @@ -1,26 +0,0 @@ -requests==2.31.0 -pandas -numpy -xarray==2023.12.0 -statsmodels -Pillow==10.2.0 -pytest==7.4.4 -pytz==2023.3.post1 -ipython[all] -ipykernel -jupyter -scipy==1.11.4 -Shapely==2.0.2 -geopandas==0.14.4 -pyshp==2.3.1 -matplotlib==3.8.2 -scikit-image==0.22.0 -psutil==5.9.7 -kaleido -orjson==3.9.10 -polars[timezone] -pyarrow -narwhals>=1.15.1 -anywidget==0.9.13 -jupyter-console==6.4.4 -plotly-geo diff --git a/test_requirements/requirements_38_core.txt b/test_requirements/requirements_38_core.txt deleted file mode 100644 index 9bfcbffa2f..0000000000 --- a/test_requirements/requirements_38_core.txt +++ /dev/null @@ -1,3 +0,0 @@ -requests==2.25.1 -pytest==8.1.1 -narwhals>=1.15.1 diff --git a/test_requirements/requirements_38_optional.txt b/test_requirements/requirements_38_optional.txt deleted file mode 100644 index f62c6ad656..0000000000 --- a/test_requirements/requirements_38_optional.txt +++ /dev/null @@ -1,24 +0,0 @@ -requests==2.25.1 -pandas==1.2.4 -numpy==1.20.2 -xarray==0.17.0 -statsmodels -Pillow==8.2.0 -pytest==8.1.1 -pytz==2021.1 -ipython[all]==7.22.0 -ipykernel==5.5.3 -jupyter==1.0.0 -scipy==1.6.2 -Shapely==2.0.2 -geopandas==0.13.2 -fiona<=1.9.6 -pyshp==2.1.3 -matplotlib==3.7.3 -scikit-image==0.18.1 -psutil==5.7.0 -kaleido -polars[timezone] -pyarrow -narwhals>=1.15.1 -anywidget==0.9.13 diff --git a/test_requirements/requirements_39_core.txt b/test_requirements/requirements_39_core.txt deleted file mode 100644 index 0d36eb9460..0000000000 --- a/test_requirements/requirements_39_core.txt +++ /dev/null @@ -1,3 +0,0 @@ -requests==2.25.1 -pytest==6.2.3 -narwhals>=1.15.1 diff --git a/test_requirements/requirements_39_optional.txt b/test_requirements/requirements_39_optional.txt deleted file mode 100644 index 1a767fe492..0000000000 --- a/test_requirements/requirements_39_optional.txt +++ /dev/null @@ -1,25 +0,0 @@ -requests==2.25.1 -pandas==1.2.4 -numpy==1.21.6 -xarray==0.17.0 -statsmodels -Pillow==8.2.0 -pytest==6.2.3 -pytz==2021.1 -ipython[all]==7.22.0 -ipykernel==5.5.3 -jupyter==1.0.0 -scipy==1.6.2 -Shapely==2.0.2 -geopandas==0.13.2 -fiona<=1.9.6 -pyshp==2.1.3 -matplotlib==3.8.0 -scikit-image==0.18.1 -psutil==5.7.0 -kaleido -orjson==3.8.12 -polars[timezone] -pyarrow -narwhals>=1.15.1 -anywidget==0.9.13 diff --git a/test_requirements/requirements_39_pandas_2_optional.txt b/test_requirements/requirements_39_pandas_2_optional.txt deleted file mode 100644 index 214bb545c0..0000000000 --- a/test_requirements/requirements_39_pandas_2_optional.txt +++ /dev/null @@ -1,26 +0,0 @@ -requests==2.25.1 -pandas==2.2.3 -numpy==1.22.4 -xarray==0.17.0 -statsmodels -Pillow==8.2.0 -pytest==6.2.3 -pytz==2021.1 -ipython[all]==7.22.0 -ipykernel==5.5.3 -jupyter==1.0.0 -scipy==1.6.2 -Shapely==2.0.2 -geopandas==0.14.4 -pyshp==2.1.3 -matplotlib==3.8.0 -scikit-image==0.18.1 -psutil==5.7.0 -kaleido -vaex -pydantic<=1.10.11 # for vaex, see https://github.com/vaexio/vaex/issues/2384 -polars[timezone] -pyarrow -narwhals>=1.15.1 -polars -anywidget==0.9.13 diff --git a/test_requirements/requirements_core.txt b/test_requirements/requirements_core.txt new file mode 100644 index 0000000000..2001f3e256 --- /dev/null +++ b/test_requirements/requirements_core.txt @@ -0,0 +1,2 @@ +requests +pytest diff --git a/test_requirements/requirements_optional.txt b/test_requirements/requirements_optional.txt new file mode 100644 index 0000000000..8ccdb19b25 --- /dev/null +++ b/test_requirements/requirements_optional.txt @@ -0,0 +1,26 @@ +requests +pandas +numpy +fiona<=1.9.6;python_version<="3.8" +xarray +statsmodels +Pillow +pytest +pytz +ipython[all] +ipykernel +jupyter +scipy +Shapely +geopandas +pyshp +matplotlib +scikit-image +psutil +kaleido +orjson +polars[timezone] +pyarrow +anywidget +plotly-geo +vaex;python_version<="3.9" \ No newline at end of file diff --git a/tests/test_optional/test_px/test_px_input.py b/tests/test_optional/test_px/test_px_input.py index edb3bfdd2e..78b0bc3f76 100644 --- a/tests/test_optional/test_px/test_px_input.py +++ b/tests/test_optional/test_px/test_px_input.py @@ -14,8 +14,7 @@ import warnings -# FIXME: don't test with vaex if vaex isn't installed -if (optional_imports.get_module("vaex") is None) and (sys.version_info >= (3, 12)): +if optional_imports.get_module("vaex") is None and sys.version_info > (3, 9): TEST_LIBS = ["polars"] else: TEST_LIBS = ["vaex", "polars"]