Skip to content

Commit fb0b5fc

Browse files
authored
Merge branch 'master' into add-subtitle-to-px
2 parents 2cf87dc + 31b3ad8 commit fb0b5fc

18 files changed

+32
-25
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
### Removed
66
- Drop deprecated `pointcloud` and `heatmapgl` traces from the API
7+
- Drop `tenacity` dependency [#4831](https://github.com/plotly/plotly.js/pull/4831)
78

89
### Updated
910

Diff for: environment.yml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dependencies:
1010
- pandas
1111
- black
1212
- pytest
13-
- tenacity
1413
- inflect
1514
- jupyterlab
1615
- ipywidgets

Diff for: packages/python/plotly/plotly/io/_orca.py

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import atexit
2+
import functools
23
import json
34
import os
5+
import random
46
import socket
57
import subprocess
68
import sys
79
import threading
10+
import time
811
import warnings
9-
from copy import copy
1012
from contextlib import contextmanager
13+
from copy import copy
1114
from pathlib import Path
1215
from shutil import which
1316

14-
import tenacity
15-
1617
import plotly
1718
from plotly.files import PLOTLY_DIR, ensure_writable_plotly_dir
1819
from plotly.io._utils import validate_coerce_fig_to_dict
@@ -111,6 +112,31 @@ def find_open_port():
111112
return port
112113

113114

115+
def retry(min_wait=5, max_wait=10, max_delay=60000):
116+
def decorator(func):
117+
@functools.wraps(func)
118+
def wrapper(*args, **kwargs):
119+
start_time = time.time()
120+
121+
while True:
122+
try:
123+
return func(*args, **kwargs)
124+
except Exception as e:
125+
elapsed_time = time.time() - start_time
126+
if elapsed_time * 1000 >= max_delay:
127+
raise TimeoutError(
128+
f"Retry limit of {max_delay} milliseconds reached."
129+
) from e
130+
131+
wait_time = random.uniform(min_wait, max_wait)
132+
print(f"Retrying in {wait_time:.2f} seconds due to {e}...")
133+
time.sleep(wait_time)
134+
135+
return wrapper
136+
137+
return decorator
138+
139+
114140
# Orca configuration class
115141
# ------------------------
116142
class OrcaConfig(object):
@@ -1357,10 +1383,7 @@ def ensure_server():
13571383
orca_state["shutdown_timer"] = t
13581384

13591385

1360-
@tenacity.retry(
1361-
wait=tenacity.wait_random(min=5, max=10),
1362-
stop=tenacity.stop_after_delay(60000),
1363-
)
1386+
@retry(min_wait=5, max_wait=10, max_delay=60000)
13641387
def request_image_with_retrying(**kwargs):
13651388
"""
13661389
Helper method to perform an image request to a running orca server process

Diff for: packages/python/plotly/recipe/meta.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ requirements:
2525
- setuptools
2626
run:
2727
- python
28-
- tenacity >=6.2.0
2928

3029
test:
3130
imports:

Diff for: packages/python/plotly/requirements.txt

-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44
### $ pip install -r requirements.txt ###
55
### ###
66
###################################################
7-
8-
## retrying requests ##
9-
tenacity>=6.2.0

Diff for: packages/python/plotly/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def run(self):
603603
data_files=[
604604
("etc/jupyter/nbconfig/notebook.d", ["jupyterlab-plotly.json"]),
605605
],
606-
install_requires=["tenacity>=6.2.0", "packaging"],
606+
install_requires=["packaging"],
607607
zip_safe=False,
608608
cmdclass=dict(
609609
build_py=js_prerelease(versioneer_cmds["build_py"]),
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pytest==7.4.4

Diff for: packages/python/plotly/test_requirements/requirements_310_optional.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pandas==1.5.3
43
numpy==1.23.0
54
xarray==0.17.0
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pytest==7.4.4

Diff for: packages/python/plotly/test_requirements/requirements_311_optional.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pandas==1.5.3
43
numpy==1.23.2
54
xarray==0.17.0
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pytest==7.4.4

Diff for: packages/python/plotly/test_requirements/requirements_312_no_numpy_optional.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
requests==2.31.0
2-
tenacity==8.2.3
32
pandas
43
xarray==2023.12.0
54
statsmodels

Diff for: packages/python/plotly/test_requirements/requirements_312_optional.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
requests==2.31.0
2-
tenacity==8.2.3
32
pandas
43
numpy
54
xarray==2023.12.0
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pytest==8.1.1

Diff for: packages/python/plotly/test_requirements/requirements_38_optional.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pandas==1.2.4
43
numpy==1.20.2
54
xarray==0.17.0
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pytest==6.2.3

Diff for: packages/python/plotly/test_requirements/requirements_39_optional.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pandas==1.2.4
43
numpy==1.21.6
54
xarray==0.17.0

Diff for: packages/python/plotly/test_requirements/requirements_39_pandas_2_optional.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
requests==2.25.1
2-
tenacity==6.2.0
32
pandas==2.2.0
43
numpy==1.22.4
54
xarray==0.17.0

0 commit comments

Comments
 (0)