diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 0000000..e61a3ce --- /dev/null +++ b/.github/workflows/config.yml @@ -0,0 +1,25 @@ +name: Run unit tests (Python 3.8) +on: [ push ] + +jobs: + python_38_chart_studio: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.8' + - name: Install dependencies + run: | + python -m venv venv + . venv/bin/activate + pip install --upgrade pip wheel + pip install -r ./test_requirements/requirements_38.txt + - name: Run unit tests + run: | + . venv/bin/activate + pytest -x chart_studio/tests/ + timeout-minutes: 20 + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/LICENSE.txt b/LICENSE.txt index 359e5d3..2d78924 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2019 Plotly, Inc +Copyright (c) 2016-2025 Plotly, Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index a24b0e4..f5be159 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # chart-studio -This package contains utilities for interfacing with Plotly's Chart Studio service (both Chart Studio cloud and Chart Studio On-Prem). Prior to plotly.py version 4, This functionality was included in the `plotly` package under the `plotly.plotly` module. As part of plotly.py version 4, the Chart Studio functionality was removed from the `plotly` package and released in this `chart-studio` package. +The chart-studio Python package contains utilities for interfacing with Plotly's Chart Studio service (both Chart Studio cloud and Chart Studio On-Prem). + +Prior to plotly.py version 4, these Chart Studio utilities were included in the `plotly` package under the `plotly.plotly` module. As part of plotly.py version 4, the Chart Studio functionality was removed from the `plotly` package and released in this `chart-studio` package. + +This repository contains _only_ the chart-studio Python package; code for the Chart Studio service itself is located elsewhere. + +_Note: chart-studio was previously housed in the [Plotly.py](https://github.com/plotly/plotly.py) repository [until early 2025](https://github.com/plotly/plotly.py/pull/4972). This repository retains the Git history for all chart-studio files, dating back to [mid-2019](https://github.com/plotly/plotly.py/pull/1604) when the Plotly.py directory structure was changed. If you want to follow the history of these files back further in time, start [here](https://github.com/plotly/plotly.py/commits/59e36cf850bdb2384ddaf40ac37ad79f691c610c/chart-studio-package/README.md?browsing_rename_history=true&new_path=packages/python/chart-studio/README.md&original_branch=master)._ diff --git a/chart_studio/tests/test_optional/test_matplotlylib/test_plot_mpl.py b/chart_studio/tests/test_optional/test_matplotlylib/test_plot_mpl.py index 8ca3614..3691c3c 100644 --- a/chart_studio/tests/test_optional/test_matplotlylib/test_plot_mpl.py +++ b/chart_studio/tests/test_optional/test_matplotlylib/test_plot_mpl.py @@ -44,7 +44,10 @@ def test_update(self): ax.plot([1, 2, 3]) title = "new title" update = {"layout": {"title": title}} - url = py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False) + # Note: Changed filename from "nosetests" to "nosetests2" because the + # previous filename was resulting in a recurring error -- + # `chart_studio.exceptions.PlotlyRequestError: Sorry, a file named 'nosetests_grid' already exists` + url = py.plot_mpl(fig, update=update, filename="nosetests2", auto_open=False) un = url.replace("https://plotly.com/~", "").split("/")[0] fid = url.replace("https://plotly.com/~", "").split("/")[1] pfig = py.get_figure(un, fid) diff --git a/chart_studio/tests/test_optional/test_utils/test_utils.py b/chart_studio/tests/test_optional/test_utils/test_utils.py index b72962d..742a1b2 100644 --- a/chart_studio/tests/test_optional/test_utils/test_utils.py +++ b/chart_studio/tests/test_optional/test_utils/test_utils.py @@ -6,7 +6,7 @@ from datetime import datetime as dt import numpy as np -np_list = np.array([1, 2, 3, np.NaN, np.NAN, np.Inf, dt(2014, 1, 5)]) +np_list = np.array([1, 2, 3, np.nan, np.nan, np.inf, dt(2014, 1, 5)]) numeric_list = [1, 2, 3] mixed_list = [ 1, diff --git a/chart_studio/tests/test_plot_ly/test_get_figure/test_get_figure.py b/chart_studio/tests/test_plot_ly/test_get_figure/test_get_figure.py index 04816fe..72ac805 100644 --- a/chart_studio/tests/test_plot_ly/test_get_figure/test_get_figure.py +++ b/chart_studio/tests/test_plot_ly/test_get_figure/test_get_figure.py @@ -94,4 +94,9 @@ def test_proper_escaping(self): ak = "786r5mecv0" url = "https://plotly.com/~PlotlyImageTest/13185/" py.sign_in(un, ak) - py.get_figure(url) + # Note: raw=True added because the specified chart contains + # the property 'titlefont' which is no longer supported in + # plotly.py 6.0.0, so an error is raised when trying to create + # the chart object. raw=True just returns the raw JSON without + # trying to create the chart object. + py.get_figure(url, raw=True) diff --git a/release.md b/release.md new file mode 100644 index 0000000..f6f1950 --- /dev/null +++ b/release.md @@ -0,0 +1,46 @@ +## Release process - `chart-studio` package + +The `chart-studio` package contains the utilities for interacting with +Chart Studio (both Cloud or On-Prem). + +### Update version + +Update the version of the `chart-studio` package in +`setup.py`. + +This version is not intended to match the version of plotly.py. + +### Update CHANGELOG + +Add a new entry to the CHANGELOG at `CHANGELOG.md` and commit the changes. + +### Tag Release + +Create a new tag for the release + +```bash +(plotly_dev) $ git checkout main +(plotly_dev) $ git stash +(plotly_dev) $ git pull origin main +(plotly_dev) $ git tag vX.Y.Z +(plotly_dev) $ git push origin vX.Y.Z +``` + +### Publishing to PYPI + +Publish the final version to PyPI + +```bash +(plotly_dev) $ python setup.py sdist bdist_wheel +(plotly_dev) $ twine upload dist/chart_studio-X.Y.Z.tar.gz +(plotly_dev) $ twine upload dist/chart_studio-X.Y.Z-py3-none-any.whl +``` + +### Publish to plotly anaconda channel + +From `packages/python/plotly-geo`, build the conda package +```bash +(plotly_dev) $ conda build recipe/ +``` + +Then upload to the plotly anaconda channel as described above. \ No newline at end of file diff --git a/setup.py b/setup.py index 5342b1f..7bfa466 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ def readme(): maintainer="Jon Mease", maintainer_email="jon@plot.ly", url="https://plot.ly/python/", - project_urls={"Github": "https://github.com/plotly/plotly.py"}, + project_urls={"Github": "https://github.com/plotly/chart-studio"}, description="Utilities for interfacing with plotly's Chart Studio", long_description=readme(), long_description_content_type="text/markdown", @@ -28,6 +28,11 @@ def readme(): "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Visualization", ], license="MIT", diff --git a/test_requirements/requirements_37.txt b/test_requirements/requirements_37.txt deleted file mode 100644 index 32bba34..0000000 --- a/test_requirements/requirements_37.txt +++ /dev/null @@ -1,11 +0,0 @@ -decorator==4.0.9 -nose==1.3.7 -requests==2.12.4 -pytz==2016.10 -retrying==1.3.3 -pytest==3.5.1 -pandas==0.23.2 -numpy==1.14.3 -anywidget -matplotlib==2.2.3 ---editable=./plotly diff --git a/test_requirements/requirements_38.txt b/test_requirements/requirements_38.txt new file mode 100644 index 0000000..9df55ae --- /dev/null +++ b/test_requirements/requirements_38.txt @@ -0,0 +1,11 @@ +decorator +nose +requests +pytz +retrying +pytest +pandas +plotly +numpy +anywidget +matplotlib