From 699a9258917b643b2cef56038f916a19d93d4807 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 10:24:59 -0400 Subject: [PATCH 01/36] Update setup.py to require Python>=3.6 --- packages/python/plotly/setup.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/python/plotly/setup.py b/packages/python/plotly/setup.py index b7df3e2ba64..e0f035b080f 100644 --- a/packages/python/plotly/setup.py +++ b/packages/python/plotly/setup.py @@ -457,16 +457,13 @@ def run(self): long_description_content_type="text/markdown", classifiers=[ "Development Status :: 5 - Production/Stable", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Scientific/Engineering :: Visualization", ], + python_requires=">=3.6", license="MIT", packages=[ "plotly", From 5fae5e00cc8815dc878f5a8c14506131d83c47ba Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 10:32:16 -0400 Subject: [PATCH 02/36] Add an f-string (compatible with python>=3.6) for good measure --- packages/python/plotly/_plotly_utils/optional_imports.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/plotly/_plotly_utils/optional_imports.py b/packages/python/plotly/_plotly_utils/optional_imports.py index e76eab95f1c..33bd2d05f57 100644 --- a/packages/python/plotly/_plotly_utils/optional_imports.py +++ b/packages/python/plotly/_plotly_utils/optional_imports.py @@ -32,5 +32,5 @@ def get_module(name, should_load=True): _not_importable.add(name) except Exception as e: _not_importable.add(name) - msg = "Error importing optional module {}".format(name) + msg = f"Error importing optional module {name}" logger.exception(msg) From 841da6528f188aa2009b585c75a9feb6fc2d45c0 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 10:42:25 -0400 Subject: [PATCH 03/36] remove pre 3.6 tests from tox and circleci --- .circleci/config.yml | 163 +-------------------------------- packages/python/plotly/tox.ini | 53 ++--------- 2 files changed, 7 insertions(+), 209 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fae56c4ceae..dc0559b5ad9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,38 +15,6 @@ jobs: command: "black --check ." # Core - python-2.7-core: - docker: - - image: circleci/python:2.7-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_27: python2.7 - - steps: - - checkout - - run: - name: Install tox - command: "sudo pip install tox" - - run: - name: Test with tox - command: "cd packages/python/plotly; tox -e py27-core" - no_output_timeout: 20m - - python-3.5-core: - docker: - - image: circleci/python:3.5-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_35: python3.5 - - steps: - - checkout - - run: - name: Install tox - command: "sudo pip install tox" - - run: - name: Test with tox - command: "cd packages/python/plotly; tox -e py35-core" - no_output_timeout: 20m - python-3.6-core: docker: - image: circleci/python:3.6-stretch-node-browsers @@ -112,38 +80,6 @@ jobs: rm test/percy/*.html # Optional - python-2.7-optional: - docker: - - image: circleci/python:2.7-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_27: python2.7 - - steps: - - checkout - - run: - name: Install tox - command: "sudo pip install tox" - - run: - name: Test with tox - command: "cd packages/python/plotly; tox -e py27-optional" - no_output_timeout: 20m - - python-3.5-optional: - docker: - - image: circleci/python:3.5-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_35: python3.5 - - steps: - - checkout - - run: - name: Install tox - command: "sudo pip install tox" - - run: - name: Test with tox - command: "cd packages/python/plotly; tox -e py35-optional" - no_output_timeout: 20m - python-3.6-optional: docker: - image: circleci/python:3.6-stretch-node-browsers @@ -176,39 +112,7 @@ jobs: command: "cd packages/python/plotly; tox -e py37-optional" no_output_timeout: 20m - # Plot.ly - python-2.7-plot_ly: - docker: - - image: circleci/python:2.7-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_27: python2.7 - - steps: - - checkout - - run: - name: Install tox - command: "sudo pip install tox" - - run: - name: Test with tox - command: "cd packages/python/chart-studio; tox -e py27-plot_ly" - no_output_timeout: 20m - - python-3.5-plot_ly: - docker: - - image: circleci/python:3.5-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_35: python3.5 - - steps: - - checkout - - run: - name: Install tox - command: "sudo pip install tox" - - run: - name: Test with tox - command: "cd packages/python/chart-studio; tox -e py35-plot_ly" - no_output_timeout: 20m - + # Chart studio python-3.7-plot_ly: docker: - image: circleci/python:3.7-stretch-node-browsers @@ -225,66 +129,6 @@ jobs: command: "cd packages/python/chart-studio; tox -e py37-plot_ly" no_output_timeout: 20m - python-2-7-orca: - docker: - - image: circleci/node:10.9-stretch-browsers - environment: - PYTHON_VERSION: 2.7 - - steps: - - checkout - - restore_cache: - keys: - - conda-27-v1-{{ checksum ".circleci/create_conda_optional_env.sh" }} - - run: - name: Create conda environment - command: .circleci/create_conda_optional_env.sh - - - save_cache: - key: conda-27-v1-{{ checksum ".circleci/create_conda_optional_env.sh" }} - paths: - - /home/circleci/miniconda/ - - run: - name: Run Tests - command: | - . /home/circleci/miniconda/etc/profile.d/conda.sh - conda activate circle_optional - pytest --disable-warnings packages/python/plotly/plotly/tests/test_core - pytest packages/python/plotly/plotly/tests/test_orca - - - store_artifacts: - path: plotly/tests/test_orca/images/linux/failed - - python-3-5-orca: - docker: - - image: circleci/node:10.9-stretch-browsers - environment: - PYTHON_VERSION: 3.5 - - steps: - - checkout - - restore_cache: - keys: - - conda-35-v1-{{ checksum ".circleci/create_conda_optional_env.sh" }} - - run: - name: Create conda environment - command: .circleci/create_conda_optional_env.sh - - - save_cache: - key: conda-35-v1-{{ checksum ".circleci/create_conda_optional_env.sh" }} - paths: - - /home/circleci/miniconda/ - - run: - name: Run Tests - command: | - . /home/circleci/miniconda/etc/profile.d/conda.sh - conda activate circle_optional - pytest --disable-warnings packages/python/plotly/plotly/tests/test_core - pytest packages/python/plotly/plotly/tests/test_orca - - - store_artifacts: - path: plotly/tests/test_orca/images/linux/failed - python-3-7-orca: docker: - image: circleci/node:10.9-stretch-browsers @@ -517,16 +361,11 @@ workflows: build: jobs: - - python-2.7-core - - python-3.5-core - python-3.6-core - python-3.7-core - python-3.7-percy - - python-2.7-optional - - python-3.5-optional - python-3.6-optional - python-3.7-optional - python-3.7-plot_ly - - python-2-7-orca - python-3-7-orca - build-doc diff --git a/packages/python/plotly/tox.ini b/packages/python/plotly/tox.ini index 635cd9478c3..8f086e3f2e4 100644 --- a/packages/python/plotly/tox.ini +++ b/packages/python/plotly/tox.ini @@ -5,17 +5,17 @@ ; ; You can limit tox testing to certain environments via the `-e` (envlist) ; command line option: -; tox -e py27-core,py34-core +; tox -e py36-core,py37-core ; OR, you can just set the `TOXENV` environment variable, which is handy: -; TOXENV=py27-core,py34-core +; TOXENV=py36-core,py37-core ; ; Integrating with the virtualenvs in Circle CI is a bit of a pain. For -; whatever reason the "executable" `python35` (at the time of writing) cannot +; whatever reason the "executable" `python36` (at the time of writing) cannot ; be activated directly. Instead the circle.yml file specifies the actual ; binary directly. Because of this, you too have to set the following env ; variables: -; PLOTLY_TOX_PYTHON_27=python2.7 -; PLOTLY_TOX_PYTHON_34=python3.4 +; PLOTLY_TOX_PYTHON_36=python3.6 +; PLOTLY_TOX_PYTHON_37=python3.7 ; ... ; These will be specific to your machine and may not look like the ones above. ; If you're not testing with all the python versions (see TOXENV above), @@ -36,7 +36,7 @@ [tox] ; The py{A,B,C}-{X,Y} generates a matrix of envs: ; pyA-X,pyA-Y,pyB-X,pyB-Y,pyC-X,pyC-Y -envlist = py{27,34,35,36,37}-{core,optional},py{27,34,37} +envlist = py{36,37}-{core,optional},py{37}; ; Note that envs can be targeted by deps using the : dep syntax. ; Only one dep is allowed per line as of the time of writing. The @@ -77,18 +77,6 @@ deps= optional: kaleido ; CORE ENVIRONMENTS -[testenv:py27-core] -basepython={env:PLOTLY_TOX_PYTHON_27:} -commands= - python --version - pytest {posargs} plotly/tests/test_core - -[testenv:py35-core] -basepython={env:PLOTLY_TOX_PYTHON_35:} -commands= - python --version - pytest {posargs} plotly/tests/test_core - [testenv:py36-core] basepython={env:PLOTLY_TOX_PYTHON_36:} commands= @@ -103,35 +91,6 @@ commands= pytest {posargs} -x test_init/test_dependencies_not_imported.py pytest {posargs} -x test_init/test_lazy_imports.py -; OPTIONAL ENVIRONMENTS -;[testenv:py27-optional] -;basepython={env:PLOTLY_TOX_PYTHON_27:} -;commands= -; python --version -;; Do some coverage reporting. No need to do this for all environments. -; mkdir -p {envbindir}/../../coverage-reports/{envname} -; coverage erase -; coverage run --include="*/plotly/*" --omit="*/tests*" {envbindir}/nosetests {posargs} plotly/tests -; coverage html -d "{envbindir}/../../coverage-reports/{envname}" --title={envname} - -[testenv:py27-optional] -basepython={env:PLOTLY_TOX_PYTHON_27:} -commands= - python --version - pytest {posargs} plotly/tests/test_core - pytest {posargs} plotly/tests/test_optional - pytest _plotly_utils/tests/ - pytest plotly/tests/test_io - -[testenv:py35-optional] -basepython={env:PLOTLY_TOX_PYTHON_35:} -commands= - python --version - pytest {posargs} plotly/tests/test_core - pytest {posargs} plotly/tests/test_optional - pytest _plotly_utils/tests/ - pytest plotly/tests/test_io - [testenv:py36-optional] basepython={env:PLOTLY_TOX_PYTHON_36:} commands= From 4608f1eeb4f3f6d998352a72dd2194403d2acf3d Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 11:19:00 -0400 Subject: [PATCH 04/36] First cut at abandoning tox --- .circleci/config.yml | 98 ++++++++++++------- .../test_requirements/requirements_37.txt | 12 +++ .../requirements_36_core.txt | 10 ++ .../requirements_36_optional.txt | 23 +++++ .../requirements_37_core.txt | 10 ++ .../requirements_37_optional.txt | 23 +++++ 6 files changed, 138 insertions(+), 38 deletions(-) create mode 100644 packages/python/chart-studio/test_requirements/requirements_37.txt create mode 100644 packages/python/plotly/test_requirements/requirements_36_core.txt create mode 100644 packages/python/plotly/test_requirements/requirements_36_optional.txt create mode 100644 packages/python/plotly/test_requirements/requirements_37_core.txt create mode 100644 packages/python/plotly/test_requirements/requirements_37_optional.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index dc0559b5ad9..8646aaad995 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,34 +18,36 @@ jobs: python-3.6-core: docker: - image: circleci/python:3.6-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_36: python3.6 steps: - checkout - run: - name: Install tox - command: "sudo pip install tox" + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_36_core.txt" - run: - name: Test with tox - command: "cd packages/python/plotly; tox -e py36-core" + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" no_output_timeout: 20m python-3.7-core: docker: - image: circleci/python:3.7-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_37: python3.7 steps: - checkout - run: - name: Install tox - command: "sudo pip install tox" + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_37_core.txt" - run: - name: Test with tox - command: "cd packages/python/plotly; tox -e py37-core" + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" no_output_timeout: 20m + - run: + name: Test dependencdies not imported + command: "cd packages/python/plotly; pytest -x test_init/test_dependencies_not_imported.py" + - run: + name: Test lazy imports + command: "cd packages/python/plotly; pytest -x test_init/test_lazy_imports.py" python-3.7-percy: docker: @@ -83,50 +85,68 @@ jobs: python-3.6-optional: docker: - image: circleci/python:3.6-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_36: python3.6 steps: - checkout - run: - name: Install tox - command: "sudo pip install tox" + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_36_optional.txt" + - run: + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" + no_output_timeout: 20m + - run: + name: Test optional + command: "cd packages/python/plotly; pytest plotly/tests/test_optional" + no_output_timeout: 20m - run: - name: Test with tox - command: "cd packages/python/plotly; tox -e py36-optional" + name: Test utils + command: "cd packages/python/plotly; pytest _plotly_utils/tests/" + no_output_timeout: 20m + - run: + name: Test io + command: "cd packages/python/plotly; pytest plotly/tests/test_io" no_output_timeout: 20m python-3.7-optional: docker: - image: circleci/python:3.7-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_37: python3.7 steps: - checkout - run: - name: Install tox - command: "sudo pip install tox" + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_37_optional.txt" - run: - name: Test with tox - command: "cd packages/python/plotly; tox -e py37-optional" + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" + no_output_timeout: 20m + - run: + name: Test optional + command: "cd packages/python/plotly; pytest plotly/tests/test_optional" + no_output_timeout: 20m + - run: + name: Test utils + command: "cd packages/python/plotly; pytest _plotly_utils/tests/" + no_output_timeout: 20m + - run: + name: Test io + command: "cd packages/python/plotly; pytest plotly/tests/test_io" no_output_timeout: 20m # Chart studio python-3.7-plot_ly: docker: - image: circleci/python:3.7-stretch-node-browsers - environment: - PLOTLY_TOX_PYTHON_37: python3.7 steps: - checkout - run: - name: Install tox - command: "sudo pip install tox" + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./chart-studio/test_requirements/requirements_37.txt" - run: - name: Test with tox - command: "cd packages/python/chart-studio; tox -e py37-plot_ly" + name: Tests + command: "cd packages/python/chart-studio; pytest -x chart_studio/tests/" no_output_timeout: 20m python-3-7-orca: @@ -164,14 +184,13 @@ jobs: docker: - image: circleci/python:3.7-stretch-node-browsers environment: - PLOTLY_TOX_PYTHON_37: python3.7 LANG: en_US.UTF-8 steps: - checkout - run: - name: Install tox - command: "sudo pip install retrying tox black inflect" + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_37_core.txt black inflect" - run: name: Update jupyterlab-plotly version command: "cd packages/python/plotly; python setup.py updateplotlywidgetversion" @@ -179,12 +198,15 @@ jobs: name: Update plotly.js to dev command: "cd packages/python/plotly; python setup.py updateplotlyjsdev" - run: - name: Test with tox - command: | - cd packages/python/plotly - locale - tox -e py37-core -- -k 'not nodev' + name: Test core + command: "cd packages/python/plotly; locale; pytest -k 'not nodev' plotly/tests/test_core" no_output_timeout: 20m + - run: + name: Test dependencdies not imported + command: "cd packages/python/plotly; locale; pytest -x -k 'not nodev' test_init/test_dependencies_not_imported.py" + - run: + name: Test lazy imports + command: "cd packages/python/plotly; locale; pytest -x -k 'not nodev' test_init/test_lazy_imports.py" - run: name: Commit command: | diff --git a/packages/python/chart-studio/test_requirements/requirements_37.txt b/packages/python/chart-studio/test_requirements/requirements_37.txt new file mode 100644 index 00000000000..b30b19ecb92 --- /dev/null +++ b/packages/python/chart-studio/test_requirements/requirements_37.txt @@ -0,0 +1,12 @@ +decorator==4.0.9 +nose==1.3.7 +requests==2.12.4 +six==1.10.0 +pytz==2016.10 +retrying==1.3.3 +pytest==3.5.1 +pandas==0.23.2 +numpy==1.14.3 +ipywidgets==7.2.0 +matplotlib==2.2.3 +--editable=./plotly diff --git a/packages/python/plotly/test_requirements/requirements_36_core.txt b/packages/python/plotly/test_requirements/requirements_36_core.txt new file mode 100644 index 00000000000..e5b0625d058 --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_36_core.txt @@ -0,0 +1,10 @@ +requests==2.12.4 +six==1.10.0 +retrying==1.3.3 +pandas==0.24.2 +numpy==1.19.5 +xarray==0.10.9 +statsmodels==0.10.2 +pillow==5.2.0 +pytest==3.5.1 +pytz==2016.10 diff --git a/packages/python/plotly/test_requirements/requirements_36_optional.txt b/packages/python/plotly/test_requirements/requirements_36_optional.txt new file mode 100644 index 00000000000..8543b9dc61b --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_36_optional.txt @@ -0,0 +1,23 @@ +requests==2.12.4 +six==1.10.0 +retrying==1.3.3 +pandas==0.24.2 +numpy==1.19.5 +xarray==0.10.9 +statsmodels==0.10.2 +pillow==5.2.0 +pytest==3.5.1 +pytz==2016.10 + +--editable=./plotly-geo +ipython[all]==5.1.0 +ipywidgets==7.2.0 +ipykernel==4.8.2 +jupyter==1.0.0 +scipy==1.2.3 +shapely==1.7.0 +geopandas==0.3.0 +pyshp==1.2.10 +matplotlib==2.2.3 +scikit-image==0.14.4 +kaleido diff --git a/packages/python/plotly/test_requirements/requirements_37_core.txt b/packages/python/plotly/test_requirements/requirements_37_core.txt new file mode 100644 index 00000000000..e5b0625d058 --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_37_core.txt @@ -0,0 +1,10 @@ +requests==2.12.4 +six==1.10.0 +retrying==1.3.3 +pandas==0.24.2 +numpy==1.19.5 +xarray==0.10.9 +statsmodels==0.10.2 +pillow==5.2.0 +pytest==3.5.1 +pytz==2016.10 diff --git a/packages/python/plotly/test_requirements/requirements_37_optional.txt b/packages/python/plotly/test_requirements/requirements_37_optional.txt new file mode 100644 index 00000000000..8543b9dc61b --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_37_optional.txt @@ -0,0 +1,23 @@ +requests==2.12.4 +six==1.10.0 +retrying==1.3.3 +pandas==0.24.2 +numpy==1.19.5 +xarray==0.10.9 +statsmodels==0.10.2 +pillow==5.2.0 +pytest==3.5.1 +pytz==2016.10 + +--editable=./plotly-geo +ipython[all]==5.1.0 +ipywidgets==7.2.0 +ipykernel==4.8.2 +jupyter==1.0.0 +scipy==1.2.3 +shapely==1.7.0 +geopandas==0.3.0 +pyshp==1.2.10 +matplotlib==2.2.3 +scikit-image==0.14.4 +kaleido From 3af133afcaa70141314efdb0415d969f0eb6acfe Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 11:30:47 -0400 Subject: [PATCH 05/36] Rename plot_ly in chart_studio in ci tests --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8646aaad995..e5d2b453e8c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -135,7 +135,7 @@ jobs: no_output_timeout: 20m # Chart studio - python-3.7-plot_ly: + python-3.7-chart_studio: docker: - image: circleci/python:3.7-stretch-node-browsers @@ -388,6 +388,6 @@ workflows: - python-3.7-percy - python-3.6-optional - python-3.7-optional - - python-3.7-plot_ly + - python-3.7-chart_studio - python-3-7-orca - build-doc From 028b960be35602ba2faf38a0a5117fd002cb8c5d Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 11:45:54 -0400 Subject: [PATCH 06/36] Remove tox.ini files --- packages/python/chart-studio/tox.ini | 86 --------------------- packages/python/plotly/tox.ini | 110 --------------------------- 2 files changed, 196 deletions(-) delete mode 100644 packages/python/chart-studio/tox.ini delete mode 100644 packages/python/plotly/tox.ini diff --git a/packages/python/chart-studio/tox.ini b/packages/python/chart-studio/tox.ini deleted file mode 100644 index faddb36305f..00000000000 --- a/packages/python/chart-studio/tox.ini +++ /dev/null @@ -1,86 +0,0 @@ -; Tox is a testing tool that manages virtualenvs for testing multiple Python -; environments in a consistent/controlled way. - -; SETTING ENVIRONMENT VARIABLES AND TOX TESTING VARIABLES -; -; You can limit tox testing to certain environments via the `-e` (envlist) -; command line option: -; tox -e py27-core,py34-core -; OR, you can just set the `TOXENV` environment variable, which is handy: -; TOXENV=py27-core,py34-core -; -; Integrating with the virtualenvs in Circle CI is a bit of a pain. For -; whatever reason the "executable" `python35` (at the time of writing) cannot -; be activated directly. Instead the circle.yml file specifies the actual -; binary directly. Because of this, you too have to set the following env -; variables: -; PLOTLY_TOX_PYTHON_27=python2.7 -; PLOTLY_TOX_PYTHON_34=python3.4 -; ... -; These will be specific to your machine and may not look like the ones above. -; If you're not testing with all the python versions (see TOXENV above), -; there's no need to install and map other versions. - -; PASSING ADDITONAL ARGUMENTS TO TEST COMMANDS -; The {posargs} is tox-specific and passes in any command line args after `--`. -; For example, given the testing command in *this* file: -; pytest {posargs} -x plotly/tests/test_core -; -; The following command: -; tox -- -k 'not nodev' -; -; Tells tox to call: -; pytest -k 'not nodev' -x plotly/tests/test_core -; - -[tox] -; The py{A,B,C}-{X,Y} generates a matrix of envs: -; pyA-X,pyA-Y,pyB-X,pyB-Y,pyC-X,pyC-Y -envlist = py{27,34,37}-plot_ly - -; Note that envs can be targeted by deps using the : dep syntax. -; Only one dep is allowed per line as of the time of writing. The -; can be a `-` (hyphen) concatenated string of the environments to target -; with the given dep. - -; These commands are general and will be run for *all* environments. -[testenv] -passenv=PLOTLY_TOX_* -whitelist_externals= - mkdir -deps= - coverage==4.3.1 - decorator==4.0.9 - mock==2.0.0 - nose==1.3.7 - requests==2.12.4 - six==1.10.0 - pytz==2016.10 - retrying==1.3.3 - pytest==3.5.1 - backports.tempfile==1.0 - pandas==0.23.2 - numpy==1.14.3 - ipywidgets==7.2.0 - matplotlib==2.2.3 - --editable=file:///{toxinidir}/../plotly - - -; Plot.ly environments -[testenv:py27-plot_ly] -basepython={env:PLOTLY_TOX_PYTHON_27:} -commands= - python --version - pytest {posargs} -x chart_studio/tests/ - -[testenv:py35-plot_ly] -basepython={env:PLOTLY_TOX_PYTHON_35:} -commands= - python --version - pytest {posargs} -x chart_studio/tests/ - -[testenv:py37-plot_ly] -basepython={env:PLOTLY_TOX_PYTHON_37:} -commands= - python --version - pytest {posargs} -x chart_studio/tests/ diff --git a/packages/python/plotly/tox.ini b/packages/python/plotly/tox.ini deleted file mode 100644 index 8f086e3f2e4..00000000000 --- a/packages/python/plotly/tox.ini +++ /dev/null @@ -1,110 +0,0 @@ -; Tox is a testing tool that manages virtualenvs for testing multiple Python -; environments in a consistent/controlled way. - -; SETTING ENVIRONMENT VARIABLES AND TOX TESTING VARIABLES -; -; You can limit tox testing to certain environments via the `-e` (envlist) -; command line option: -; tox -e py36-core,py37-core -; OR, you can just set the `TOXENV` environment variable, which is handy: -; TOXENV=py36-core,py37-core -; -; Integrating with the virtualenvs in Circle CI is a bit of a pain. For -; whatever reason the "executable" `python36` (at the time of writing) cannot -; be activated directly. Instead the circle.yml file specifies the actual -; binary directly. Because of this, you too have to set the following env -; variables: -; PLOTLY_TOX_PYTHON_36=python3.6 -; PLOTLY_TOX_PYTHON_37=python3.7 -; ... -; These will be specific to your machine and may not look like the ones above. -; If you're not testing with all the python versions (see TOXENV above), -; there's no need to install and map other versions. - -; PASSING ADDITONAL ARGUMENTS TO TEST COMMANDS -; The {posargs} is tox-specific and passes in any command line args after `--`. -; For example, given the testing command in *this* file: -; pytest {posargs} plotly/tests/test_core -; -; The following command: -; tox -- -k 'not nodev' -; -; Tells tox to call: -; pytest -k 'not nodev' plotly/tests/test_core -; - -[tox] -; The py{A,B,C}-{X,Y} generates a matrix of envs: -; pyA-X,pyA-Y,pyB-X,pyB-Y,pyC-X,pyC-Y -envlist = py{36,37}-{core,optional},py{37}; - -; Note that envs can be targeted by deps using the : dep syntax. -; Only one dep is allowed per line as of the time of writing. The -; can be a `-` (hyphen) concatenated string of the environments to target -; with the given dep. - -; These commands are general and will be run for *all* environments. -[testenv] -passenv=PLOTLY_TOX_* -whitelist_externals= - mkdir -deps= - coverage==4.3.1 - decorator==4.0.9 - mock==2.0.0 - requests==2.12.4 - six==1.10.0 - pytz==2016.10 - retrying==1.3.3 - pytest==3.5.1 - pandas==0.24.2 - numpy==1.19.5 - xarray==0.10.9 - statsmodels==0.10.2 - pillow==5.2.0 - backports.tempfile==1.0 - optional: --editable=file:///{toxinidir}/../plotly-geo - optional: ipython[all]==5.1.0 - optional: ipywidgets==7.2.0 - optional: ipykernel==4.8.2 - optional: jupyter==1.0.0 - optional: scipy==1.2.3 - optional: shapely==1.7.0 - optional: geopandas==0.3.0 - optional: pyshp==1.2.10 - optional: matplotlib==2.2.3 - optional: scikit-image==0.14.4 - optional: kaleido - -; CORE ENVIRONMENTS -[testenv:py36-core] -basepython={env:PLOTLY_TOX_PYTHON_36:} -commands= - python --version - pytest {posargs} plotly/tests/test_core - -[testenv:py37-core] -basepython={env:PLOTLY_TOX_PYTHON_37:} -commands= - python --version - pytest {posargs} plotly/tests/test_core - pytest {posargs} -x test_init/test_dependencies_not_imported.py - pytest {posargs} -x test_init/test_lazy_imports.py - -[testenv:py36-optional] -basepython={env:PLOTLY_TOX_PYTHON_36:} -commands= - python --version - pytest {posargs} plotly/tests/test_core - pytest {posargs} plotly/tests/test_optional - pytest _plotly_utils/tests/ - pytest plotly/tests/test_io - -[testenv:py37-optional] -basepython={env:PLOTLY_TOX_PYTHON_37:} -commands= - python --version - pytest {posargs} plotly/tests/test_core - pytest {posargs} plotly/tests/test_optional - pytest _plotly_utils/tests/ - pytest plotly/tests/test_io From b17d6ac2a8bb2433d44bf8be6e3bfebe58f22b25 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 11:46:25 -0400 Subject: [PATCH 07/36] Move tests with pandas/numpy dependencies to test_optional, remove these from core requirements --- .../tests/test_core/test_utils/test_utils.py | 83 +---------------- .../test_px/__init__.py | 0 .../test_px/test_colors.py | 0 .../test_px/test_facets.py | 0 .../test_px/test_imshow.py | 0 .../test_px/test_marginals.py | 0 .../test_px/test_pandas_backend.py | 0 .../test_px/test_px.py | 0 .../test_px/test_px_functions.py | 0 .../test_px/test_px_hover.py | 0 .../test_px/test_px_input.py | 0 .../test_px/test_px_wide.py | 0 .../test_px/test_trendline.py | 0 .../test_optional/test_utils/test_utils.py | 88 +++++++++++++++++++ .../requirements_36_core.txt | 6 -- .../requirements_37_core.txt | 6 -- 16 files changed, 89 insertions(+), 94 deletions(-) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/__init__.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_colors.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_facets.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_imshow.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_marginals.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_pandas_backend.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_px.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_px_functions.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_px_hover.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_px_input.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_px_wide.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_px/test_trendline.py (100%) diff --git a/packages/python/plotly/plotly/tests/test_core/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_core/test_utils/test_utils.py index 6122f27e7ee..cc5cb52e122 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_core/test_utils/test_utils.py @@ -2,13 +2,8 @@ from unittest import TestCase -import json as _json - from plotly.utils import PlotlyJSONEncoder, get_by_path, node_generator -from time import time -import numpy as np -import plotly.graph_objects as go - +import json as _json class TestJSONEncoder(TestCase): def test_nan_to_null(self): @@ -21,39 +16,6 @@ def test_invalid_encode_exception(self): with self.assertRaises(TypeError): _json.dumps({"a": {1}}, cls=PlotlyJSONEncoder) - def test_fast_track_finite_arrays(self): - # if NaN or Infinity is found in the json dump - # of a figure, it is decoded and re-encoded to replace these values - # with null. This test checks that NaN and Infinity values are - # indeed converted to null, and that the encoding of figures - # without inf or nan is faster (because we can avoid decoding - # and reencoding). - z = np.random.randn(100, 100) - x = np.arange(100.0) - fig_1 = go.Figure(go.Heatmap(z=z, x=x)) - t1 = time() - json_str_1 = _json.dumps(fig_1, cls=PlotlyJSONEncoder) - t2 = time() - x[0] = np.nan - x[1] = np.inf - fig_2 = go.Figure(go.Heatmap(z=z, x=x)) - t3 = time() - json_str_2 = _json.dumps(fig_2, cls=PlotlyJSONEncoder) - t4 = time() - assert t2 - t1 < t4 - t3 - assert "null" in json_str_2 - assert "NaN" not in json_str_2 - assert "Infinity" not in json_str_2 - x = np.arange(100.0) - fig_3 = go.Figure(go.Heatmap(z=z, x=x)) - fig_3.update_layout(title_text="Infinity") - t5 = time() - json_str_3 = _json.dumps(fig_3, cls=PlotlyJSONEncoder) - t6 = time() - assert t2 - t1 < t6 - t5 - assert "Infinity" in json_str_3 - - class TestGetByPath(TestCase): def test_get_by_path(self): @@ -86,46 +48,3 @@ def test_node_generator(self): ] for i, item in enumerate(node_generator(node0)): self.assertEqual(item, expected_node_path_tuples[i]) - - -class TestNumpyIntegerBaseType(TestCase): - def test_numpy_integer_import(self): - # should generate a figure with subplots of array and not throw a ValueError - import numpy as np - import plotly.graph_objects as go - from plotly.subplots import make_subplots - - indices_rows = np.array([1], dtype=np.int) - indices_cols = np.array([1], dtype=np.int) - fig = make_subplots(rows=1, cols=1) - fig.add_trace(go.Scatter(y=[1]), row=indices_rows[0], col=indices_cols[0]) - - data_path = ("data", 0, "y") - value = get_by_path(fig, data_path) - expected_value = (1,) - self.assertEqual(value, expected_value) - - def test_get_numpy_int_type(self): - import numpy as np - from _plotly_utils.utils import _get_int_type - - int_type_tuple = _get_int_type() - expected_tuple = (int, np.integer) - - self.assertEqual(int_type_tuple, expected_tuple) - - -class TestNoNumpyIntegerBaseType(TestCase): - def test_no_numpy_int_type(self): - import sys - from _plotly_utils.utils import _get_int_type - from _plotly_utils.optional_imports import get_module - - np = get_module("numpy", should_load=False) - if np: - sys.modules.pop("numpy") - - int_type_tuple = _get_int_type() - expected_tuple = (int,) - - self.assertEqual(int_type_tuple, expected_tuple) diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/__init__.py b/packages/python/plotly/plotly/tests/test_optional/test_px/__init__.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/__init__.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/__init__.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_colors.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_colors.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_colors.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_colors.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_facets.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_facets.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_facets.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_facets.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_imshow.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_imshow.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_marginals.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_marginals.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_marginals.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_marginals.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_pandas_backend.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_pandas_backend.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_pandas_backend.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_pandas_backend.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_px.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_px.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_px.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_px_functions.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_functions.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_px_functions.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_px_functions.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_px_hover.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_hover.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_px_hover.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_px_hover.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_px_input.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_px_input.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_px_wide.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_wide.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_px_wide.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_px_wide.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_trendline.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_trendline.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_px/test_trendline.py rename to packages/python/plotly/plotly/tests/test_optional/test_px/test_trendline.py diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py index 79ce6a7f320..c91d82e1410 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py @@ -9,6 +9,7 @@ import decimal from datetime import datetime as dt from unittest import TestCase +from time import time import pytest import numpy as np @@ -20,7 +21,9 @@ import base64 from plotly import optional_imports, utils +import plotly.graph_objects as go from plotly.graph_objs import Scatter, Scatter3d, Figure, Data +from plotly.utils import get_by_path from PIL import Image @@ -358,6 +361,91 @@ def test_pil_image_encoding(self): j1 = _json.dumps({"source": img}, cls=utils.PlotlyJSONEncoder) assert j1 == '{"source": "%s"}' % expected_uri + def test_nan_to_null(self): + array = [1, float("NaN"), float("Inf"), float("-Inf"), "platypus"] + result = _json.dumps(array, cls=utils.PlotlyJSONEncoder) + expected_result = '[1, null, null, null, "platypus"]' + self.assertEqual(result, expected_result) + + def test_invalid_encode_exception(self): + with self.assertRaises(TypeError): + _json.dumps({"a": {1}}, cls=utils.PlotlyJSONEncoder) + + def test_fast_track_finite_arrays(self): + # if NaN or Infinity is found in the json dump + # of a figure, it is decoded and re-encoded to replace these values + # with null. This test checks that NaN and Infinity values are + # indeed converted to null, and that the encoding of figures + # without inf or nan is faster (because we can avoid decoding + # and reencoding). + z = np.random.randn(100, 100) + x = np.arange(100.0) + fig_1 = go.Figure(go.Heatmap(z=z, x=x)) + t1 = time() + json_str_1 = _json.dumps(fig_1, cls=utils.PlotlyJSONEncoder) + t2 = time() + x[0] = np.nan + x[1] = np.inf + fig_2 = go.Figure(go.Heatmap(z=z, x=x)) + t3 = time() + json_str_2 = _json.dumps(fig_2, cls=utils.PlotlyJSONEncoder) + t4 = time() + assert t2 - t1 < t4 - t3 + assert "null" in json_str_2 + assert "NaN" not in json_str_2 + assert "Infinity" not in json_str_2 + x = np.arange(100.0) + fig_3 = go.Figure(go.Heatmap(z=z, x=x)) + fig_3.update_layout(title_text="Infinity") + t5 = time() + json_str_3 = _json.dumps(fig_3, cls=utils.PlotlyJSONEncoder) + t6 = time() + assert t2 - t1 < t6 - t5 + assert "Infinity" in json_str_3 + + +class TestNumpyIntegerBaseType(TestCase): + def test_numpy_integer_import(self): + # should generate a figure with subplots of array and not throw a ValueError + import numpy as np + import plotly.graph_objects as go + from plotly.subplots import make_subplots + + indices_rows = np.array([1], dtype=np.int) + indices_cols = np.array([1], dtype=np.int) + fig = make_subplots(rows=1, cols=1) + fig.add_trace(go.Scatter(y=[1]), row=indices_rows[0], col=indices_cols[0]) + + data_path = ("data", 0, "y") + value = get_by_path(fig, data_path) + expected_value = (1,) + self.assertEqual(value, expected_value) + + def test_get_numpy_int_type(self): + import numpy as np + from _plotly_utils.utils import _get_int_type + + int_type_tuple = _get_int_type() + expected_tuple = (int, np.integer) + + self.assertEqual(int_type_tuple, expected_tuple) + + +class TestNoNumpyIntegerBaseType(TestCase): + def test_no_numpy_int_type(self): + import sys + from _plotly_utils.utils import _get_int_type + from _plotly_utils.optional_imports import get_module + + np = get_module("numpy", should_load=False) + if np: + sys.modules.pop("numpy") + + int_type_tuple = _get_int_type() + expected_tuple = (int,) + + self.assertEqual(int_type_tuple, expected_tuple) + if matplotlylib: diff --git a/packages/python/plotly/test_requirements/requirements_36_core.txt b/packages/python/plotly/test_requirements/requirements_36_core.txt index e5b0625d058..ee1ceec42bb 100644 --- a/packages/python/plotly/test_requirements/requirements_36_core.txt +++ b/packages/python/plotly/test_requirements/requirements_36_core.txt @@ -1,10 +1,4 @@ requests==2.12.4 six==1.10.0 retrying==1.3.3 -pandas==0.24.2 -numpy==1.19.5 -xarray==0.10.9 -statsmodels==0.10.2 -pillow==5.2.0 pytest==3.5.1 -pytz==2016.10 diff --git a/packages/python/plotly/test_requirements/requirements_37_core.txt b/packages/python/plotly/test_requirements/requirements_37_core.txt index e5b0625d058..ee1ceec42bb 100644 --- a/packages/python/plotly/test_requirements/requirements_37_core.txt +++ b/packages/python/plotly/test_requirements/requirements_37_core.txt @@ -1,10 +1,4 @@ requests==2.12.4 six==1.10.0 retrying==1.3.3 -pandas==0.24.2 -numpy==1.19.5 -xarray==0.10.9 -statsmodels==0.10.2 -pillow==5.2.0 pytest==3.5.1 -pytz==2016.10 From 8d83a813c19a79feaedb8ac01988ac2fd86b79d3 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 11:57:27 -0400 Subject: [PATCH 08/36] Move more px tests to optional --- .../plotly/plotly/tests/test_optional/test_autoshapes/__init__.py | 0 .../tests/{test_core => test_optional}/test_autoshapes/common.py | 0 .../test_autoshapes/test_annotated_shapes.py | 0 .../test_autoshapes/test_annotated_shapes_annotations.json | 0 .../test_autoshapes/test_axis_span_shapes.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 packages/python/plotly/plotly/tests/test_optional/test_autoshapes/__init__.py rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_autoshapes/common.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_autoshapes/test_annotated_shapes.py (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_autoshapes/test_annotated_shapes_annotations.json (100%) rename packages/python/plotly/plotly/tests/{test_core => test_optional}/test_autoshapes/test_axis_span_shapes.py (100%) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/__init__.py b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/python/plotly/plotly/tests/test_core/test_autoshapes/common.py b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/common.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_autoshapes/common.py rename to packages/python/plotly/plotly/tests/test_optional/test_autoshapes/common.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_autoshapes/test_annotated_shapes.py b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_annotated_shapes.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_autoshapes/test_annotated_shapes.py rename to packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_annotated_shapes.py diff --git a/packages/python/plotly/plotly/tests/test_core/test_autoshapes/test_annotated_shapes_annotations.json b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_annotated_shapes_annotations.json similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_autoshapes/test_annotated_shapes_annotations.json rename to packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_annotated_shapes_annotations.json diff --git a/packages/python/plotly/plotly/tests/test_core/test_autoshapes/test_axis_span_shapes.py b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_axis_span_shapes.py similarity index 100% rename from packages/python/plotly/plotly/tests/test_core/test_autoshapes/test_axis_span_shapes.py rename to packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_axis_span_shapes.py From 9a5c76f93ad0f1371f69feec138c68e26c3006ae Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 12:15:21 -0400 Subject: [PATCH 09/36] increase optional timeout --- .circleci/config.yml | 4 ++-- .../requirements_38_core.txt | 10 ++++++++ .../requirements_38_optional.txt | 23 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 packages/python/plotly/test_requirements/requirements_38_core.txt create mode 100644 packages/python/plotly/test_requirements/requirements_38_optional.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index e5d2b453e8c..ebdb52cdbc3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,7 @@ jobs: - run: name: Test optional command: "cd packages/python/plotly; pytest plotly/tests/test_optional" - no_output_timeout: 20m + no_output_timeout: 40m - run: name: Test utils command: "cd packages/python/plotly; pytest _plotly_utils/tests/" @@ -124,7 +124,7 @@ jobs: - run: name: Test optional command: "cd packages/python/plotly; pytest plotly/tests/test_optional" - no_output_timeout: 20m + no_output_timeout: 40m - run: name: Test utils command: "cd packages/python/plotly; pytest _plotly_utils/tests/" diff --git a/packages/python/plotly/test_requirements/requirements_38_core.txt b/packages/python/plotly/test_requirements/requirements_38_core.txt new file mode 100644 index 00000000000..e5b0625d058 --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_38_core.txt @@ -0,0 +1,10 @@ +requests==2.12.4 +six==1.10.0 +retrying==1.3.3 +pandas==0.24.2 +numpy==1.19.5 +xarray==0.10.9 +statsmodels==0.10.2 +pillow==5.2.0 +pytest==3.5.1 +pytz==2016.10 diff --git a/packages/python/plotly/test_requirements/requirements_38_optional.txt b/packages/python/plotly/test_requirements/requirements_38_optional.txt new file mode 100644 index 00000000000..8543b9dc61b --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_38_optional.txt @@ -0,0 +1,23 @@ +requests==2.12.4 +six==1.10.0 +retrying==1.3.3 +pandas==0.24.2 +numpy==1.19.5 +xarray==0.10.9 +statsmodels==0.10.2 +pillow==5.2.0 +pytest==3.5.1 +pytz==2016.10 + +--editable=./plotly-geo +ipython[all]==5.1.0 +ipywidgets==7.2.0 +ipykernel==4.8.2 +jupyter==1.0.0 +scipy==1.2.3 +shapely==1.7.0 +geopandas==0.3.0 +pyshp==1.2.10 +matplotlib==2.2.3 +scikit-image==0.14.4 +kaleido From 1014fda0a3162c34375cc462ba80e78b1e970477 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 12:21:43 -0400 Subject: [PATCH 10/36] Move another test with px to optional --- .../test_figure_messages/test_add_traces.py | 30 ------------------- .../test_subplots/test_make_subplots.py | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/python/plotly/plotly/tests/test_core/test_figure_messages/test_add_traces.py b/packages/python/plotly/plotly/tests/test_core/test_figure_messages/test_add_traces.py index 63f379bbcd8..77054fcc9de 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_figure_messages/test_add_traces.py +++ b/packages/python/plotly/plotly/tests/test_core/test_figure_messages/test_add_traces.py @@ -66,36 +66,6 @@ def test_add_traces(self): ) -class TestAddTracesRowsColsDataTypes(TestCase): - def test_add_traces_with_iterable(self): - import plotly.express as px - - df = px.data.tips() - fig = px.scatter(df, x="total_bill", y="tip", color="day") - from plotly.subplots import make_subplots - - fig2 = make_subplots(1, 2) - fig2.add_traces(fig.data, rows=[1,] * len(fig.data), cols=[1,] * len(fig.data)) - - expected_data_length = 4 - - self.assertEqual(expected_data_length, len(fig2.data)) - - def test_add_traces_with_integers(self): - import plotly.express as px - - df = px.data.tips() - fig = px.scatter(df, x="total_bill", y="tip", color="day") - from plotly.subplots import make_subplots - - fig2 = make_subplots(1, 2) - fig2.add_traces(fig.data, rows=1, cols=2) - - expected_data_length = 4 - - self.assertEqual(expected_data_length, len(fig2.data)) - - def test_add_trace_exclude_empty_subplots(): # Add traces fig = make_subplots(2, 2) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_subplots/test_make_subplots.py b/packages/python/plotly/plotly/tests/test_optional/test_subplots/test_make_subplots.py index 0edcacebd1e..09555497ac3 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_subplots/test_make_subplots.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_subplots/test_make_subplots.py @@ -16,3 +16,33 @@ def test_subplot_titles_numpy_array(self): subplot_titles=np.array(["", "Inset"]), ) self.assertEqual(fig, expected) + + +class TestAddTracesRowsColsDataTypes(TestCase): + def test_add_traces_with_iterable(self): + import plotly.express as px + + df = px.data.tips() + fig = px.scatter(df, x="total_bill", y="tip", color="day") + from plotly.subplots import make_subplots + + fig2 = make_subplots(1, 2) + fig2.add_traces(fig.data, rows=[1,] * len(fig.data), cols=[1,] * len(fig.data)) + + expected_data_length = 4 + + self.assertEqual(expected_data_length, len(fig2.data)) + + def test_add_traces_with_integers(self): + import plotly.express as px + + df = px.data.tips() + fig = px.scatter(df, x="total_bill", y="tip", color="day") + from plotly.subplots import make_subplots + + fig2 = make_subplots(1, 2) + fig2.add_traces(fig.data, rows=1, cols=2) + + expected_data_length = 4 + + self.assertEqual(expected_data_length, len(fig2.data)) From 3becff8a0939bdb4a569e62540c854fa3d9a10c0 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 12:22:04 -0400 Subject: [PATCH 11/36] blacken --- .../plotly/plotly/tests/test_core/test_utils/test_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/python/plotly/plotly/tests/test_core/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_core/test_utils/test_utils.py index cc5cb52e122..0aff7eb2817 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_core/test_utils/test_utils.py @@ -5,6 +5,7 @@ from plotly.utils import PlotlyJSONEncoder, get_by_path, node_generator import json as _json + class TestJSONEncoder(TestCase): def test_nan_to_null(self): array = [1, float("NaN"), float("Inf"), float("-Inf"), "platypus"] @@ -16,6 +17,7 @@ def test_invalid_encode_exception(self): with self.assertRaises(TypeError): _json.dumps({"a": {1}}, cls=PlotlyJSONEncoder) + class TestGetByPath(TestCase): def test_get_by_path(self): From 4effc4689d441b342b6dbdd0ff4901845c6b1e31 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 12:24:05 -0400 Subject: [PATCH 12/36] Fix relative import --- .../test_optional/test_autoshapes/test_annotated_shapes.py | 2 +- .../test_optional/test_autoshapes/test_axis_span_shapes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_annotated_shapes.py b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_annotated_shapes.py index 9c29282c942..8d7c3806991 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_annotated_shapes.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_annotated_shapes.py @@ -28,7 +28,7 @@ import sys import pytest import json -from common import _cmp_partial_dict, _check_figure_layout_objects +from .common import _cmp_partial_dict, _check_figure_layout_objects @pytest.fixture diff --git a/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_axis_span_shapes.py b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_axis_span_shapes.py index 4fef85fe338..12d36cf3c04 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_axis_span_shapes.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_autoshapes/test_axis_span_shapes.py @@ -3,7 +3,7 @@ from plotly.basedatatypes import _indexing_combinations import plotly.express as px import pytest -from common import _cmp_partial_dict, _check_figure_layout_objects +from .common import _cmp_partial_dict, _check_figure_layout_objects @pytest.fixture From 87d5d05565ee9a9f67d2be9cf3cad509d92bf10b Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 12:34:13 -0400 Subject: [PATCH 13/36] Move dependency check tests to optional --- .circleci/config.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ebdb52cdbc3..64af9d236ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,6 @@ jobs: python-3.7-core: docker: - image: circleci/python:3.7-stretch-node-browsers - steps: - checkout - run: @@ -42,12 +41,6 @@ jobs: name: Test core command: "cd packages/python/plotly; pytest plotly/tests/test_core" no_output_timeout: 20m - - run: - name: Test dependencdies not imported - command: "cd packages/python/plotly; pytest -x test_init/test_dependencies_not_imported.py" - - run: - name: Test lazy imports - command: "cd packages/python/plotly; pytest -x test_init/test_lazy_imports.py" python-3.7-percy: docker: @@ -133,6 +126,12 @@ jobs: name: Test io command: "cd packages/python/plotly; pytest plotly/tests/test_io" no_output_timeout: 20m + - run: + name: Test dependencdies not imported + command: "cd packages/python/plotly; pytest -x test_init/test_dependencies_not_imported.py" + - run: + name: Test lazy imports + command: "cd packages/python/plotly; pytest -x test_init/test_lazy_imports.py" # Chart studio python-3.7-chart_studio: @@ -201,12 +200,6 @@ jobs: name: Test core command: "cd packages/python/plotly; locale; pytest -k 'not nodev' plotly/tests/test_core" no_output_timeout: 20m - - run: - name: Test dependencdies not imported - command: "cd packages/python/plotly; locale; pytest -x -k 'not nodev' test_init/test_dependencies_not_imported.py" - - run: - name: Test lazy imports - command: "cd packages/python/plotly; locale; pytest -x -k 'not nodev' test_init/test_lazy_imports.py" - run: name: Commit command: | From ca57ddb41aebc53ead230c8e7ba3f0b271b6d1d4 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 12:49:26 -0400 Subject: [PATCH 14/36] more logging in optional test suite --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 64af9d236ab..a03c010e636 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -116,7 +116,7 @@ jobs: no_output_timeout: 20m - run: name: Test optional - command: "cd packages/python/plotly; pytest plotly/tests/test_optional" + command: "cd packages/python/plotly; pytest -s plotly/tests/test_optional" no_output_timeout: 40m - run: name: Test utils From 0b92a0eca4e22fbfbe407fc3bf9627f3737b7fd0 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 13:00:34 -0400 Subject: [PATCH 15/36] Don't open browser window in matplotlylib test --- .circleci/config.yml | 2 +- .../plotly/tests/test_optional/test_offline/test_offline.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a03c010e636..64af9d236ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -116,7 +116,7 @@ jobs: no_output_timeout: 20m - run: name: Test optional - command: "cd packages/python/plotly; pytest -s plotly/tests/test_optional" + command: "cd packages/python/plotly; pytest plotly/tests/test_optional" no_output_timeout: 40m - run: name: Test utils diff --git a/packages/python/plotly/plotly/tests/test_optional/test_offline/test_offline.py b/packages/python/plotly/plotly/tests/test_optional/test_offline/test_offline.py index d36934d1eae..a50fa4e7675 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_offline/test_offline.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_offline/test_offline.py @@ -40,6 +40,7 @@ def test_iplot_works_after_you_call_init_notebook_mode(self): @pytest.mark.matplotlib def test_iplot_mpl_works(self): + plotly.offline.init_notebook_mode() # Generate matplotlib plot for tests fig = plt.figure() From b759248a5c2b7cda7ee6616dc3c80fa0cce72b46 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 13:28:52 -0400 Subject: [PATCH 16/36] Add Python 3.8 and 3.9 tests The requirements.txt for these versions uses up-to-date dependency versions --- .circleci/config.yml | 83 +++++++++++++++++++ .../requirements_38_core.txt | 12 +-- .../requirements_38_optional.txt | 34 ++++---- .../requirements_39_core.txt | 4 + .../requirements_39_optional.txt | 23 +++++ 5 files changed, 130 insertions(+), 26 deletions(-) create mode 100644 packages/python/plotly/test_requirements/requirements_39_core.txt create mode 100644 packages/python/plotly/test_requirements/requirements_39_optional.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index 64af9d236ab..66b2eab6243 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,6 +42,32 @@ jobs: command: "cd packages/python/plotly; pytest plotly/tests/test_core" no_output_timeout: 20m + python-3.8-core: + docker: + - image: circleci/python:3.7-stretch-node-browsers + steps: + - checkout + - run: + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_38_core.txt" + - run: + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" + no_output_timeout: 20m + + python-3.9-core: + docker: + - image: circleci/python:3.7-stretch-node-browsers + steps: + - checkout + - run: + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_39_core.txt" + - run: + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" + no_output_timeout: 20m + python-3.7-percy: docker: - image: circleci/python:3.7-stretch-node-browsers @@ -133,6 +159,59 @@ jobs: name: Test lazy imports command: "cd packages/python/plotly; pytest -x test_init/test_lazy_imports.py" + + python-3.8-optional: + docker: + - image: circleci/python:3.6-stretch-node-browsers + + steps: + - checkout + - run: + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_38_optional.txt" + - run: + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" + no_output_timeout: 20m + - run: + name: Test optional + command: "cd packages/python/plotly; pytest plotly/tests/test_optional" + no_output_timeout: 40m + - run: + name: Test utils + command: "cd packages/python/plotly; pytest _plotly_utils/tests/" + no_output_timeout: 20m + - run: + name: Test io + command: "cd packages/python/plotly; pytest plotly/tests/test_io" + no_output_timeout: 20m + + python-3.9-optional: + docker: + - image: circleci/python:3.6-stretch-node-browsers + + steps: + - checkout + - run: + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_39_optional.txt" + - run: + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" + no_output_timeout: 20m + - run: + name: Test optional + command: "cd packages/python/plotly; pytest plotly/tests/test_optional" + no_output_timeout: 40m + - run: + name: Test utils + command: "cd packages/python/plotly; pytest _plotly_utils/tests/" + no_output_timeout: 20m + - run: + name: Test io + command: "cd packages/python/plotly; pytest plotly/tests/test_io" + no_output_timeout: 20m + # Chart studio python-3.7-chart_studio: docker: @@ -378,9 +457,13 @@ workflows: jobs: - python-3.6-core - python-3.7-core + - python-3.8-core + - python-3.9-core - python-3.7-percy - python-3.6-optional - python-3.7-optional + - python-3.8-optional + - python-3.9-optional - python-3.7-chart_studio - python-3-7-orca - build-doc diff --git a/packages/python/plotly/test_requirements/requirements_38_core.txt b/packages/python/plotly/test_requirements/requirements_38_core.txt index e5b0625d058..ef17e3ca055 100644 --- a/packages/python/plotly/test_requirements/requirements_38_core.txt +++ b/packages/python/plotly/test_requirements/requirements_38_core.txt @@ -1,10 +1,4 @@ -requests==2.12.4 -six==1.10.0 +requests==2.25.1 +six==1.15.0 retrying==1.3.3 -pandas==0.24.2 -numpy==1.19.5 -xarray==0.10.9 -statsmodels==0.10.2 -pillow==5.2.0 -pytest==3.5.1 -pytz==2016.10 +pytest==6.2.3 diff --git a/packages/python/plotly/test_requirements/requirements_38_optional.txt b/packages/python/plotly/test_requirements/requirements_38_optional.txt index 8543b9dc61b..e57034c7330 100644 --- a/packages/python/plotly/test_requirements/requirements_38_optional.txt +++ b/packages/python/plotly/test_requirements/requirements_38_optional.txt @@ -1,23 +1,23 @@ -requests==2.12.4 -six==1.10.0 +requests==2.25.1 +six==1.15.0 retrying==1.3.3 -pandas==0.24.2 -numpy==1.19.5 -xarray==0.10.9 -statsmodels==0.10.2 -pillow==5.2.0 -pytest==3.5.1 -pytz==2016.10 +pandas==1.2.4 +numpy==1.20.2 +xarray==0.17.0 +statsmodels +Pillow==8.2.0 +pytest==6.2.3 +pytz==2021.1 --editable=./plotly-geo -ipython[all]==5.1.0 -ipywidgets==7.2.0 -ipykernel==4.8.2 +ipython[all]==7.22.0 +ipywidgets==7.6.3 +ipykernel==5.5.3 jupyter==1.0.0 -scipy==1.2.3 -shapely==1.7.0 -geopandas==0.3.0 -pyshp==1.2.10 +scipy==1.6.2 +Shapely==1.7.1 +geopandas==0.9.0 +pyshp==2.1.3 matplotlib==2.2.3 -scikit-image==0.14.4 +scikit-image==0.18.1 kaleido diff --git a/packages/python/plotly/test_requirements/requirements_39_core.txt b/packages/python/plotly/test_requirements/requirements_39_core.txt new file mode 100644 index 00000000000..ef17e3ca055 --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_39_core.txt @@ -0,0 +1,4 @@ +requests==2.25.1 +six==1.15.0 +retrying==1.3.3 +pytest==6.2.3 diff --git a/packages/python/plotly/test_requirements/requirements_39_optional.txt b/packages/python/plotly/test_requirements/requirements_39_optional.txt new file mode 100644 index 00000000000..e57034c7330 --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_39_optional.txt @@ -0,0 +1,23 @@ +requests==2.25.1 +six==1.15.0 +retrying==1.3.3 +pandas==1.2.4 +numpy==1.20.2 +xarray==0.17.0 +statsmodels +Pillow==8.2.0 +pytest==6.2.3 +pytz==2021.1 + +--editable=./plotly-geo +ipython[all]==7.22.0 +ipywidgets==7.6.3 +ipykernel==5.5.3 +jupyter==1.0.0 +scipy==1.6.2 +Shapely==1.7.1 +geopandas==0.9.0 +pyshp==2.1.3 +matplotlib==2.2.3 +scikit-image==0.18.1 +kaleido From 8d013d1de1df5efdc7b63c87d4ce8a7c45a64f1d Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 13:32:04 -0400 Subject: [PATCH 17/36] pull dependencies for conda test case from same option requirements.txt as the other tests --- .circleci/create_conda_optional_env.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index 17f3c999af8..01718e8be5a 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -15,9 +15,11 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then # Create environment # PYTHON_VERSION=2.7 or 3.5 - $HOME/miniconda/bin/conda create -n circle_optional --yes python=$PYTHON_VERSION \ -requests nbformat six retrying psutil pandas decorator pytest mock nose poppler xarray scikit-image ipython jupyter ipykernel ipywidgets statsmodels + $HOME/miniconda/bin/conda create -n circle_optional --yes python=$PYTHON_VERSION # Install orca into environment $HOME/miniconda/bin/conda install --yes -n circle_optional -c plotly plotly-orca==1.3.1 + + # Install additional dependencies + pip install -r ./packages/python/plotly/test_requirements/requirements_38_optional.txt fi From 7bdfcb097aed22e3d909af73d1b88227ef7f1d79 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 13:49:11 -0400 Subject: [PATCH 18/36] fix indentation --- .circleci/config.yml | 105 +++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 53 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 66b2eab6243..ceadbdc6f27 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,7 @@ jobs: python-3.8-core: docker: - - image: circleci/python:3.7-stretch-node-browsers + - image: circleci/python:3.8-stretch-node-browsers steps: - checkout - run: @@ -57,7 +57,7 @@ jobs: python-3.9-core: docker: - - image: circleci/python:3.7-stretch-node-browsers + - image: circleci/python:3.9-stretch-node-browsers steps: - checkout - run: @@ -159,58 +159,57 @@ jobs: name: Test lazy imports command: "cd packages/python/plotly; pytest -x test_init/test_lazy_imports.py" + python-3.8-optional: + docker: + - image: circleci/python:3.8-stretch-node-browsers + + steps: + - checkout + - run: + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_38_optional.txt" + - run: + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" + no_output_timeout: 20m + - run: + name: Test optional + command: "cd packages/python/plotly; pytest plotly/tests/test_optional" + no_output_timeout: 40m + - run: + name: Test utils + command: "cd packages/python/plotly; pytest _plotly_utils/tests/" + no_output_timeout: 20m + - run: + name: Test io + command: "cd packages/python/plotly; pytest plotly/tests/test_io" + no_output_timeout: 20m + + python-3.9-optional: + docker: + - image: circleci/python:3.9-stretch-node-browsers - python-3.8-optional: - docker: - - image: circleci/python:3.6-stretch-node-browsers - - steps: - - checkout - - run: - name: Install dependencies - command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_38_optional.txt" - - run: - name: Test core - command: "cd packages/python/plotly; pytest plotly/tests/test_core" - no_output_timeout: 20m - - run: - name: Test optional - command: "cd packages/python/plotly; pytest plotly/tests/test_optional" - no_output_timeout: 40m - - run: - name: Test utils - command: "cd packages/python/plotly; pytest _plotly_utils/tests/" - no_output_timeout: 20m - - run: - name: Test io - command: "cd packages/python/plotly; pytest plotly/tests/test_io" - no_output_timeout: 20m - - python-3.9-optional: - docker: - - image: circleci/python:3.6-stretch-node-browsers - - steps: - - checkout - - run: - name: Install dependencies - command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_39_optional.txt" - - run: - name: Test core - command: "cd packages/python/plotly; pytest plotly/tests/test_core" - no_output_timeout: 20m - - run: - name: Test optional - command: "cd packages/python/plotly; pytest plotly/tests/test_optional" - no_output_timeout: 40m - - run: - name: Test utils - command: "cd packages/python/plotly; pytest _plotly_utils/tests/" - no_output_timeout: 20m - - run: - name: Test io - command: "cd packages/python/plotly; pytest plotly/tests/test_io" - no_output_timeout: 20m + steps: + - checkout + - run: + name: Install dependencies + command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_39_optional.txt" + - run: + name: Test core + command: "cd packages/python/plotly; pytest plotly/tests/test_core" + no_output_timeout: 20m + - run: + name: Test optional + command: "cd packages/python/plotly; pytest plotly/tests/test_optional" + no_output_timeout: 40m + - run: + name: Test utils + command: "cd packages/python/plotly; pytest _plotly_utils/tests/" + no_output_timeout: 20m + - run: + name: Test io + command: "cd packages/python/plotly; pytest plotly/tests/test_io" + no_output_timeout: 20m # Chart studio python-3.7-chart_studio: From 8d2ac6e939ca792e59c31e6cdcdf60e99765159a Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 13:49:25 -0400 Subject: [PATCH 19/36] Activate conda environment before pip install --- .circleci/create_conda_optional_env.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index 01718e8be5a..ba27b9759f8 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -21,5 +21,6 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then $HOME/miniconda/bin/conda install --yes -n circle_optional -c plotly plotly-orca==1.3.1 # Install additional dependencies + $HOME/miniconda/bin/conda activate -n circle_optional pip install -r ./packages/python/plotly/test_requirements/requirements_38_optional.txt fi From 0c85dc5421934efd1289da77c90e36cd182c27de Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 13:53:18 -0400 Subject: [PATCH 20/36] Fix 3.8/3.9 ci images --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ceadbdc6f27..9de0fb0baa3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,7 @@ jobs: python-3.8-core: docker: - - image: circleci/python:3.8-stretch-node-browsers + - image: circleci/python:3.8-buster-node-browsers steps: - checkout - run: @@ -57,7 +57,7 @@ jobs: python-3.9-core: docker: - - image: circleci/python:3.9-stretch-node-browsers + - image: circleci/python:3.9-buster-node-browsers steps: - checkout - run: @@ -161,7 +161,7 @@ jobs: python-3.8-optional: docker: - - image: circleci/python:3.8-stretch-node-browsers + - image: circleci/python:3.8-buster-node-browsers steps: - checkout @@ -187,7 +187,7 @@ jobs: python-3.9-optional: docker: - - image: circleci/python:3.9-stretch-node-browsers + - image: circleci/python:3.9-buster-node-browsers steps: - checkout From bf1d1d844f8ac4c3a305adb9fe9e41ba5b6bdcc8 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 13:56:46 -0400 Subject: [PATCH 21/36] Try again with pip install in conda environment --- .circleci/create_conda_optional_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index ba27b9759f8..d7185fe3211 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -22,5 +22,5 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then # Install additional dependencies $HOME/miniconda/bin/conda activate -n circle_optional - pip install -r ./packages/python/plotly/test_requirements/requirements_38_optional.txt + $HOME/miniconda/bin/pip install -r ./packages/python/plotly/test_requirements/requirements_38_optional.txt fi From 6c10e9b5dd5077d0d913c0c1591e37b2e5a18e64 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:04:17 -0400 Subject: [PATCH 22/36] Set pandas plotting backend explicitly --- .../plotly/plotly/tests/test_optional/test_utils/test_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py index c91d82e1410..498d64fc630 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py @@ -451,6 +451,8 @@ def test_no_numpy_int_type(self): @pytest.mark.matplotlib def test_masked_constants_example(): + pd.options.plotting.backend = 'matplotlib' + # example from: https://gist.github.com/tschaume/d123d56bf586276adb98 data = { "esN": [0, 1, 2, 3], From 7820bbcca38c3038f211292f0b37fa01eb0914e9 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:13:06 -0400 Subject: [PATCH 23/36] Fix working directory on pip install --- .circleci/create_conda_optional_env.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index d7185fe3211..df936f674e8 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -22,5 +22,6 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then # Install additional dependencies $HOME/miniconda/bin/conda activate -n circle_optional + cd packages/python/ $HOME/miniconda/bin/pip install -r ./packages/python/plotly/test_requirements/requirements_38_optional.txt fi From 821231c2663fb6fd2776d7cd357a0e90537460eb Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:13:31 -0400 Subject: [PATCH 24/36] Don't fail on old versions of pandas --- .../plotly/tests/test_optional/test_utils/test_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py index 498d64fc630..584b76818e3 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py @@ -451,7 +451,11 @@ def test_no_numpy_int_type(self): @pytest.mark.matplotlib def test_masked_constants_example(): - pd.options.plotting.backend = 'matplotlib' + from pandas.errors import OptionError + try: + pd.options.plotting.backend = 'matplotlib' + except OptionError: + pass # example from: https://gist.github.com/tschaume/d123d56bf586276adb98 data = { From 331118e7f2e78bbf824a56eaf327f7c3f2eca04a Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:17:36 -0400 Subject: [PATCH 25/36] path fix --- .circleci/create_conda_optional_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index df936f674e8..754576fb742 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -23,5 +23,5 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then # Install additional dependencies $HOME/miniconda/bin/conda activate -n circle_optional cd packages/python/ - $HOME/miniconda/bin/pip install -r ./packages/python/plotly/test_requirements/requirements_38_optional.txt + $HOME/miniconda/bin/pip install -r ./plotly/test_requirements/requirements_38_optional.txt fi From 8623079c7788d4161c41475aa778ba0b67fdaf00 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:18:32 -0400 Subject: [PATCH 26/36] Don't fail on any exception when setting pandas backend --- .../plotly/plotly/tests/test_optional/test_utils/test_utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py index 584b76818e3..13dc20be8d3 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py @@ -451,10 +451,9 @@ def test_no_numpy_int_type(self): @pytest.mark.matplotlib def test_masked_constants_example(): - from pandas.errors import OptionError try: pd.options.plotting.backend = 'matplotlib' - except OptionError: + except Exception: pass # example from: https://gist.github.com/tschaume/d123d56bf586276adb98 From cb0ff7ce741395bafe3a8c4f1c8f82efda590b72 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:21:37 -0400 Subject: [PATCH 27/36] blacken --- .../plotly/plotly/tests/test_optional/test_utils/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py index 13dc20be8d3..3145c0cb139 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py @@ -452,7 +452,7 @@ def test_no_numpy_int_type(self): @pytest.mark.matplotlib def test_masked_constants_example(): try: - pd.options.plotting.backend = 'matplotlib' + pd.options.plotting.backend = "matplotlib" except Exception: pass From e0b6ce509af17e3d591b296f1c7379c05cfcb53c Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:25:00 -0400 Subject: [PATCH 28/36] Another try --- .circleci/create_conda_optional_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index 754576fb742..8c9a55f53bb 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -23,5 +23,5 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then # Install additional dependencies $HOME/miniconda/bin/conda activate -n circle_optional cd packages/python/ - $HOME/miniconda/bin/pip install -r ./plotly/test_requirements/requirements_38_optional.txt + $HOME/miniconda/bin/python -m pip install -r ./plotly/test_requirements/requirements_38_optional.txt fi From 94cdd999d969bf3a9bd96e9e099d02d8378f7041 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:31:40 -0400 Subject: [PATCH 29/36] Another try --- .circleci/create_conda_optional_env.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index 8c9a55f53bb..49d4c6db1a2 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -21,7 +21,8 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then $HOME/miniconda/bin/conda install --yes -n circle_optional -c plotly plotly-orca==1.3.1 # Install additional dependencies - $HOME/miniconda/bin/conda activate -n circle_optional + . /home/circleci/miniconda/etc/profile.d/conda.sh + conda activate circle_optional cd packages/python/ $HOME/miniconda/bin/python -m pip install -r ./plotly/test_requirements/requirements_38_optional.txt fi From b0724781c551d253f1822138653afe860667bdb3 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:38:19 -0400 Subject: [PATCH 30/36] pip install into the right conda environment. --- .circleci/create_conda_optional_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index 49d4c6db1a2..47a7625b480 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -24,5 +24,5 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then . /home/circleci/miniconda/etc/profile.d/conda.sh conda activate circle_optional cd packages/python/ - $HOME/miniconda/bin/python -m pip install -r ./plotly/test_requirements/requirements_38_optional.txt + python -m pip install -r ./plotly/test_requirements/requirements_38_optional.txt fi From 1f37f165f70ba21aace80f05824c98f40d63564b Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:45:26 -0400 Subject: [PATCH 31/36] Add psutil as optional dependency for orca tests --- .../python/plotly/test_requirements/requirements_36_optional.txt | 1 + .../python/plotly/test_requirements/requirements_38_optional.txt | 1 + .../python/plotly/test_requirements/requirements_39_optional.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/packages/python/plotly/test_requirements/requirements_36_optional.txt b/packages/python/plotly/test_requirements/requirements_36_optional.txt index 8543b9dc61b..2b74f16c3ae 100644 --- a/packages/python/plotly/test_requirements/requirements_36_optional.txt +++ b/packages/python/plotly/test_requirements/requirements_36_optional.txt @@ -20,4 +20,5 @@ geopandas==0.3.0 pyshp==1.2.10 matplotlib==2.2.3 scikit-image==0.14.4 +psutil==5.7.0 kaleido diff --git a/packages/python/plotly/test_requirements/requirements_38_optional.txt b/packages/python/plotly/test_requirements/requirements_38_optional.txt index e57034c7330..1757420e15e 100644 --- a/packages/python/plotly/test_requirements/requirements_38_optional.txt +++ b/packages/python/plotly/test_requirements/requirements_38_optional.txt @@ -20,4 +20,5 @@ geopandas==0.9.0 pyshp==2.1.3 matplotlib==2.2.3 scikit-image==0.18.1 +psutil==5.7.0 kaleido diff --git a/packages/python/plotly/test_requirements/requirements_39_optional.txt b/packages/python/plotly/test_requirements/requirements_39_optional.txt index e57034c7330..1757420e15e 100644 --- a/packages/python/plotly/test_requirements/requirements_39_optional.txt +++ b/packages/python/plotly/test_requirements/requirements_39_optional.txt @@ -20,4 +20,5 @@ geopandas==0.9.0 pyshp==2.1.3 matplotlib==2.2.3 scikit-image==0.18.1 +psutil==5.7.0 kaleido From 2ac4f63f9df497682b0d9ae5d777c356eaab267e Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:50:59 -0400 Subject: [PATCH 32/36] Add requirement.txt to conda ci job cache key --- .circleci/config.yml | 2 +- .circleci/create_conda_optional_env.sh | 2 +- .../plotly/test_requirements/requirements_37_optional.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9de0fb0baa3..34ffbca9d64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -236,7 +236,7 @@ jobs: - checkout - restore_cache: keys: - - conda-37-v1-{{ checksum ".circleci/create_conda_optional_env.sh" }} + - conda-37-v1-{{ checksum ".circleci/create_conda_optional_env.sh" }}-{{ checksum "packages/python/plotly/test_requirements/requirements_37_optional.txt" }} - run: name: Create conda environment command: .circleci/create_conda_optional_env.sh diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index 47a7625b480..b8050133857 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -24,5 +24,5 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then . /home/circleci/miniconda/etc/profile.d/conda.sh conda activate circle_optional cd packages/python/ - python -m pip install -r ./plotly/test_requirements/requirements_38_optional.txt + python -m pip install -r ./plotly/test_requirements/requirements_37_optional.txt fi diff --git a/packages/python/plotly/test_requirements/requirements_37_optional.txt b/packages/python/plotly/test_requirements/requirements_37_optional.txt index 8543b9dc61b..2b74f16c3ae 100644 --- a/packages/python/plotly/test_requirements/requirements_37_optional.txt +++ b/packages/python/plotly/test_requirements/requirements_37_optional.txt @@ -20,4 +20,5 @@ geopandas==0.3.0 pyshp==1.2.10 matplotlib==2.2.3 scikit-image==0.14.4 +psutil==5.7.0 kaleido From ddb274191967701e55b30b19e3b536b3a1172823 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 14:59:55 -0400 Subject: [PATCH 33/36] Add poppler to orca tests --- .circleci/create_conda_optional_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index b8050133857..a5bac72c06c 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -15,7 +15,7 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then # Create environment # PYTHON_VERSION=2.7 or 3.5 - $HOME/miniconda/bin/conda create -n circle_optional --yes python=$PYTHON_VERSION + $HOME/miniconda/bin/conda create -n circle_optional --yes python=$PYTHON_VERSION poppler # Install orca into environment $HOME/miniconda/bin/conda install --yes -n circle_optional -c plotly plotly-orca==1.3.1 From 408067746b20fb2de71ea5d2d74ef395d17f25c2 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 15:15:16 -0400 Subject: [PATCH 34/36] Try reverting orca environment --- .circleci/create_conda_optional_env.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index a5bac72c06c..17f3c999af8 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -15,14 +15,9 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then # Create environment # PYTHON_VERSION=2.7 or 3.5 - $HOME/miniconda/bin/conda create -n circle_optional --yes python=$PYTHON_VERSION poppler + $HOME/miniconda/bin/conda create -n circle_optional --yes python=$PYTHON_VERSION \ +requests nbformat six retrying psutil pandas decorator pytest mock nose poppler xarray scikit-image ipython jupyter ipykernel ipywidgets statsmodels # Install orca into environment $HOME/miniconda/bin/conda install --yes -n circle_optional -c plotly plotly-orca==1.3.1 - - # Install additional dependencies - . /home/circleci/miniconda/etc/profile.d/conda.sh - conda activate circle_optional - cd packages/python/ - python -m pip install -r ./plotly/test_requirements/requirements_37_optional.txt fi From 44f8dd60a12f218a37aea74ce88c53db2cb5ffa1 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 15:15:42 -0400 Subject: [PATCH 35/36] disable non-orca tests --- .circleci/config.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 34ffbca9d64..889586c53ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -454,15 +454,15 @@ workflows: build: jobs: - - python-3.6-core - - python-3.7-core - - python-3.8-core - - python-3.9-core - - python-3.7-percy - - python-3.6-optional - - python-3.7-optional - - python-3.8-optional - - python-3.9-optional - - python-3.7-chart_studio +# - python-3.6-core +# - python-3.7-core +# - python-3.8-core +# - python-3.9-core +# - python-3.7-percy +# - python-3.6-optional +# - python-3.7-optional +# - python-3.8-optional +# - python-3.9-optional +# - python-3.7-chart_studio - python-3-7-orca - - build-doc +# - build-doc From 620435426f733b988014882dece7c6e590251640 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Wed, 21 Apr 2021 15:21:18 -0400 Subject: [PATCH 36/36] Enable other CI tests --- .circleci/config.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 889586c53ef..34ffbca9d64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -454,15 +454,15 @@ workflows: build: jobs: -# - python-3.6-core -# - python-3.7-core -# - python-3.8-core -# - python-3.9-core -# - python-3.7-percy -# - python-3.6-optional -# - python-3.7-optional -# - python-3.8-optional -# - python-3.9-optional -# - python-3.7-chart_studio + - python-3.6-core + - python-3.7-core + - python-3.8-core + - python-3.9-core + - python-3.7-percy + - python-3.6-optional + - python-3.7-optional + - python-3.8-optional + - python-3.9-optional + - python-3.7-chart_studio - python-3-7-orca -# - build-doc + - build-doc