Skip to content

Commit

Permalink
V4 chart studio extraction (plotly#1597)
Browse files Browse the repository at this point in the history
* Move plotly package under plotly-package directory
* Move codegen, submodules, templategen to plotly-package directory
* remove unused example images directory
* optional import of chart_studio in src validator
* Move figure factory tests to plotly-figure-factory-package
* Split out plotly/package_data into the appropriate distribution package
* Update setup.py packages
* Update codegen for new directory structure
* Update setup.py tasks for new directory structure
* Add license file per subproject
* Move figure_factory module back into plotly package and extract the
geo shape files into a _plotly_geo data package
* Remove legacy graph_reference module
* Update test_offline to not depend on working directory
* Update config.yml test
* Update test_offline paths
* CI updates
* Remove plotly.tests import in chart_studio tests
* Install plotly-geo-package
  • Loading branch information
jonmmease authored Jun 5, 2019
1 parent 2a44ce3 commit e840a9f
Show file tree
Hide file tree
Showing 1,457 changed files with 5,012 additions and 1,238 deletions.
51 changes: 27 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Test with tox
command: 'tox -e py27-core'
command: 'cd plotly-package; tox -e py27-core'
no_output_timeout: 20m

python-3.5-core:
Expand All @@ -31,7 +31,7 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Test with tox
command: 'tox -e py35-core'
command: 'cd plotly-package; tox -e py35-core'
no_output_timeout: 20m

python-3.6-core:
Expand All @@ -47,7 +47,7 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Test with tox
command: 'tox -e py36-core'
command: 'cd plotly-package; tox -e py36-core'
no_output_timeout: 20m

python-3.7-core:
Expand All @@ -63,7 +63,7 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Test with tox
command: 'tox -e py37-core'
command: 'cd plotly-package; tox -e py37-core'
no_output_timeout: 20m

# Optional
Expand All @@ -80,11 +80,11 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Install npm dependencies
command: cd plotly/tests/test_optional/test_jupyter && npm install
command: cd plotly-package/plotly/tests/test_optional/test_jupyter && npm install
no_output_timeout: 20m
- run:
name: Test with tox
command: 'tox -e py27-optional'
command: 'cd plotly-package; tox -e py27-optional'
no_output_timeout: 20m

python-3.5-optional:
Expand All @@ -100,11 +100,11 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Install npm dependencies
command: cd plotly/tests/test_optional/test_jupyter && npm install
command: cd plotly-package/plotly/tests/test_optional/test_jupyter && npm install
no_output_timeout: 20m
- run:
name: Test with tox
command: 'tox -e py35-optional'
command: 'cd plotly-package; tox -e py35-optional'
no_output_timeout: 20m

python-3.6-optional:
Expand All @@ -120,11 +120,11 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Install npm dependencies
command: cd plotly/tests/test_optional/test_jupyter && npm install
command: cd plotly-package/plotly/tests/test_optional/test_jupyter && npm install
no_output_timeout: 20m
- run:
name: Test with tox
command: 'tox -e py36-optional'
command: 'cd plotly-package; tox -e py36-optional'
no_output_timeout: 20m

python-3.7-optional:
Expand All @@ -140,11 +140,11 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Install npm dependencies
command: cd plotly/tests/test_optional/test_jupyter && npm install
command: cd plotly-package/plotly/tests/test_optional/test_jupyter && npm install
no_output_timeout: 20m
- run:
name: Test with tox
command: 'tox -e py37-optional'
command: 'cd plotly-package; tox -e py37-optional'
no_output_timeout: 20m

# Plot.ly
Expand All @@ -161,7 +161,7 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Test with tox
command: 'tox -e py27-plot_ly'
command: 'cd chart-studio-package; tox -e py27-plot_ly'
no_output_timeout: 20m

python-3.5-plot_ly:
Expand All @@ -177,7 +177,7 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Test with tox
command: 'tox -e py35-plot_ly'
command: 'cd chart-studio-package; tox -e py35-plot_ly'
no_output_timeout: 20m

python-3.7-plot_ly:
Expand All @@ -193,7 +193,7 @@ jobs:
command: 'sudo pip install tox'
- run:
name: Test with tox
command: 'tox -e py37-plot_ly'
command: 'cd chart-studio-package; tox -e py37-plot_ly'
no_output_timeout: 20m

python-2-7-orca:
Expand All @@ -220,8 +220,8 @@ jobs:
command: |
. /home/circleci/miniconda/etc/profile.d/conda.sh
conda activate circle_optional
pytest --disable-warnings plotly/tests/test_core
pytest plotly/tests/test_orca
pytest --disable-warnings plotly-package/plotly/tests/test_core
pytest plotly-package/plotly/tests/test_orca
- store_artifacts:
path: plotly/tests/test_orca/images/linux/failed
Expand Down Expand Up @@ -250,8 +250,8 @@ jobs:
command: |
. /home/circleci/miniconda/etc/profile.d/conda.sh
conda activate circle_optional
pytest --disable-warnings plotly/tests/test_core
pytest plotly/tests/test_orca
pytest --disable-warnings plotly-package/plotly/tests/test_core
pytest plotly-package/plotly/tests/test_orca
- store_artifacts:
path: plotly/tests/test_orca/images/linux/failed
Expand Down Expand Up @@ -280,8 +280,8 @@ jobs:
command: |
. /home/circleci/miniconda/etc/profile.d/conda.sh
conda activate circle_optional
pytest --disable-warnings plotly/tests/test_core
pytest plotly/tests/test_orca
pytest --disable-warnings plotly-package/plotly/tests/test_core
pytest plotly-package/plotly/tests/test_orca
- store_artifacts:
path: plotly/tests/test_orca/images/linux/failed
Expand All @@ -300,19 +300,21 @@ jobs:
command: 'sudo pip install tox requests yapf pytz decorator retrying inflect'
- run:
name: Update plotlywidget version
command: 'python setup.py updateplotlywidgetversion'
command: 'cd plotly-package; python setup.py updateplotlywidgetversion'
- run:
name: Update plotly.js to dev
command: 'python setup.py updateplotlyjsdev'
command: 'cd plotly-package; python setup.py updateplotlyjsdev'
- run:
name: Test with tox
command: |
cd plotly-package
locale
tox -e py37-core -- -a '!nodev'
no_output_timeout: 20m
- run:
name: Commit
command: |
cd plotly-package
sudo mkdir /dist
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Expand All @@ -322,6 +324,7 @@ jobs:
- run:
name: Build source distribution package
command: |
cd plotly-package
python setup.py sdist
sudo cp dist/* /dist
when: always
Expand All @@ -334,7 +337,7 @@ jobs:
sudo cp ./plotlywidget* /dist
when: always
- store_artifacts:
path: /dist
path: plotly-package/dist

workflows:
version: 2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ plotly.egg-info/

plotly/tests/test_orca/images/*/failed
plotly/tests/test_orca/images/*/tmp
/plotly-package/plotly/tests/test_core/test_offline/plotly.min.js
/plotly-package/plotly/tests/test_core/test_offline/temp-plot.html
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@

import _plotly_utils.utils
from chart_studio.grid_objs import Column
from plotly import utils
from plotly.tests.test_optional.test_utils.test_utils import numeric_list, \
mixed_list, np_list
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)])
numeric_list = [1, 2, 3]
mixed_list = [1, 'A', dt(2014, 1, 5), dt(2014, 1, 5, 1, 1, 1),
dt(2014, 1, 5, 1, 1, 1, 1)]


class TestJSONEncoder(TestCase):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ def stash_session(self):

def restore_session(self):
session._session.clear() # clear and update to preserve references.
session._session.update(self._session)
session._session.update(self._session)
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,4 @@ def __init__(self, url, width, height):
super(PlotlyDisplay, self).__init__(data=self.embed_code)

def _repr_html_(self):
return self.embed_code
return self.embed_code
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Load JS widget code
# No officially recommended way to do this in any other way
# http://mail.scipy.org/pipermail/ipython-dev/2014-April/013835.html
js_widget_code = pkgutil.get_data('plotly',
js_widget_code = pkgutil.get_data('chart_studio',
'package_data/graphWidget.js'
).decode('utf-8')

Expand Down
51 changes: 51 additions & 0 deletions chart-studio-package/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from setuptools import setup
import os


def readme():
parent_dir = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(parent_dir, 'README.md')) as f:
return f.read()


setup(
name="chart-studio",
version="1.0.0a1",
author="Chris P",
author_email="[email protected]",
maintainer="Jon Mease",
maintainer_email="[email protected]",
url="https://plot.ly/python/",
project_urls={"Github": "https://github.com/plotly/plotly.py"},
description="An open-source, interactive graphing library for Python",
long_description=readme(),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering :: Visualization",
],
license="MIT",
packages=[
"chart_studio",
"chart_studio.api",
"chart_studio.api.v1",
"chart_studio.api.v2",
"chart_studio.dashboard_objs",
"chart_studio.grid_objs",
"chart_studio.plotly",
"chart_studio.plotly.chunked_requests",
"chart_studio.presentation_objs",
"chart_studio.widgets",
],
package_data={'chart_studio': ['package_data/*']},
install_requires=["plotly", "requests", "retrying>=1.3.3", "six"],
zip_safe=False,
)
File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions chart-studio-package/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
; Tox is a testing tool that manages virtualenvs for testing multiple Python
; environments in a consistent/controlled way.

; SETTING ENVIRONMENT VARIABLES AND TOX TESTING VARIABLES
;
; You can limit tox testing to certain environments via the `-e` (envlist)
; command line option:
; tox -e py27-core,py34-core
; OR, you can just set the `TOXENV` environment variable, which is handy:
; TOXENV=py27-core,py34-core
;
; Integrating with the virtualenvs in Circle CI is a bit of a pain. For
; whatever reason the "executable" `python35` (at the time of writing) cannot
; be activated directly. Instead the circle.yml file specifies the actual
; binary directly. Because of this, you too have to set the following env
; variables:
; PLOTLY_TOX_PYTHON_27=python2.7
; PLOTLY_TOX_PYTHON_34=python3.4
; ...
; These will be specific to your machine and may not look like the ones above.
; If you're not testing with all the python versions (see TOXENV above),
; there's no need to install and map other versions.

; PASSING ADDITONAL ARGUMENTS TO TEST COMMANDS
; The {posargs} is tox-specific and passes in any command line args after `--`.
; For example, given the testing command in *this* file:
; nosetests {posargs} -x plotly/tests/test_core
;
; The following command:
; tox -- -a '!slow'
;
; Tells tox to call:
; nosetests -a '!slow' -x plotly/tests/test_core
;
; Which is a nice way to skip slow tests for faster testing cycles.

[tox]
; The py{A,B,C}-{X,Y} generates a matrix of envs:
; pyA-X,pyA-Y,pyB-X,pyB-Y,pyC-X,pyC-Y
envlist = py{27,34,37}-plot_ly

; Note that envs can be targeted by deps using the <target>: dep syntax.
; Only one dep is allowed per line as of the time of writing. The <target>
; can be a `-` (hyphen) concatenated string of the environments to target
; with the given dep.

; These commands are general and will be run for *all* environments.
[testenv]
passenv=PLOTLY_TOX_*
whitelist_externals=
mkdir
deps=
coverage==4.3.1
decorator==4.0.9
mock==2.0.0
nose==1.3.7
requests==2.12.4
six==1.10.0
pytz==2016.10
retrying==1.3.3
pytest==3.5.1
backports.tempfile==1.0
pandas==0.23.2
numpy==1.14.3
ipywidgets==7.2.0
matplotlib==2.2.3
--editable=file:///{toxinidir}/../plotly-package


; Plot.ly environments
[testenv:py27-plot_ly]
basepython={env:PLOTLY_TOX_PYTHON_27:}
commands=
python --version
nosetests {posargs} -x chart_studio/tests/

[testenv:py35-plot_ly]
basepython={env:PLOTLY_TOX_PYTHON_35:}
commands=
python --version
nosetests {posargs} -x chart_studio/tests/

[testenv:py37-plot_ly]
basepython={env:PLOTLY_TOX_PYTHON_37:}
commands=
python --version
nosetests {posargs} -x chart_studio/tests/
Binary file removed example_images/simple_scatter.png
Binary file not shown.
Binary file removed example_images/subplot_methods.png
Binary file not shown.
6 changes: 4 additions & 2 deletions js/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = [
entry: './src/extension.js',
output: {
filename: 'extension.js',
path: path.resolve(__dirname, '..', 'plotlywidget', 'static'),
path: path.resolve(
__dirname, '..', 'plotly-package', 'plotlywidget', 'static'),
libraryTarget: 'amd'
}
},
Expand All @@ -34,7 +35,8 @@ module.exports = [
entry: './src/index.js',
output: {
filename: 'index.js',
path: path.resolve(__dirname, '..', 'plotlywidget', 'static'),
path: path.resolve(
__dirname, '..', 'plotly-package', 'plotlywidget', 'static'),
libraryTarget: 'amd'
},
node: {
Expand Down
Loading

0 comments on commit e840a9f

Please sign in to comment.