From cc2f230dc1685fb4e98361e58632bd47c9e2502c Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Tue, 17 Nov 2020 12:27:48 -0800 Subject: [PATCH 01/10] replaced retrying dependency with tenacity in plotly package --- packages/python/plotly/plotly/io/_orca.py | 10 +++++----- packages/python/plotly/recipe/meta.yaml | 2 +- packages/python/plotly/requirements.txt | 2 +- packages/python/plotly/setup.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/python/plotly/plotly/io/_orca.py b/packages/python/plotly/plotly/io/_orca.py index 500674b6281..f5404d81798 100644 --- a/packages/python/plotly/plotly/io/_orca.py +++ b/packages/python/plotly/plotly/io/_orca.py @@ -11,7 +11,7 @@ from copy import copy from contextlib import contextmanager -import retrying +import tenacity from six import string_types import _plotly_utils.utils @@ -1173,11 +1173,11 @@ def validate_executable(): >>> import plotly.io as pio >>> pio.orca.config.use_xvfb = True - + You can save this configuration for use in future sessions as follows: - >>> pio.orca.config.save() - + >>> pio.orca.config.save() + See https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml for more info on Xvfb """ @@ -1451,7 +1451,7 @@ def ensure_server(): orca_state["shutdown_timer"] = t -@retrying.retry(wait_random_min=5, wait_random_max=10, stop_max_delay=60000) +@tenacity.retry(wait=tenacity.wait.wait_random(min=5, max=10), stop=tenacity.stop.stop_after_delay(60000)) def request_image_with_retrying(**kwargs): """ Helper method to perform an image request to a running orca server process diff --git a/packages/python/plotly/recipe/meta.yaml b/packages/python/plotly/recipe/meta.yaml index 2110405d335..cbb2683d1e4 100644 --- a/packages/python/plotly/recipe/meta.yaml +++ b/packages/python/plotly/recipe/meta.yaml @@ -24,7 +24,7 @@ requirements: - setuptools run: - python - - retrying >=1.3.3 + - tenacity >=6.2.0 - six test: diff --git a/packages/python/plotly/requirements.txt b/packages/python/plotly/requirements.txt index 496204893c7..cbc5aa4986e 100644 --- a/packages/python/plotly/requirements.txt +++ b/packages/python/plotly/requirements.txt @@ -9,4 +9,4 @@ six==1.8.0 ## retrying requests ## -retrying==1.3.3 +tenacity>=6.2.0 diff --git a/packages/python/plotly/setup.py b/packages/python/plotly/setup.py index 395111c03e9..566d0c2c6ba 100644 --- a/packages/python/plotly/setup.py +++ b/packages/python/plotly/setup.py @@ -505,7 +505,7 @@ def run(self): ), ("etc/jupyter/nbconfig/notebook.d", ["plotlywidget.json"]), ], - install_requires=["retrying>=1.3.3", "six"], + install_requires=["tenacity>=6.2.0", "six"], zip_safe=False, cmdclass=dict( build_py=js_prerelease(versioneer_cmds["build_py"]), From dc0412c570a8811287180cc443febd9114f0af08 Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Mon, 7 Dec 2020 08:56:16 -0800 Subject: [PATCH 02/10] Replaced retrying depedency in chart-studio with tenacity. Updated create_conda_optional_env.sh to reflect change in dependencies. Reformated _orca.py with black. --- .circleci/config.yml | 2 +- .circleci/create_conda_optional_env.sh | 2 +- .../python/chart-studio/chart_studio/api/v2/utils.py | 11 +++++------ packages/python/chart-studio/setup.py | 2 +- packages/python/chart-studio/tox.ini | 2 +- packages/python/plotly/plotly/io/_orca.py | 5 ++++- packages/python/plotly/tox.ini | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fae56c4ceae..c80a69b5129 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -327,7 +327,7 @@ jobs: - checkout - run: name: Install tox - command: "sudo pip install retrying tox black inflect" + command: "sudo pip install tenacity tox black inflect" - run: name: Update jupyterlab-plotly version command: "cd packages/python/plotly; python setup.py updateplotlywidgetversion" diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index 17f3c999af8..0da94234e84 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -16,7 +16,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 \ -requests nbformat six retrying psutil pandas decorator pytest mock nose poppler xarray scikit-image ipython jupyter ipykernel ipywidgets statsmodels +requests nbformat six tenacity 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 diff --git a/packages/python/chart-studio/chart_studio/api/v2/utils.py b/packages/python/chart-studio/chart_studio/api/v2/utils.py index 4c022957293..e859ac889a9 100644 --- a/packages/python/chart-studio/chart_studio/api/v2/utils.py +++ b/packages/python/chart-studio/chart_studio/api/v2/utils.py @@ -3,7 +3,7 @@ import requests import json as _json from requests.exceptions import RequestException -from retrying import retry +import tenacity import _plotly_utils.exceptions from chart_studio import config, exceptions @@ -129,11 +129,10 @@ def should_retry(exception): return False -@retry( - wait_exponential_multiplier=1000, - wait_exponential_max=16000, - stop_max_delay=180000, - retry_on_exception=should_retry, +@tenacity.retry( + wait=tenacity.wait.wait_exponential(multiplier=1000, max=16000), + stop=tenacity.stop.stop_after_delay(180000), + retry=tenacity.retry.retry_if_exception(should_retry), ) def request(method, url, **kwargs): """ diff --git a/packages/python/chart-studio/setup.py b/packages/python/chart-studio/setup.py index 556c8e144d6..047b2c75275 100644 --- a/packages/python/chart-studio/setup.py +++ b/packages/python/chart-studio/setup.py @@ -41,6 +41,6 @@ def readme(): "chart_studio.plotly.chunked_requests", "chart_studio.presentation_objs", ], - install_requires=["plotly", "requests", "retrying>=1.3.3", "six"], + install_requires=["plotly", "requests", "tenacity>=6.2.0", "six"], zip_safe=False, ) diff --git a/packages/python/chart-studio/tox.ini b/packages/python/chart-studio/tox.ini index faddb36305f..3cdc529de2e 100644 --- a/packages/python/chart-studio/tox.ini +++ b/packages/python/chart-studio/tox.ini @@ -56,7 +56,7 @@ deps= requests==2.12.4 six==1.10.0 pytz==2016.10 - retrying==1.3.3 + tenacity==6.2.0 pytest==3.5.1 backports.tempfile==1.0 pandas==0.23.2 diff --git a/packages/python/plotly/plotly/io/_orca.py b/packages/python/plotly/plotly/io/_orca.py index f5404d81798..7887e6ced73 100644 --- a/packages/python/plotly/plotly/io/_orca.py +++ b/packages/python/plotly/plotly/io/_orca.py @@ -1451,7 +1451,10 @@ def ensure_server(): orca_state["shutdown_timer"] = t -@tenacity.retry(wait=tenacity.wait.wait_random(min=5, max=10), stop=tenacity.stop.stop_after_delay(60000)) +@tenacity.retry( + wait=tenacity.wait.wait_random(min=5, max=10), + stop=tenacity.stop.stop_after_delay(60000), +) def request_image_with_retrying(**kwargs): """ Helper method to perform an image request to a running orca server process diff --git a/packages/python/plotly/tox.ini b/packages/python/plotly/tox.ini index 72169192a08..f27db05b7f5 100644 --- a/packages/python/plotly/tox.ini +++ b/packages/python/plotly/tox.ini @@ -55,7 +55,7 @@ deps= requests==2.12.4 six==1.10.0 pytz==2016.10 - retrying==1.3.3 + tenacity==6.2.0 pytest==3.5.1 pandas==0.24.2 xarray==0.10.9 From a47e932e8b83eeccf8ce8f078b98c648c5a7d978 Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Mon, 7 Dec 2020 09:21:00 -0800 Subject: [PATCH 03/10] Simplified tenacity code and fixed mistake with tenacity retry_if_exception. --- packages/python/chart-studio/chart_studio/api/v2/utils.py | 6 +++--- packages/python/plotly/plotly/io/_orca.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/python/chart-studio/chart_studio/api/v2/utils.py b/packages/python/chart-studio/chart_studio/api/v2/utils.py index e859ac889a9..29d44df7932 100644 --- a/packages/python/chart-studio/chart_studio/api/v2/utils.py +++ b/packages/python/chart-studio/chart_studio/api/v2/utils.py @@ -130,9 +130,9 @@ def should_retry(exception): @tenacity.retry( - wait=tenacity.wait.wait_exponential(multiplier=1000, max=16000), - stop=tenacity.stop.stop_after_delay(180000), - retry=tenacity.retry.retry_if_exception(should_retry), + wait=tenacity.wait_exponential(multiplier=1000, max=16000), + stop=tenacity.stop_after_delay(180000), + retry=tenacity.retry_if_exception(should_retry), ) def request(method, url, **kwargs): """ diff --git a/packages/python/plotly/plotly/io/_orca.py b/packages/python/plotly/plotly/io/_orca.py index 7887e6ced73..63152739f17 100644 --- a/packages/python/plotly/plotly/io/_orca.py +++ b/packages/python/plotly/plotly/io/_orca.py @@ -1452,8 +1452,7 @@ def ensure_server(): @tenacity.retry( - wait=tenacity.wait.wait_random(min=5, max=10), - stop=tenacity.stop.stop_after_delay(60000), + wait=tenacity.wait_random(min=5, max=10), stop=tenacity.stop_after_delay(60000), ) def request_image_with_retrying(**kwargs): """ From 62584347d350268befb8d3d4b442284e0455354a Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Mon, 7 Dec 2020 10:29:27 -0800 Subject: [PATCH 04/10] added jinja templates to fix nbconvert incompatibility in CircleCI --- doc/basic.tpl | 249 +++++++++++++++++++++++++++++++++++++++ doc/celltags.tpl | 7 ++ doc/display_priority.tpl | 46 ++++++++ doc/null.tpl | 97 +++++++++++++++ 4 files changed, 399 insertions(+) create mode 100644 doc/basic.tpl create mode 100644 doc/celltags.tpl create mode 100644 doc/display_priority.tpl create mode 100644 doc/null.tpl diff --git a/doc/basic.tpl b/doc/basic.tpl new file mode 100644 index 00000000000..d87efafac0e --- /dev/null +++ b/doc/basic.tpl @@ -0,0 +1,249 @@ +{%- extends 'display_priority.tpl' -%} +{% from 'celltags.tpl' import celltags %} + +{% block codecell %} +
+{{ super() }} +
+{%- endblock codecell %} + +{% block input_group -%} +
+{{ super() }} +
+{% endblock input_group %} + +{% block output_group %} +
+
+{{ super() }} +
+
+{% endblock output_group %} + +{% block in_prompt -%} +
+ {%- if cell.execution_count is defined -%} + In [{{ cell.execution_count|replace(None, " ") }}]: + {%- else -%} + In [ ]: + {%- endif -%} +
+{%- endblock in_prompt %} + +{% block empty_in_prompt -%} +
+
+{%- endblock empty_in_prompt %} + +{# + output_prompt doesn't do anything in HTML, + because there is a prompt div in each output area (see output block) +#} +{% block output_prompt %} +{% endblock output_prompt %} +{% block input %} +
+
+{{ cell.source | highlight_code(metadata=cell.metadata) }} +
+
+{%- endblock input %} +{% block output_area_prompt %} +{%- if output.output_type == 'execute_result' -%} +
+ {%- if cell.execution_count is defined -%} + Out[{{ cell.execution_count|replace(None, " ") }}]: + {%- else -%} + Out[ ]: + {%- endif -%} +{%- else -%} +
+{%- endif -%} +
+{% endblock output_area_prompt %} +{% block output %} +
+{% if resources.global_content_filter.include_output_prompt %} + {{ self.output_area_prompt() }} +{% endif %} +{{ super() }} +
+{% endblock output %} +{% block markdowncell scoped %} +
+{%- if resources.global_content_filter.include_input_prompt-%} + {{ self.empty_in_prompt() }} +{%- endif -%} +
+
+{{ cell.source | markdown2html | strip_files_prefix }} +
+
+
+{%- endblock markdowncell %} +{% block unknowncell scoped %} +unknown type {{ cell.type }} +{% endblock unknowncell %} +{% block execute_result -%} +{%- set extra_class="output_execute_result" -%} +{% block data_priority scoped %} +{{ super() }} +{% endblock data_priority %} +{%- set extra_class="" -%} +{%- endblock execute_result %} +{% block stream_stdout -%} +
+
+{{- output.text | ansi2html -}}
+
+
+{%- endblock stream_stdout %} +{% block stream_stderr -%} +
+
+{{- output.text | ansi2html -}}
+
+
+{%- endblock stream_stderr %} +{% block data_svg scoped -%} +
+{%- if output.svg_filename %} + +{%- else %} +{{ output.data['image/svg+xml'] }} +{%- endif %} +
+{%- endblock data_svg %} +{% block data_html scoped -%} +
+{{ output.data['text/html'] }} +
+{%- endblock data_html %} +{% block data_markdown scoped -%} +
+{{ output.data['text/markdown'] | markdown2html }} +
+{%- endblock data_markdown %} +{% block data_png scoped %} +
+{%- if 'image/png' in output.metadata.get('filenames', {}) %} + +
+{%- endblock data_png %} +{% block data_jpg scoped %} +
+{%- if 'image/jpeg' in output.metadata.get('filenames', {}) %} + +
+{%- endblock data_jpg %} +{% block data_latex scoped %} +
+{{ output.data['text/latex'] }} +
+{%- endblock data_latex %} +{% block error -%} +
+
+{{- super() -}}
+
+
+{%- endblock error %} +{%- block traceback_line %} +{{ line | ansi2html }} +{%- endblock traceback_line %} +{%- block data_text scoped %} +
+
+{{- output.data['text/plain'] | ansi2html -}}
+
+
+{%- endblock -%} +{%- block data_javascript scoped %} +{% set div_id = uuid4() %} +
+
+ +
+{%- endblock -%} + +{%- block data_widget_state scoped %} +{% set div_id = uuid4() %} +{% set datatype_list = output.data | filter_data_type %} +{% set datatype = datatype_list[0]%} +
+
+ + +
+{%- endblock data_widget_state -%} + +{%- block data_widget_view scoped %} +{% set div_id = uuid4() %} +{% set datatype_list = output.data | filter_data_type %} +{% set datatype = datatype_list[0]%} +
+
+ + +
+{%- endblock data_widget_view -%} + +{%- block footer %} +{% set mimetype = 'application/vnd.jupyter.widget-state+json'%} +{% if mimetype in nb.metadata.get("widgets",{})%} + +{% endif %} +{{ super() }} +{%- endblock footer-%} diff --git a/doc/celltags.tpl b/doc/celltags.tpl new file mode 100644 index 00000000000..4722b17ef17 --- /dev/null +++ b/doc/celltags.tpl @@ -0,0 +1,7 @@ +{%- macro celltags(cell) -%} + {% if cell.metadata.tags | length > 0 -%} + {% for tag in cell.metadata.tags -%} + {{ ' celltag_' ~ tag -}} + {%- endfor -%} + {%- endif %} +{%- endmacro %} diff --git a/doc/display_priority.tpl b/doc/display_priority.tpl new file mode 100644 index 00000000000..ec4d58a87cf --- /dev/null +++ b/doc/display_priority.tpl @@ -0,0 +1,46 @@ +{%- extends 'null.tpl' -%} + +{#display data priority#} + + +{%- block data_priority scoped -%} + {%- for type in output.data | filter_data_type -%} + {%- if type == 'application/pdf' -%} + {%- block data_pdf -%} + {%- endblock -%} + {%- elif type == 'image/svg+xml' -%} + {%- block data_svg -%} + {%- endblock -%} + {%- elif type == 'image/png' -%} + {%- block data_png -%} + {%- endblock -%} + {%- elif type == 'text/html' -%} + {%- block data_html -%} + {%- endblock -%} + {%- elif type == 'text/markdown' -%} + {%- block data_markdown -%} + {%- endblock -%} + {%- elif type == 'image/jpeg' -%} + {%- block data_jpg -%} + {%- endblock -%} + {%- elif type == 'text/plain' -%} + {%- block data_text -%} + {%- endblock -%} + {%- elif type == 'text/latex' -%} + {%- block data_latex -%} + {%- endblock -%} + {%- elif type == 'application/javascript' -%} + {%- block data_javascript -%} + {%- endblock -%} + {%- elif type == 'application/vnd.jupyter.widget-state+json' -%} + {%- block data_widget_state -%} + {%- endblock -%} + {%- elif type == 'application/vnd.jupyter.widget-view+json' -%} + {%- block data_widget_view -%} + {%- endblock -%} + {%- else -%} + {%- block data_other -%} + {%- endblock -%} + {%- endif -%} + {%- endfor -%} +{%- endblock data_priority -%} diff --git a/doc/null.tpl b/doc/null.tpl new file mode 100644 index 00000000000..2ac18bedaec --- /dev/null +++ b/doc/null.tpl @@ -0,0 +1,97 @@ +{# +DO NOT USE THIS AS A BASE, +IF YOU ARE COPY AND PASTING THIS FILE +YOU ARE PROBABLY DOING THINGS INCORRECTLY. +Null template, does nothing except defining a basic structure +To layout the different blocks of a notebook. +Subtemplates can override blocks to define their custom representation. +If one of the block you do overwrite is not a leave block, consider +calling super. +{%- block nonLeaveBlock -%} + #add stuff at beginning + {{ super() }} + #add stuff at end +{%- endblock nonLeaveBlock -%} + +consider calling super even if it is a leave block, we might insert more blocks later. + +#} +{%- block header -%} +{%- endblock header -%} +{%- block body -%} +{%- for cell in nb.cells -%} + {%- block any_cell scoped -%} + {%- if cell.cell_type == 'code'-%} + {%- if resources.global_content_filter.include_code -%} + {%- block codecell scoped -%} + {%- if resources.global_content_filter.include_input and not cell.get("transient",{}).get("remove_source", false) -%} + {%- block input_group -%} + {%- if resources.global_content_filter.include_input_prompt -%} + {%- block in_prompt -%}{%- endblock in_prompt -%} + {%- endif -%} + {%- block input -%}{%- endblock input -%} + {%- endblock input_group -%} + {%- endif -%} + {%- if cell.outputs and resources.global_content_filter.include_output -%} + {%- block output_group -%} + {%- if resources.global_content_filter.include_output_prompt -%} + {%- block output_prompt -%}{%- endblock output_prompt -%} + {%- endif -%} + {%- block outputs scoped -%} + {%- for output in cell.outputs -%} + {%- block output scoped -%} + {%- if output.output_type == 'execute_result' -%} + {%- block execute_result scoped -%}{%- endblock execute_result -%} + {%- elif output.output_type == 'stream' -%} + {%- block stream scoped -%} + {%- if output.name == 'stdout' -%} + {%- block stream_stdout scoped -%} + {%- endblock stream_stdout -%} + {%- elif output.name == 'stderr' -%} + {%- block stream_stderr scoped -%} + {%- endblock stream_stderr -%} + {%- endif -%} + {%- endblock stream -%} + {%- elif output.output_type == 'display_data' -%} + {%- block display_data scoped -%} + {%- block data_priority scoped -%} + {%- endblock data_priority -%} + {%- endblock display_data -%} + {%- elif output.output_type == 'error' -%} + {%- block error scoped -%} + {%- for line in output.traceback -%} + {%- block traceback_line scoped -%}{%- endblock traceback_line -%} + {%- endfor -%} + {%- endblock error -%} + {%- endif -%} + {%- endblock output -%} + {%- endfor -%} + {%- endblock outputs -%} + {%- endblock output_group -%} + {%- endif -%} + {%- endblock codecell -%} + {%- endif -%} + {%- elif cell.cell_type in ['markdown'] -%} + {%- if resources.global_content_filter.include_markdown and not cell.get("transient",{}).get("remove_source", false) -%} + {%- block markdowncell scoped-%} {%- endblock markdowncell -%} + {%- endif -%} + {%- elif cell.cell_type in ['raw'] -%} + {%- if resources.global_content_filter.include_raw and not cell.get("transient",{}).get("remove_source", false) -%} + {%- block rawcell scoped -%} + {%- if cell.metadata.get('raw_mimetype', '').lower() in resources.get('raw_mimetypes', ['']) -%} + {{ cell.source }} + {%- endif -%} + {%- endblock rawcell -%} + {%- endif -%} + {%- else -%} + {%- if resources.global_content_filter.include_unknown and not cell.get("transient",{}).get("remove_source", false) -%} + {%- block unknowncell scoped-%} + {%- endblock unknowncell -%} + {%- endif -%} + {%- endif -%} + {%- endblock any_cell -%} +{%- endfor -%} +{%- endblock body -%} + +{%- block footer -%} +{%- endblock footer -%} From 8cdc3b416ce2b44f85ad367a065e3af173e7845c Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Mon, 7 Dec 2020 17:41:51 -0800 Subject: [PATCH 05/10] changed requirements.txt to include six=1.15.0 --- packages/python/plotly/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/plotly/requirements.txt b/packages/python/plotly/requirements.txt index cbc5aa4986e..6800b7f43a5 100644 --- a/packages/python/plotly/requirements.txt +++ b/packages/python/plotly/requirements.txt @@ -6,7 +6,7 @@ ################################################### ## python 2 to 3 compatibility ## -six==1.8.0 +six==1.15.0 ## retrying requests ## tenacity>=6.2.0 From fede9eff5721f8b37db6031fce0f32fb08683689 Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Mon, 7 Dec 2020 18:39:21 -0800 Subject: [PATCH 06/10] reverted to using retrying in chart-studio due to test failures --- .circleci/create_conda_optional_env.sh | 2 +- .../python/chart-studio/chart_studio/api/v2/utils.py | 11 ++++++----- packages/python/chart-studio/tox.ini | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.circleci/create_conda_optional_env.sh b/.circleci/create_conda_optional_env.sh index 0da94234e84..4929c8ee529 100755 --- a/.circleci/create_conda_optional_env.sh +++ b/.circleci/create_conda_optional_env.sh @@ -16,7 +16,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 \ -requests nbformat six tenacity psutil pandas decorator pytest mock nose poppler xarray scikit-image ipython jupyter ipykernel ipywidgets statsmodels +requests nbformat six retrying tenacity 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 diff --git a/packages/python/chart-studio/chart_studio/api/v2/utils.py b/packages/python/chart-studio/chart_studio/api/v2/utils.py index 29d44df7932..4c022957293 100644 --- a/packages/python/chart-studio/chart_studio/api/v2/utils.py +++ b/packages/python/chart-studio/chart_studio/api/v2/utils.py @@ -3,7 +3,7 @@ import requests import json as _json from requests.exceptions import RequestException -import tenacity +from retrying import retry import _plotly_utils.exceptions from chart_studio import config, exceptions @@ -129,10 +129,11 @@ def should_retry(exception): return False -@tenacity.retry( - wait=tenacity.wait_exponential(multiplier=1000, max=16000), - stop=tenacity.stop_after_delay(180000), - retry=tenacity.retry_if_exception(should_retry), +@retry( + wait_exponential_multiplier=1000, + wait_exponential_max=16000, + stop_max_delay=180000, + retry_on_exception=should_retry, ) def request(method, url, **kwargs): """ diff --git a/packages/python/chart-studio/tox.ini b/packages/python/chart-studio/tox.ini index 3cdc529de2e..fc0496e345f 100644 --- a/packages/python/chart-studio/tox.ini +++ b/packages/python/chart-studio/tox.ini @@ -56,11 +56,11 @@ deps= requests==2.12.4 six==1.10.0 pytz==2016.10 - tenacity==6.2.0 + retrying==1.3.3 pytest==3.5.1 backports.tempfile==1.0 pandas==0.23.2 - numpy==1.14.3 +; numpy==1.14.3 ipywidgets==7.2.0 matplotlib==2.2.3 --editable=file:///{toxinidir}/../plotly From 224d0d2ee2fa85b4d9d010a08d152bf64f0e40d5 Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Thu, 10 Dec 2020 20:29:30 -0800 Subject: [PATCH 07/10] removed jinja templates in doc --- doc/basic.tpl | 249 --------------------------------------- doc/display_priority.tpl | 46 -------- doc/null.tpl | 97 --------------- 3 files changed, 392 deletions(-) delete mode 100644 doc/basic.tpl delete mode 100644 doc/display_priority.tpl delete mode 100644 doc/null.tpl diff --git a/doc/basic.tpl b/doc/basic.tpl deleted file mode 100644 index d87efafac0e..00000000000 --- a/doc/basic.tpl +++ /dev/null @@ -1,249 +0,0 @@ -{%- extends 'display_priority.tpl' -%} -{% from 'celltags.tpl' import celltags %} - -{% block codecell %} -
-{{ super() }} -
-{%- endblock codecell %} - -{% block input_group -%} -
-{{ super() }} -
-{% endblock input_group %} - -{% block output_group %} -
-
-{{ super() }} -
-
-{% endblock output_group %} - -{% block in_prompt -%} -
- {%- if cell.execution_count is defined -%} - In [{{ cell.execution_count|replace(None, " ") }}]: - {%- else -%} - In [ ]: - {%- endif -%} -
-{%- endblock in_prompt %} - -{% block empty_in_prompt -%} -
-
-{%- endblock empty_in_prompt %} - -{# - output_prompt doesn't do anything in HTML, - because there is a prompt div in each output area (see output block) -#} -{% block output_prompt %} -{% endblock output_prompt %} -{% block input %} -
-
-{{ cell.source | highlight_code(metadata=cell.metadata) }} -
-
-{%- endblock input %} -{% block output_area_prompt %} -{%- if output.output_type == 'execute_result' -%} -
- {%- if cell.execution_count is defined -%} - Out[{{ cell.execution_count|replace(None, " ") }}]: - {%- else -%} - Out[ ]: - {%- endif -%} -{%- else -%} -
-{%- endif -%} -
-{% endblock output_area_prompt %} -{% block output %} -
-{% if resources.global_content_filter.include_output_prompt %} - {{ self.output_area_prompt() }} -{% endif %} -{{ super() }} -
-{% endblock output %} -{% block markdowncell scoped %} -
-{%- if resources.global_content_filter.include_input_prompt-%} - {{ self.empty_in_prompt() }} -{%- endif -%} -
-
-{{ cell.source | markdown2html | strip_files_prefix }} -
-
-
-{%- endblock markdowncell %} -{% block unknowncell scoped %} -unknown type {{ cell.type }} -{% endblock unknowncell %} -{% block execute_result -%} -{%- set extra_class="output_execute_result" -%} -{% block data_priority scoped %} -{{ super() }} -{% endblock data_priority %} -{%- set extra_class="" -%} -{%- endblock execute_result %} -{% block stream_stdout -%} -
-
-{{- output.text | ansi2html -}}
-
-
-{%- endblock stream_stdout %} -{% block stream_stderr -%} -
-
-{{- output.text | ansi2html -}}
-
-
-{%- endblock stream_stderr %} -{% block data_svg scoped -%} -
-{%- if output.svg_filename %} - -{%- else %} -{{ output.data['image/svg+xml'] }} -{%- endif %} -
-{%- endblock data_svg %} -{% block data_html scoped -%} -
-{{ output.data['text/html'] }} -
-{%- endblock data_html %} -{% block data_markdown scoped -%} -
-{{ output.data['text/markdown'] | markdown2html }} -
-{%- endblock data_markdown %} -{% block data_png scoped %} -
-{%- if 'image/png' in output.metadata.get('filenames', {}) %} - -
-{%- endblock data_png %} -{% block data_jpg scoped %} -
-{%- if 'image/jpeg' in output.metadata.get('filenames', {}) %} - -
-{%- endblock data_jpg %} -{% block data_latex scoped %} -
-{{ output.data['text/latex'] }} -
-{%- endblock data_latex %} -{% block error -%} -
-
-{{- super() -}}
-
-
-{%- endblock error %} -{%- block traceback_line %} -{{ line | ansi2html }} -{%- endblock traceback_line %} -{%- block data_text scoped %} -
-
-{{- output.data['text/plain'] | ansi2html -}}
-
-
-{%- endblock -%} -{%- block data_javascript scoped %} -{% set div_id = uuid4() %} -
-
- -
-{%- endblock -%} - -{%- block data_widget_state scoped %} -{% set div_id = uuid4() %} -{% set datatype_list = output.data | filter_data_type %} -{% set datatype = datatype_list[0]%} -
-
- - -
-{%- endblock data_widget_state -%} - -{%- block data_widget_view scoped %} -{% set div_id = uuid4() %} -{% set datatype_list = output.data | filter_data_type %} -{% set datatype = datatype_list[0]%} -
-
- - -
-{%- endblock data_widget_view -%} - -{%- block footer %} -{% set mimetype = 'application/vnd.jupyter.widget-state+json'%} -{% if mimetype in nb.metadata.get("widgets",{})%} - -{% endif %} -{{ super() }} -{%- endblock footer-%} diff --git a/doc/display_priority.tpl b/doc/display_priority.tpl deleted file mode 100644 index ec4d58a87cf..00000000000 --- a/doc/display_priority.tpl +++ /dev/null @@ -1,46 +0,0 @@ -{%- extends 'null.tpl' -%} - -{#display data priority#} - - -{%- block data_priority scoped -%} - {%- for type in output.data | filter_data_type -%} - {%- if type == 'application/pdf' -%} - {%- block data_pdf -%} - {%- endblock -%} - {%- elif type == 'image/svg+xml' -%} - {%- block data_svg -%} - {%- endblock -%} - {%- elif type == 'image/png' -%} - {%- block data_png -%} - {%- endblock -%} - {%- elif type == 'text/html' -%} - {%- block data_html -%} - {%- endblock -%} - {%- elif type == 'text/markdown' -%} - {%- block data_markdown -%} - {%- endblock -%} - {%- elif type == 'image/jpeg' -%} - {%- block data_jpg -%} - {%- endblock -%} - {%- elif type == 'text/plain' -%} - {%- block data_text -%} - {%- endblock -%} - {%- elif type == 'text/latex' -%} - {%- block data_latex -%} - {%- endblock -%} - {%- elif type == 'application/javascript' -%} - {%- block data_javascript -%} - {%- endblock -%} - {%- elif type == 'application/vnd.jupyter.widget-state+json' -%} - {%- block data_widget_state -%} - {%- endblock -%} - {%- elif type == 'application/vnd.jupyter.widget-view+json' -%} - {%- block data_widget_view -%} - {%- endblock -%} - {%- else -%} - {%- block data_other -%} - {%- endblock -%} - {%- endif -%} - {%- endfor -%} -{%- endblock data_priority -%} diff --git a/doc/null.tpl b/doc/null.tpl deleted file mode 100644 index 2ac18bedaec..00000000000 --- a/doc/null.tpl +++ /dev/null @@ -1,97 +0,0 @@ -{# -DO NOT USE THIS AS A BASE, -IF YOU ARE COPY AND PASTING THIS FILE -YOU ARE PROBABLY DOING THINGS INCORRECTLY. -Null template, does nothing except defining a basic structure -To layout the different blocks of a notebook. -Subtemplates can override blocks to define their custom representation. -If one of the block you do overwrite is not a leave block, consider -calling super. -{%- block nonLeaveBlock -%} - #add stuff at beginning - {{ super() }} - #add stuff at end -{%- endblock nonLeaveBlock -%} - -consider calling super even if it is a leave block, we might insert more blocks later. - -#} -{%- block header -%} -{%- endblock header -%} -{%- block body -%} -{%- for cell in nb.cells -%} - {%- block any_cell scoped -%} - {%- if cell.cell_type == 'code'-%} - {%- if resources.global_content_filter.include_code -%} - {%- block codecell scoped -%} - {%- if resources.global_content_filter.include_input and not cell.get("transient",{}).get("remove_source", false) -%} - {%- block input_group -%} - {%- if resources.global_content_filter.include_input_prompt -%} - {%- block in_prompt -%}{%- endblock in_prompt -%} - {%- endif -%} - {%- block input -%}{%- endblock input -%} - {%- endblock input_group -%} - {%- endif -%} - {%- if cell.outputs and resources.global_content_filter.include_output -%} - {%- block output_group -%} - {%- if resources.global_content_filter.include_output_prompt -%} - {%- block output_prompt -%}{%- endblock output_prompt -%} - {%- endif -%} - {%- block outputs scoped -%} - {%- for output in cell.outputs -%} - {%- block output scoped -%} - {%- if output.output_type == 'execute_result' -%} - {%- block execute_result scoped -%}{%- endblock execute_result -%} - {%- elif output.output_type == 'stream' -%} - {%- block stream scoped -%} - {%- if output.name == 'stdout' -%} - {%- block stream_stdout scoped -%} - {%- endblock stream_stdout -%} - {%- elif output.name == 'stderr' -%} - {%- block stream_stderr scoped -%} - {%- endblock stream_stderr -%} - {%- endif -%} - {%- endblock stream -%} - {%- elif output.output_type == 'display_data' -%} - {%- block display_data scoped -%} - {%- block data_priority scoped -%} - {%- endblock data_priority -%} - {%- endblock display_data -%} - {%- elif output.output_type == 'error' -%} - {%- block error scoped -%} - {%- for line in output.traceback -%} - {%- block traceback_line scoped -%}{%- endblock traceback_line -%} - {%- endfor -%} - {%- endblock error -%} - {%- endif -%} - {%- endblock output -%} - {%- endfor -%} - {%- endblock outputs -%} - {%- endblock output_group -%} - {%- endif -%} - {%- endblock codecell -%} - {%- endif -%} - {%- elif cell.cell_type in ['markdown'] -%} - {%- if resources.global_content_filter.include_markdown and not cell.get("transient",{}).get("remove_source", false) -%} - {%- block markdowncell scoped-%} {%- endblock markdowncell -%} - {%- endif -%} - {%- elif cell.cell_type in ['raw'] -%} - {%- if resources.global_content_filter.include_raw and not cell.get("transient",{}).get("remove_source", false) -%} - {%- block rawcell scoped -%} - {%- if cell.metadata.get('raw_mimetype', '').lower() in resources.get('raw_mimetypes', ['']) -%} - {{ cell.source }} - {%- endif -%} - {%- endblock rawcell -%} - {%- endif -%} - {%- else -%} - {%- if resources.global_content_filter.include_unknown and not cell.get("transient",{}).get("remove_source", false) -%} - {%- block unknowncell scoped-%} - {%- endblock unknowncell -%} - {%- endif -%} - {%- endif -%} - {%- endblock any_cell -%} -{%- endfor -%} -{%- endblock body -%} - -{%- block footer -%} -{%- endblock footer -%} From 597aa98272bb751540e38c957cb18c550266ea95 Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Thu, 10 Dec 2020 23:41:56 -0800 Subject: [PATCH 08/10] removed previously added jinja templated missed by previous commit --- doc/celltags.tpl | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 doc/celltags.tpl diff --git a/doc/celltags.tpl b/doc/celltags.tpl deleted file mode 100644 index 4722b17ef17..00000000000 --- a/doc/celltags.tpl +++ /dev/null @@ -1,7 +0,0 @@ -{%- macro celltags(cell) -%} - {% if cell.metadata.tags | length > 0 -%} - {% for tag in cell.metadata.tags -%} - {{ ' celltag_' ~ tag -}} - {%- endfor -%} - {%- endif %} -{%- endmacro %} From 58c3a224eb02ecdb88072920a7b4bf74d8eb3cad Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Wed, 16 Dec 2020 11:17:31 -0800 Subject: [PATCH 09/10] reverted unneeded change to chart-studio tox.ini --- packages/python/chart-studio/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/chart-studio/tox.ini b/packages/python/chart-studio/tox.ini index fc0496e345f..faddb36305f 100644 --- a/packages/python/chart-studio/tox.ini +++ b/packages/python/chart-studio/tox.ini @@ -60,7 +60,7 @@ deps= pytest==3.5.1 backports.tempfile==1.0 pandas==0.23.2 -; numpy==1.14.3 + numpy==1.14.3 ipywidgets==7.2.0 matplotlib==2.2.3 --editable=file:///{toxinidir}/../plotly From 01e2afe84558cf452558654f017c68a6d430883d Mon Sep 17 00:00:00 2001 From: jmsmdy Date: Wed, 16 Dec 2020 11:24:13 -0800 Subject: [PATCH 10/10] reverted unneeded change to chart-studio setup.py --- packages/python/chart-studio/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/chart-studio/setup.py b/packages/python/chart-studio/setup.py index 047b2c75275..556c8e144d6 100644 --- a/packages/python/chart-studio/setup.py +++ b/packages/python/chart-studio/setup.py @@ -41,6 +41,6 @@ def readme(): "chart_studio.plotly.chunked_requests", "chart_studio.presentation_objs", ], - install_requires=["plotly", "requests", "tenacity>=6.2.0", "six"], + install_requires=["plotly", "requests", "retrying>=1.3.3", "six"], zip_safe=False, )