diff --git a/contributing.md b/contributing.md index e06fcdf6e43..692e7450a11 100644 --- a/contributing.md +++ b/contributing.md @@ -271,11 +271,11 @@ pytest plotly/tests/test_plotly/test_plot.py::test_function Running tests with tox is much more powerful, but requires a bit more setup. -You'll need to export an environment variable for *each* tox environment you wish to test with. For example, if you want to test with `Python 2.7` and +You'll need to export an environment variable for *each* tox environment you wish to test with. For example, if you want to test with `Python 3.9` and `Python 3.6`, but only care to check the `core` specs, you would need to ensure that the following variables are exported: ``` -export PLOTLY_TOX_PYTHON_27= +export PLOTLY_TOX_PYTHON_39= export PLOTLY_TOX_PYTHON_36= ``` @@ -286,15 +286,15 @@ Where the ` ```python -from __future__ import print_function #python 3 support print(sc) ``` diff --git a/packages/python/plotly/_plotly_utils/basevalidators.py b/packages/python/plotly/_plotly_utils/basevalidators.py index e0c93699e72..35dec09dd1e 100644 --- a/packages/python/plotly/_plotly_utils/basevalidators.py +++ b/packages/python/plotly/_plotly_utils/basevalidators.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import base64 import numbers import textwrap @@ -146,7 +144,7 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False): # -------------------------- if force_numeric and new_v.dtype.kind not in numeric_kinds: raise ValueError( - "Input value is not numeric and" "force_numeric parameter set to True" + "Input value is not numeric and force_numeric parameter set to True" ) if "U" not in kind: diff --git a/packages/python/plotly/_plotly_utils/colors/__init__.py b/packages/python/plotly/_plotly_utils/colors/__init__.py index 20c432094e3..794c20d2e52 100644 --- a/packages/python/plotly/_plotly_utils/colors/__init__.py +++ b/packages/python/plotly/_plotly_utils/colors/__init__.py @@ -73,8 +73,6 @@ Be careful! If you have a lot of unique numbers in your color column you will end up with a colormap that is massive and may slow down graphing performance. """ -from __future__ import absolute_import - import decimal from numbers import Number diff --git a/packages/python/plotly/_plotly_utils/optional_imports.py b/packages/python/plotly/_plotly_utils/optional_imports.py index 33bd2d05f57..32dec4e12ab 100644 --- a/packages/python/plotly/_plotly_utils/optional_imports.py +++ b/packages/python/plotly/_plotly_utils/optional_imports.py @@ -2,8 +2,6 @@ Stand-alone module to provide information about whether optional deps exist. """ -from __future__ import absolute_import - from importlib import import_module import logging import sys @@ -30,7 +28,7 @@ def get_module(name, should_load=True): return import_module(name) except ImportError: _not_importable.add(name) - except Exception as e: + except Exception: _not_importable.add(name) msg = f"Error importing optional module {name}" logger.exception(msg) diff --git a/packages/python/plotly/_plotly_utils/utils.py b/packages/python/plotly/_plotly_utils/utils.py index 787ad5077a8..e8a32e0c8ae 100644 --- a/packages/python/plotly/_plotly_utils/utils.py +++ b/packages/python/plotly/_plotly_utils/utils.py @@ -8,9 +8,6 @@ from _plotly_utils.basevalidators import ImageUriValidator -PY36_OR_LATER = sys.version_info >= (3, 6) - - def cumsum(x): """ Custom cumsum to avoid a numpy import. diff --git a/packages/python/plotly/plotly/__init__.py b/packages/python/plotly/plotly/__init__.py index 83d6aaa03e6..b3a6f892832 100644 --- a/packages/python/plotly/plotly/__init__.py +++ b/packages/python/plotly/plotly/__init__.py @@ -25,7 +25,6 @@ - exceptions: defines our custom exception classes """ -from __future__ import absolute_import import sys from typing import TYPE_CHECKING from _plotly_utils.importers import relative_import diff --git a/packages/python/plotly/plotly/_subplots.py b/packages/python/plotly/plotly/_subplots.py index f2606f49e45..c92bc29afed 100644 --- a/packages/python/plotly/plotly/_subplots.py +++ b/packages/python/plotly/plotly/_subplots.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals - # Constants # --------- # Subplot types that are each individually positioned with a domain diff --git a/packages/python/plotly/plotly/api/utils.py b/packages/python/plotly/plotly/api/utils.py index d8e26ec03ce..7a19c52c6f9 100644 --- a/packages/python/plotly/plotly/api/utils.py +++ b/packages/python/plotly/plotly/api/utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("api.utils") diff --git a/packages/python/plotly/plotly/api/v1.py b/packages/python/plotly/plotly/api/v1.py index a19b62e2bd1..45256933e95 100644 --- a/packages/python/plotly/plotly/api/v1.py +++ b/packages/python/plotly/plotly/api/v1.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("api.v1") diff --git a/packages/python/plotly/plotly/api/v2.py b/packages/python/plotly/plotly/api/v2.py index 251dc7a5ead..1bde2ce0946 100644 --- a/packages/python/plotly/plotly/api/v2.py +++ b/packages/python/plotly/plotly/api/v2.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("api.v2") diff --git a/packages/python/plotly/plotly/basedatatypes.py b/packages/python/plotly/plotly/basedatatypes.py index 6f4e632055b..4a253c85c58 100644 --- a/packages/python/plotly/plotly/basedatatypes.py +++ b/packages/python/plotly/plotly/basedatatypes.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import collections from collections import OrderedDict import re diff --git a/packages/python/plotly/plotly/basewidget.py b/packages/python/plotly/plotly/basewidget.py index 1788466cfa7..485d817e0bc 100644 --- a/packages/python/plotly/plotly/basewidget.py +++ b/packages/python/plotly/plotly/basewidget.py @@ -1,15 +1,6 @@ -import uuid -from importlib import import_module -import os -import numbers - -try: - from urllib import parse -except ImportError: - from urlparse import urlparse as parse - import ipywidgets as widgets from traitlets import List, Unicode, Dict, observe, Integer + from .basedatatypes import BaseFigure, BasePlotlyType from .callbacks import BoxSelector, LassoSelector, InputDeviceState, Points from .serializers import custom_serializers diff --git a/packages/python/plotly/plotly/callbacks.py b/packages/python/plotly/plotly/callbacks.py index 47121735ba5..5ac5eabe3a7 100644 --- a/packages/python/plotly/plotly/callbacks.py +++ b/packages/python/plotly/plotly/callbacks.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from plotly.utils import _list_repr_elided @@ -17,11 +16,11 @@ def __init__( def __repr__(self): return """\ InputDeviceState( - ctrl={ctrl}, - alt={alt}, - shift={shift}, - meta={meta}, - button={button}, + ctrl={ctrl}, + alt={alt}, + shift={shift}, + meta={meta}, + button={button}, buttons={buttons})""".format( ctrl=repr(self.ctrl), alt=repr(self.alt), diff --git a/packages/python/plotly/plotly/colors/__init__.py b/packages/python/plotly/plotly/colors/__init__.py index 16fa195b4b3..3178dcefd2d 100644 --- a/packages/python/plotly/plotly/colors/__init__.py +++ b/packages/python/plotly/plotly/colors/__init__.py @@ -12,7 +12,6 @@ * sequential """ -from __future__ import absolute_import from _plotly_utils.colors import * # noqa: F401 __all__ = [ diff --git a/packages/python/plotly/plotly/config.py b/packages/python/plotly/plotly/config.py index 40011db95ae..f611aa70c23 100644 --- a/packages/python/plotly/plotly/config.py +++ b/packages/python/plotly/plotly/config.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("config") diff --git a/packages/python/plotly/plotly/conftest.py b/packages/python/plotly/plotly/conftest.py index 3e7bed965e6..1e1361dd518 100644 --- a/packages/python/plotly/plotly/conftest.py +++ b/packages/python/plotly/plotly/conftest.py @@ -1,4 +1,3 @@ -import pytest import os diff --git a/packages/python/plotly/plotly/dashboard_objs.py b/packages/python/plotly/plotly/dashboard_objs.py index d208130aa75..50aa0e47628 100644 --- a/packages/python/plotly/plotly/dashboard_objs.py +++ b/packages/python/plotly/plotly/dashboard_objs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("dashboard_objs") diff --git a/packages/python/plotly/plotly/exceptions.py b/packages/python/plotly/plotly/exceptions.py index f2ddd9f5d2e..0f03024c5f3 100644 --- a/packages/python/plotly/plotly/exceptions.py +++ b/packages/python/plotly/plotly/exceptions.py @@ -1,2 +1 @@ -from __future__ import absolute_import from _plotly_utils.exceptions import * diff --git a/packages/python/plotly/plotly/express/__init__.py b/packages/python/plotly/plotly/express/__init__.py index 66e0297185d..4dd37f64fc3 100644 --- a/packages/python/plotly/plotly/express/__init__.py +++ b/packages/python/plotly/plotly/express/__init__.py @@ -2,7 +2,6 @@ `plotly.express` is a terse, consistent, high-level wrapper around `plotly.graph_objects` for rapid data exploration and figure generation. Learn more at https://plotly.com/python/plotly-express/ """ -from __future__ import absolute_import from plotly import optional_imports pd = optional_imports.get_module("pandas") diff --git a/packages/python/plotly/plotly/express/colors/__init__.py b/packages/python/plotly/plotly/express/colors/__init__.py index a554558f945..0bd45bc2296 100644 --- a/packages/python/plotly/plotly/express/colors/__init__.py +++ b/packages/python/plotly/plotly/express/colors/__init__.py @@ -12,7 +12,6 @@ * sequential """ -from __future__ import absolute_import from plotly.colors import * diff --git a/packages/python/plotly/plotly/express/data/__init__.py b/packages/python/plotly/plotly/express/data/__init__.py index 58fc678f1c4..02c87531754 100644 --- a/packages/python/plotly/plotly/express/data/__init__.py +++ b/packages/python/plotly/plotly/express/data/__init__.py @@ -1,7 +1,6 @@ """Built-in datasets for demonstration, educational and test purposes. """ -from __future__ import absolute_import from plotly.data import * __all__ = [ diff --git a/packages/python/plotly/plotly/figure_factory/README.md b/packages/python/plotly/plotly/figure_factory/README.md index 45b264ddccd..4b9266ee59c 100644 --- a/packages/python/plotly/plotly/figure_factory/README.md +++ b/packages/python/plotly/plotly/figure_factory/README.md @@ -1,5 +1,9 @@ # Add A Figure Factory to the Plotly [Python Library](https://plot.ly/python/) +Note: we are generally NOT accepting new figure factories anymore. We'll keep this doc around for context and in case we decide to make an exception, but we've found that figure factories expand the scope of the library (and its maintenance burden) beyond what really makes sense, and generates confusion about how these figures relate to the underlying plotly.js objects. + +That doesn't mean this pattern is discouraged though, far from it! We encourage you to make more such high-level functions and share them with the community as separate PyPI packages, GitHub Gists, or posts on https://community.plotly.com. + ## What is a Figure Factory? In the Python Plotly Library: @@ -61,8 +65,6 @@ If you are making a chart called `foo`, then you must create `_foo.py` in this d The inside of the `__init__.py` looks like: ``` -from __future__ import absolute_import - # Require that numpy exists for figure_factory import numpy @@ -78,19 +80,9 @@ Now add the following line to the end of `__init__.py`: from plotly.figure_factory._foo import create_foo ``` -3. Imports +3. The main function -In `_foo.py` write - -``` -from __future__ import absolute_import -``` - -at line 1. You can add other imports later if you will need them. - -4. The main function - -It's now time to write the main function `create_foo` that will be called directly by the user. It has the form: +It's now time to write the main function `create_foo` that will be called directly by the user. It lives in `_foo.py` and has the form: ``` def create_foo(attribute1, attribute2=value, ...): @@ -101,15 +93,15 @@ def create_foo(attribute1, attribute2=value, ...): :param (type) attribute2: description of what 'attribute2' is. Default = value # ... - + Example 1: ''' - + ''' - + Example 2: ''' - + ''' """ # code goes here @@ -136,15 +128,15 @@ py.iplot(fig, filename='my_figure') The figure `fig` must be a Plotly Figure, meaning it must have the form `fig = graph_objs.Figure(data=data, layout=layout)`. -5. Useful Tips +4. Useful Tips It is often not a good idea to put all your code into your `create_foo()` function. It is best practice to not repeat yourself and this requires taking repeated blocks of code and putting them into a separate function. It is best to make all other functions besides `create_foo()` secret so a user cannot access them. This is done by placing a `_` before the name of the function, so `_aux_func()` for example. -6. Tests +5. Tests -Add unit tests in +Add unit tests in `plotly/tests/test_optional/test_figure_factory/test_figure_factory.py`. ## Create a Pull Request diff --git a/packages/python/plotly/plotly/figure_factory/_2d_density.py b/packages/python/plotly/plotly/figure_factory/_2d_density.py index e6d7d7874d2..3094d0bcad0 100644 --- a/packages/python/plotly/plotly/figure_factory/_2d_density.py +++ b/packages/python/plotly/plotly/figure_factory/_2d_density.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from numbers import Number import plotly.exceptions diff --git a/packages/python/plotly/plotly/figure_factory/__init__.py b/packages/python/plotly/plotly/figure_factory/__init__.py index 0a41dca1ba2..670d705cd96 100644 --- a/packages/python/plotly/plotly/figure_factory/__init__.py +++ b/packages/python/plotly/plotly/figure_factory/__init__.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from plotly import optional_imports # Require that numpy exists for figure_factory diff --git a/packages/python/plotly/plotly/figure_factory/_annotated_heatmap.py b/packages/python/plotly/plotly/figure_factory/_annotated_heatmap.py index 4730cafcd57..a3db3aeef5a 100644 --- a/packages/python/plotly/plotly/figure_factory/_annotated_heatmap.py +++ b/packages/python/plotly/plotly/figure_factory/_annotated_heatmap.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division - import plotly.colors as clrs from plotly import exceptions, optional_imports from plotly.figure_factory import utils diff --git a/packages/python/plotly/plotly/figure_factory/_bullet.py b/packages/python/plotly/plotly/figure_factory/_bullet.py index d9194fe376c..ce51e9360c8 100644 --- a/packages/python/plotly/plotly/figure_factory/_bullet.py +++ b/packages/python/plotly/plotly/figure_factory/_bullet.py @@ -1,6 +1,3 @@ -from __future__ import absolute_import - -import collections import math from plotly import exceptions, optional_imports diff --git a/packages/python/plotly/plotly/figure_factory/_candlestick.py b/packages/python/plotly/plotly/figure_factory/_candlestick.py index ebea46d2f47..572ccfe142f 100644 --- a/packages/python/plotly/plotly/figure_factory/_candlestick.py +++ b/packages/python/plotly/plotly/figure_factory/_candlestick.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from plotly.figure_factory import utils from plotly.figure_factory._ohlc import ( _DEFAULT_INCREASING_COLOR, diff --git a/packages/python/plotly/plotly/figure_factory/_dendrogram.py b/packages/python/plotly/plotly/figure_factory/_dendrogram.py index 5c4d463b9b5..1f97cca230a 100644 --- a/packages/python/plotly/plotly/figure_factory/_dendrogram.py +++ b/packages/python/plotly/plotly/figure_factory/_dendrogram.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- - -from __future__ import absolute_import - from collections import OrderedDict from plotly import exceptions, optional_imports diff --git a/packages/python/plotly/plotly/figure_factory/_distplot.py b/packages/python/plotly/plotly/figure_factory/_distplot.py index 626d97379af..9fa7777f58e 100644 --- a/packages/python/plotly/plotly/figure_factory/_distplot.py +++ b/packages/python/plotly/plotly/figure_factory/_distplot.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from plotly import exceptions, optional_imports from plotly.figure_factory import utils from plotly.graph_objs import graph_objs diff --git a/packages/python/plotly/plotly/figure_factory/_facet_grid.py b/packages/python/plotly/plotly/figure_factory/_facet_grid.py index 0ef098a9b6c..e8f4f249ff1 100644 --- a/packages/python/plotly/plotly/figure_factory/_facet_grid.py +++ b/packages/python/plotly/plotly/figure_factory/_facet_grid.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from plotly import exceptions, optional_imports import plotly.colors as clrs from plotly.figure_factory import utils diff --git a/packages/python/plotly/plotly/figure_factory/_gantt.py b/packages/python/plotly/plotly/figure_factory/_gantt.py index aedb26c2a53..8c7cc80b076 100644 --- a/packages/python/plotly/plotly/figure_factory/_gantt.py +++ b/packages/python/plotly/plotly/figure_factory/_gantt.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from numbers import Number import copy diff --git a/packages/python/plotly/plotly/figure_factory/_ohlc.py b/packages/python/plotly/plotly/figure_factory/_ohlc.py index 7686ec2d43a..1912fd08f1b 100644 --- a/packages/python/plotly/plotly/figure_factory/_ohlc.py +++ b/packages/python/plotly/plotly/figure_factory/_ohlc.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from plotly import exceptions from plotly.graph_objs import graph_objs from plotly.figure_factory import utils diff --git a/packages/python/plotly/plotly/figure_factory/_quiver.py b/packages/python/plotly/plotly/figure_factory/_quiver.py index f40df33d451..fa182222881 100644 --- a/packages/python/plotly/plotly/figure_factory/_quiver.py +++ b/packages/python/plotly/plotly/figure_factory/_quiver.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import math from plotly import exceptions diff --git a/packages/python/plotly/plotly/figure_factory/_scatterplot.py b/packages/python/plotly/plotly/figure_factory/_scatterplot.py index 097caaccae4..fb6a209aba5 100644 --- a/packages/python/plotly/plotly/figure_factory/_scatterplot.py +++ b/packages/python/plotly/plotly/figure_factory/_scatterplot.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from plotly import exceptions, optional_imports import plotly.colors as clrs from plotly.figure_factory import utils diff --git a/packages/python/plotly/plotly/figure_factory/_streamline.py b/packages/python/plotly/plotly/figure_factory/_streamline.py index e2eac0af0c8..02b8b7c490e 100644 --- a/packages/python/plotly/plotly/figure_factory/_streamline.py +++ b/packages/python/plotly/plotly/figure_factory/_streamline.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import math from plotly import exceptions, optional_imports diff --git a/packages/python/plotly/plotly/figure_factory/_table.py b/packages/python/plotly/plotly/figure_factory/_table.py index b2be5a98dd7..0204f48ae0d 100644 --- a/packages/python/plotly/plotly/figure_factory/_table.py +++ b/packages/python/plotly/plotly/figure_factory/_table.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from plotly import exceptions, optional_imports from plotly.graph_objs import graph_objs diff --git a/packages/python/plotly/plotly/figure_factory/_ternary_contour.py b/packages/python/plotly/plotly/figure_factory/_ternary_contour.py index 49d1e60dc68..690c7199d57 100644 --- a/packages/python/plotly/plotly/figure_factory/_ternary_contour.py +++ b/packages/python/plotly/plotly/figure_factory/_ternary_contour.py @@ -1,9 +1,7 @@ -from __future__ import absolute_import import plotly.colors as clrs from plotly.graph_objs import graph_objs as go -from plotly import exceptions, optional_imports +from plotly import exceptions from plotly import optional_imports -from plotly.graph_objs import graph_objs as go np = optional_imports.get_module("numpy") scipy_interp = optional_imports.get_module("scipy.interpolate") diff --git a/packages/python/plotly/plotly/figure_factory/_trisurf.py b/packages/python/plotly/plotly/figure_factory/_trisurf.py index f3f55d8d1e0..b4805ec4c08 100644 --- a/packages/python/plotly/plotly/figure_factory/_trisurf.py +++ b/packages/python/plotly/plotly/figure_factory/_trisurf.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from plotly import exceptions, optional_imports import plotly.colors as clrs from plotly.graph_objs import graph_objs diff --git a/packages/python/plotly/plotly/figure_factory/_violin.py b/packages/python/plotly/plotly/figure_factory/_violin.py index c420990a7fe..62df6d3b8b0 100644 --- a/packages/python/plotly/plotly/figure_factory/_violin.py +++ b/packages/python/plotly/plotly/figure_factory/_violin.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from numbers import Number from plotly import exceptions, optional_imports diff --git a/packages/python/plotly/plotly/figure_factory/utils.py b/packages/python/plotly/plotly/figure_factory/utils.py index 9d501e12d78..8a9a17427eb 100644 --- a/packages/python/plotly/plotly/figure_factory/utils.py +++ b/packages/python/plotly/plotly/figure_factory/utils.py @@ -1,6 +1,4 @@ -from __future__ import absolute_import - -import decimal +from collections.abc import Sequence from plotly import exceptions from plotly.colors import ( @@ -22,11 +20,6 @@ validate_scale_values, ) -try: - from collections.abc import Sequence -except ImportError: - from collections import Sequence - def is_sequence(obj): return isinstance(obj, Sequence) and not isinstance(obj, str) diff --git a/packages/python/plotly/plotly/files.py b/packages/python/plotly/plotly/files.py index 0c305183e96..de99b0e8853 100644 --- a/packages/python/plotly/plotly/files.py +++ b/packages/python/plotly/plotly/files.py @@ -1,2 +1 @@ -from __future__ import absolute_import from _plotly_utils.files import * diff --git a/packages/python/plotly/plotly/grid_objs.py b/packages/python/plotly/plotly/grid_objs.py index e36eafaee37..c82c8957883 100644 --- a/packages/python/plotly/plotly/grid_objs.py +++ b/packages/python/plotly/plotly/grid_objs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("grid_objs") diff --git a/packages/python/plotly/plotly/io/_base_renderers.py b/packages/python/plotly/plotly/io/_base_renderers.py index f6cc4f9c1d3..5a75f010633 100644 --- a/packages/python/plotly/plotly/io/_base_renderers.py +++ b/packages/python/plotly/plotly/io/_base_renderers.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import base64 import json import webbrowser diff --git a/packages/python/plotly/plotly/io/_html.py b/packages/python/plotly/plotly/io/_html.py index 50e15f5cda9..981f414aedf 100644 --- a/packages/python/plotly/plotly/io/_html.py +++ b/packages/python/plotly/plotly/io/_html.py @@ -1,12 +1,10 @@ import uuid -import os from pathlib import Path import webbrowser from _plotly_utils.optional_imports import get_module from plotly.io._utils import validate_coerce_fig_to_dict, plotly_cdn_url from plotly.offline.offline import _get_jconfig, get_plotlyjs -from plotly import utils _json = get_module("json") diff --git a/packages/python/plotly/plotly/io/_json.py b/packages/python/plotly/plotly/io/_json.py index 26ea14e063e..b7df0c2e5c5 100644 --- a/packages/python/plotly/plotly/io/_json.py +++ b/packages/python/plotly/plotly/io/_json.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import json import decimal import datetime diff --git a/packages/python/plotly/plotly/io/_kaleido.py b/packages/python/plotly/plotly/io/_kaleido.py index 51874c74631..029b79f1029 100644 --- a/packages/python/plotly/plotly/io/_kaleido.py +++ b/packages/python/plotly/plotly/io/_kaleido.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import os import json from pathlib import Path diff --git a/packages/python/plotly/plotly/io/_orca.py b/packages/python/plotly/plotly/io/_orca.py index 475234c5545..c72c9e4c7e3 100644 --- a/packages/python/plotly/plotly/io/_orca.py +++ b/packages/python/plotly/plotly/io/_orca.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import atexit import json import os @@ -11,10 +9,10 @@ from copy import copy from contextlib import contextmanager from pathlib import Path +from shutil import which import tenacity -import _plotly_utils.utils import plotly from plotly.files import PLOTLY_DIR, ensure_writable_plotly_dir from plotly.io._utils import validate_coerce_fig_to_dict @@ -113,98 +111,6 @@ def find_open_port(): return port -def which_py2(cmd, mode=os.F_OK | os.X_OK, path=None): - """ - Backport (unmodified) of shutil.which command from Python 3.6 - Remove this when Python 2 support is dropped - - Given a command, mode, and a PATH string, return the path which - conforms to the given mode on the PATH, or None if there is no such - file. - - `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result - of os.environ.get("PATH"), or can be overridden with a custom search - path. - """ - # Check that a given file can be accessed with the correct mode. - # Additionally check that `file` is not a directory, as on Windows - # directories pass the os.access check. - def _access_check(fn, mode): - return os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn) - - # If we're given a path with a directory part, look it up directly rather - # than referring to PATH directories. This includes checking relative to - # the current directory, e.g. ./script - if os.path.dirname(cmd): - if _access_check(cmd, mode): - return cmd - return None - - if path is None: - path = os.environ.get("PATH", os.defpath) - if not path: - return None - path = path.split(os.pathsep) - - if sys.platform == "win32": - # The current directory takes precedence on Windows. - if not os.curdir in path: - path.insert(0, os.curdir) - - # PATHEXT is necessary to check on Windows. - pathext = os.environ.get("PATHEXT", "").split(os.pathsep) - # See if the given file matches any of the expected path extensions. - # This will allow us to short circuit when given "python.exe". - # If it does match, only test that one, otherwise we have to try - # others. - if any(cmd.lower().endswith(ext.lower()) for ext in pathext): - files = [cmd] - else: - files = [cmd + ext for ext in pathext] - else: - # On other platforms you don't have things like PATHEXT to tell you - # what file suffixes are executable, so just pass on cmd as-is. - files = [cmd] - - seen = set() - for dir in path: - normdir = os.path.normcase(dir) - if not normdir in seen: - seen.add(normdir) - for thefile in files: - name = os.path.join(dir, thefile) - if _access_check(name, mode): - return name - return None - - -def which(cmd): - """ - Return the absolute path of the input executable string, based on the - user's current PATH variable. - - This is a wrapper for shutil.which that is compatible with Python 2. - - Parameters - ---------- - cmd: str - String containing the name of an executable on the user's path. - - Returns - ------- - str or None - String containing the absolute path of the executable, or None if - the executable was not found. - - """ - if sys.version_info > (3, 0): - import shutil - - return shutil.which(cmd) - else: - return which_py2(cmd) - - # Orca configuration class # ------------------------ class OrcaConfig(object): diff --git a/packages/python/plotly/plotly/io/_renderers.py b/packages/python/plotly/plotly/io/_renderers.py index cf2434036f8..325443262b5 100644 --- a/packages/python/plotly/plotly/io/_renderers.py +++ b/packages/python/plotly/plotly/io/_renderers.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division - import textwrap from copy import copy diff --git a/packages/python/plotly/plotly/io/_sg_scraper.py b/packages/python/plotly/plotly/io/_sg_scraper.py index 18defd11671..6afa4d68c49 100644 --- a/packages/python/plotly/plotly/io/_sg_scraper.py +++ b/packages/python/plotly/plotly/io/_sg_scraper.py @@ -1,12 +1,12 @@ # This module defines an image scraper for sphinx-gallery # https://sphinx-gallery.github.io/ # which can be used by projects using plotly in their documentation. -import inspect, os - -import plotly from glob import glob +import os import shutil +import plotly + plotly.io.renderers.default = "sphinx_gallery_png" diff --git a/packages/python/plotly/plotly/io/_templates.py b/packages/python/plotly/plotly/io/_templates.py index 800525b9508..85e2461f16f 100644 --- a/packages/python/plotly/plotly/io/_templates.py +++ b/packages/python/plotly/plotly/io/_templates.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import textwrap import pkgutil diff --git a/packages/python/plotly/plotly/io/_utils.py b/packages/python/plotly/plotly/io/_utils.py index 1b2d4a4cd97..658540ca71a 100644 --- a/packages/python/plotly/plotly/io/_utils.py +++ b/packages/python/plotly/plotly/io/_utils.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly import plotly.graph_objs as go from plotly.offline import get_plotlyjs_version diff --git a/packages/python/plotly/plotly/matplotlylib/__init__.py b/packages/python/plotly/plotly/matplotlylib/__init__.py index 7a5b7b83169..8891cc7c7c9 100644 --- a/packages/python/plotly/plotly/matplotlylib/__init__.py +++ b/packages/python/plotly/plotly/matplotlylib/__init__.py @@ -9,7 +9,5 @@ 'tools' module or 'plotly' package. """ -from __future__ import absolute_import - from plotly.matplotlylib.renderer import PlotlyRenderer from plotly.matplotlylib.mplexporter import Exporter diff --git a/packages/python/plotly/plotly/matplotlylib/mplexporter/_py3k_compat.py b/packages/python/plotly/plotly/matplotlylib/mplexporter/_py3k_compat.py deleted file mode 100644 index 83e4edb0f21..00000000000 --- a/packages/python/plotly/plotly/matplotlylib/mplexporter/_py3k_compat.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -Simple fixes for Python 2/3 compatibility -""" -import sys - -PY3K = sys.version_info[0] >= 3 - - -if PY3K: - import builtins - import functools - - reduce = functools.reduce - zip = builtins.zip - xrange = builtins.range - map = builtins.map -else: - import __builtin__ - import itertools - - builtins = __builtin__ - reduce = __builtin__.reduce - zip = itertools.izip - xrange = __builtin__.xrange - map = itertools.imap diff --git a/packages/python/plotly/plotly/matplotlylib/mplexporter/exporter.py b/packages/python/plotly/plotly/matplotlylib/mplexporter/exporter.py index f383f6bf20a..9824d274c1c 100644 --- a/packages/python/plotly/plotly/matplotlylib/mplexporter/exporter.py +++ b/packages/python/plotly/plotly/matplotlylib/mplexporter/exporter.py @@ -9,7 +9,7 @@ from . import utils import matplotlib -from matplotlib import transforms, collections +from matplotlib import transforms from matplotlib.backends.backend_agg import FigureCanvasAgg diff --git a/packages/python/plotly/plotly/matplotlylib/mplexporter/renderers/base.py b/packages/python/plotly/plotly/matplotlylib/mplexporter/renderers/base.py index 46237342dcb..fbb88197613 100644 --- a/packages/python/plotly/plotly/matplotlylib/mplexporter/renderers/base.py +++ b/packages/python/plotly/plotly/matplotlylib/mplexporter/renderers/base.py @@ -8,7 +8,6 @@ from matplotlib import transforms from .. import utils -from .. import _py3k_compat as py3k class Renderer(object): @@ -220,7 +219,7 @@ def _iter_path_collection(paths, path_transforms, offsets, styles): ] it = itertools - return it.islice(py3k.zip(*py3k.map(it.cycle, elements)), N) + return it.islice(zip(*map(it.cycle, elements)), N) def draw_path_collection( self, diff --git a/packages/python/plotly/plotly/matplotlylib/mpltools.py b/packages/python/plotly/plotly/matplotlylib/mpltools.py index 219f93374e3..9e69fb7fa4b 100644 --- a/packages/python/plotly/plotly/matplotlylib/mpltools.py +++ b/packages/python/plotly/plotly/matplotlylib/mpltools.py @@ -5,7 +5,6 @@ """ import math -import datetime import warnings import matplotlib.dates diff --git a/packages/python/plotly/plotly/matplotlylib/renderer.py b/packages/python/plotly/plotly/matplotlylib/renderer.py index 147d50fe0a9..b09f86c5b16 100644 --- a/packages/python/plotly/plotly/matplotlylib/renderer.py +++ b/packages/python/plotly/plotly/matplotlylib/renderer.py @@ -6,8 +6,6 @@ with the matplotlylib package. """ -from __future__ import absolute_import - import warnings import plotly.graph_objs as go diff --git a/packages/python/plotly/plotly/offline/offline.py b/packages/python/plotly/plotly/offline/offline.py index 3060b67d12f..ac05f7db4aa 100644 --- a/packages/python/plotly/plotly/offline/offline.py +++ b/packages/python/plotly/plotly/offline/offline.py @@ -3,13 +3,9 @@ without connecting to a public or private plotly enterprise server. """ -from __future__ import absolute_import - import os import warnings import pkgutil -import plotly -import plotly.tools from plotly.optional_imports import get_module from plotly import tools @@ -28,7 +24,6 @@ def download_plotlyjs(download_url): """, DeprecationWarning, ) - pass def get_plotlyjs_version(): @@ -165,7 +160,7 @@ def _get_jconfig(config=None): else: clean_config = {} - plotly_platform_url = plotly.tools.get_config_plotly_server_url() + plotly_platform_url = tools.get_config_plotly_server_url() if not clean_config.get("plotlyServerURL", None): clean_config["plotlyServerURL"] = plotly_platform_url @@ -697,7 +692,7 @@ def plot_mpl( plot_mpl(fig, image='png') ``` """ - plotly_plot = plotly.tools.mpl_to_plotly(mpl_fig, resize, strip_style, verbose) + plotly_plot = tools.mpl_to_plotly(mpl_fig, resize, strip_style, verbose) return plot( plotly_plot, show_link, @@ -780,7 +775,7 @@ def iplot_mpl( iplot_mpl(fig, image='jpeg') ``` """ - plotly_plot = plotly.tools.mpl_to_plotly(mpl_fig, resize, strip_style, verbose) + plotly_plot = tools.mpl_to_plotly(mpl_fig, resize, strip_style, verbose) return iplot( plotly_plot, show_link, diff --git a/packages/python/plotly/plotly/plotly/__init__.py b/packages/python/plotly/plotly/plotly/__init__.py index 2a0a2540675..82e48bddb4f 100644 --- a/packages/python/plotly/plotly/plotly/__init__.py +++ b/packages/python/plotly/plotly/plotly/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("plotly") diff --git a/packages/python/plotly/plotly/plotly/chunked_requests.py b/packages/python/plotly/plotly/plotly/chunked_requests.py index 585e76b6c40..5cab6418a2f 100644 --- a/packages/python/plotly/plotly/plotly/chunked_requests.py +++ b/packages/python/plotly/plotly/plotly/chunked_requests.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("plotly.chunked_requests") diff --git a/packages/python/plotly/plotly/presentation_objs.py b/packages/python/plotly/plotly/presentation_objs.py index aa54c668bc2..9822278c9e6 100644 --- a/packages/python/plotly/plotly/presentation_objs.py +++ b/packages/python/plotly/plotly/presentation_objs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("presentation_objs") diff --git a/packages/python/plotly/plotly/session.py b/packages/python/plotly/plotly/session.py index 7ce9ecbf851..857bf31b30d 100644 --- a/packages/python/plotly/plotly/session.py +++ b/packages/python/plotly/plotly/session.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("session") diff --git a/packages/python/plotly/plotly/subplots.py b/packages/python/plotly/plotly/subplots.py index 5e9e898474e..a2964c31a2c 100644 --- a/packages/python/plotly/plotly/subplots.py +++ b/packages/python/plotly/plotly/subplots.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import plotly.graph_objects as go from . import _subplots as _sub from ._subplots import SubplotXY, SubplotDomain, SubplotRef # noqa: F401 diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_annotations.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_annotations.py index 65aff11e98a..d4b1f6ccc5e 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_annotations.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_annotations.py @@ -5,7 +5,6 @@ A module intended for use with Nose. """ -from __future__ import absolute_import from unittest import skip from plotly.exceptions import ( diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_append_trace.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_append_trace.py index f01770ceb81..c4d0214baf9 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_append_trace.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_append_trace.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import pytest from plotly.graph_objs import ( diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_data.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_data.py index 136a043a46f..7b0f6438356 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_data.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_data.py @@ -5,7 +5,6 @@ A module intended for use with Nose. """ -from __future__ import absolute_import from unittest import skip diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_error_bars.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_error_bars.py index d12abbc24c6..83d6ad7af94 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_error_bars.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_error_bars.py @@ -5,8 +5,6 @@ A module intended for use with Nose. """ -from __future__ import absolute_import - from plotly.graph_objs import ErrorX, ErrorY from plotly.exceptions import PlotlyDictKeyError diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_figure.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_figure.py index 2b2ab734cce..57a6ca574eb 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_figure.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_figure.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly.graph_objects as go from plotly.subplots import make_subplots from plotly.tests.utils import TestCaseNoTemplate diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_frames.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_frames.py index c7dc96d8e82..f94c7dd744d 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_frames.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_frames.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from unittest import TestCase from plotly.graph_objs import Bar, Frames, Frame, Layout diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_instantiate_hierarchy.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_instantiate_hierarchy.py index c504b417031..02a40e23259 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_instantiate_hierarchy.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_instantiate_hierarchy.py @@ -1,8 +1,6 @@ -from __future__ import absolute_import from unittest import TestCase import os import importlib -import inspect from plotly.basedatatypes import BasePlotlyType, BaseFigure diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_repr.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_repr.py index 4ecdf05bcc7..efd9469489a 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_repr.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_repr.py @@ -1,5 +1,4 @@ -from __future__ import absolute_import, division -from unittest import TestCase, SkipTest +from unittest import TestCase import plotly.graph_objs as go diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_scatter.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_scatter.py index 78d3aa1d773..81bca41da41 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_scatter.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_scatter.py @@ -5,8 +5,6 @@ A module intended for use with Nose. """ -from __future__ import absolute_import - from plotly.graph_objs import Scatter from plotly.exceptions import PlotlyError diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_template.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_template.py index 2cecffae58e..ab8cfc60b6e 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_template.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_template.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import copy from unittest import TestCase import pytest diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_to_ordered_dict.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_to_ordered_dict.py index 1a577bffe54..0a0846ae849 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_to_ordered_dict.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_to_ordered_dict.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly.graph_objs as go from collections import OrderedDict from plotly.tests.utils import TestCaseNoTemplate diff --git a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_update.py b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_update.py index c7895203f9f..74670bb0d06 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_update.py +++ b/packages/python/plotly/plotly/tests/test_core/test_graph_objs/test_update.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from unittest import skip import plotly.graph_objs as go diff --git a/packages/python/plotly/plotly/tests/test_core/test_offline/test_offline.py b/packages/python/plotly/plotly/tests/test_core/test_offline/test_offline.py index 5d387e5e1b3..4c3e47412dd 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_offline/test_offline.py +++ b/packages/python/plotly/plotly/tests/test_core/test_offline/test_offline.py @@ -2,20 +2,15 @@ test__offline """ -from __future__ import absolute_import - +import json import os from unittest import TestCase import pytest -import json as _json - import plotly import plotly.io as pio from plotly.io._utils import plotly_cdn_url -import json - packages_root = os.path.dirname( os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(plotly.__file__)))) ) diff --git a/packages/python/plotly/plotly/tests/test_core/test_optional_imports/test_optional_imports.py b/packages/python/plotly/plotly/tests/test_core/test_optional_imports/test_optional_imports.py index 8646840b4cc..defe88afd51 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_optional_imports/test_optional_imports.py +++ b/packages/python/plotly/plotly/tests/test_core/test_optional_imports/test_optional_imports.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import sys from unittest import TestCase from plotly.optional_imports import get_module diff --git a/packages/python/plotly/plotly/tests/test_core/test_subplots/test_get_subplot.py b/packages/python/plotly/plotly/tests/test_core/test_subplots/test_get_subplot.py index faa16e0d19f..7c6d32337e5 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_subplots/test_get_subplot.py +++ b/packages/python/plotly/plotly/tests/test_core/test_subplots/test_get_subplot.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from unittest import TestCase from plotly.graph_objs import Figure from plotly import subplots diff --git a/packages/python/plotly/plotly/tests/test_core/test_subplots/test_make_subplots.py b/packages/python/plotly/plotly/tests/test_core/test_subplots/test_make_subplots.py index 28ad18f19a6..539cbecc852 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_subplots/test_make_subplots.py +++ b/packages/python/plotly/plotly/tests/test_core/test_subplots/test_make_subplots.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from unittest import TestCase import pytest from plotly.graph_objs import ( diff --git a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_selector_matches.py b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_selector_matches.py index 8a00e7d33c3..6194443d321 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_selector_matches.py +++ b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_selector_matches.py @@ -1,5 +1,3 @@ -import pytest - import plotly.graph_objects as go from plotly.basedatatypes import BaseFigure diff --git a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py index d1c81a31131..08803b43894 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py +++ b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import types from unittest import TestCase diff --git a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_subplots.py b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_subplots.py index 663aa6f8386..6abfd8ec5a4 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_subplots.py +++ b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_subplots.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import copy from unittest import TestCase diff --git a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_traces.py b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_traces.py index 54c6a77bfc7..5f8f48bef90 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_traces.py +++ b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_traces.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from unittest import TestCase import inspect import copy 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 0aff7eb2817..6d3c1bffd1c 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 @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from unittest import TestCase from plotly.utils import PlotlyJSONEncoder, get_by_path, node_generator diff --git a/packages/python/plotly/plotly/tests/test_optional/optional_utils.py b/packages/python/plotly/plotly/tests/test_optional/optional_utils.py index 1c7ba3ad68e..35a4aacb657 100644 --- a/packages/python/plotly/plotly/tests/test_optional/optional_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/optional_utils.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import numpy as np from plotly import optional_imports diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/annotations.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/annotations.py index 17bbeb845c6..7ef3f2c0d40 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/annotations.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/annotations.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly.graph_objs as go ANNOTATIONS = go.Figure( diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/axis_scales.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/axis_scales.py index 842b205c510..ba8838d49d1 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/axis_scales.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/axis_scales.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly.graph_objs as go D = dict(x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], y=[10, 3, 100, 6, 45, 4, 80, 45, 3, 59]) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/bars.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/bars.py index ad396cea67c..7a5f3cb2610 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/bars.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/bars.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly.graph_objs as go D = dict( diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/lines.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/lines.py index 54fab5fb0c7..07312272d99 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/lines.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/lines.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly.graph_objs as go D = dict( diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/scatter.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/scatter.py index f05f60e117b..2417e0a22fc 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/scatter.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/scatter.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly.graph_objs as go D = dict( diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/subplots.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/subplots.py index 63dd06cf31f..443ac101584 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/subplots.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/data/subplots.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import plotly.graph_objs as go D = dict(x1=[0, 1], y1=[1, 2]) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_annotations.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_annotations.py index cd461539832..bef9abf1d85 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_annotations.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_annotations.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import pytest from plotly import optional_imports diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py index 046eec976e3..e4536e2f37d 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import pytest from plotly import optional_imports diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_bars.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_bars.py index 97ccad646a8..683277105d3 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_bars.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_bars.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import pytest from plotly import optional_imports diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_data.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_data.py index 565802caaee..213fd5f3816 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_data.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_data.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import pytest from plotly import optional_imports diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_date_times.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_date_times.py index bbc552f8669..3135d05bd25 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_date_times.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_date_times.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import datetime import random from unittest import TestCase diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_lines.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_lines.py index dcc8ca36c7e..e12d49afd60 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_lines.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_lines.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import pytest from plotly import optional_imports diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_scatter.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_scatter.py index 9fb2feedc62..35bc85d8460 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_scatter.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_scatter.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import pytest from plotly import optional_imports diff --git a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_subplots.py b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_subplots.py index d2aa3ab2209..147fecdc50a 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_subplots.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_matplotlylib/test_subplots.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import pytest from plotly import optional_imports 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 e7686958420..ac099665639 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 @@ -2,9 +2,7 @@ test__offline """ -from __future__ import absolute_import import re -import json as _json from unittest import TestCase import pytest 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 45f72a0fe1d..cf32e1bdff8 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 @@ -2,8 +2,6 @@ Module to test plotly.utils with optional dependencies. """ -from __future__ import absolute_import - import datetime import math import decimal diff --git a/packages/python/plotly/plotly/tools.py b/packages/python/plotly/plotly/tools.py index feddc31cc23..cbfff43b9e7 100644 --- a/packages/python/plotly/plotly/tools.py +++ b/packages/python/plotly/plotly/tools.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """ tools ===== @@ -7,12 +5,9 @@ Functions that USERS will possibly want access to. """ -from __future__ import absolute_import - import json import warnings -import re import os from plotly import exceptions, optional_imports diff --git a/packages/python/plotly/plotly/utils.py b/packages/python/plotly/plotly/utils.py index 23c8a4441f4..6271631416b 100644 --- a/packages/python/plotly/plotly/utils.py +++ b/packages/python/plotly/plotly/utils.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division - import textwrap from pprint import PrettyPrinter diff --git a/packages/python/plotly/plotly/widgets.py b/packages/python/plotly/plotly/widgets.py index 23f6c7aaba8..1d4fa030b85 100644 --- a/packages/python/plotly/plotly/widgets.py +++ b/packages/python/plotly/plotly/widgets.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from _plotly_future_ import _chart_studio_error _chart_studio_error("widgets") diff --git a/packages/python/plotly/setup.cfg b/packages/python/plotly/setup.cfg index 41917384385..0da18fcf66d 100644 --- a/packages/python/plotly/setup.cfg +++ b/packages/python/plotly/setup.cfg @@ -2,9 +2,6 @@ description_file = README.md license_files = LICENSE.txt -[bdist_wheel] -universal=1 - [versioneer] VCS = git style = pep440 diff --git a/packages/python/plotly/setup.py b/packages/python/plotly/setup.py index 178f176457c..a9a2ac5869f 100644 --- a/packages/python/plotly/setup.py +++ b/packages/python/plotly/setup.py @@ -420,7 +420,7 @@ def run(self): # update plotly.js version in _plotlyjs_version rev = build_info["vcs_revision"] - date = build_info["committer_date"] + date = str(build_info["committer_date"]) version = "_".join([self.devrepo, self.devbranch, date[:10], rev[:8]]) overwrite_plotlyjs_version_file(version) diff --git a/release.md b/release.md index e1ea03ac42b..bc879a01708 100644 --- a/release.md +++ b/release.md @@ -68,7 +68,7 @@ To locally install the PyPI dist, make sure you have an environment with Jupyter - `tar xzf all.tgz` - `pip uninstall plotly` - `conda uninstall plotly` (just in case!) -- `pip install path/to/output/dist/plotly-X.Y.X-py2.py3-none-any.whl` +- `pip install path/to/output/dist/plotly-X.Y.X-py3-none-any.whl` To locally install the Conda dist (generally do this in a different, clean environment from the one above!): @@ -270,4 +270,3 @@ From `packages/python/plotly-geo`, build the conda package ``` Then upload to the plotly anaconda channel as described above. -