Skip to content

Commit bf3c687

Browse files
committed
Revert "Merge pull request plotly#220 from plotly/manifest-file"
This reverts commit a97c888, reversing changes made to a5f5067.
1 parent a97c888 commit bf3c687

File tree

6 files changed

+33
-68
lines changed

6 files changed

+33
-68
lines changed

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

plotly/graph_objs/graph_objs_tools.py

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
from __future__ import absolute_import
2+
from plotly import utils
23
import textwrap
34
import os
45
import sys
5-
6-
from plotly import utils
7-
from plotly.resources import (GRAPH_REFERENCE_GRAPH_OBJS_META,
8-
GRAPH_REFERENCE_NAME_TO_KEY,
9-
GRAPH_REFERENCE_KEY_TO_NAME,
10-
GRAPH_REFERENCE_OBJ_MAP, GRAPH_REFERENCE_DIR)
11-
126
if sys.version[:3] == '2.6':
137
try:
148
from ordereddict import OrderedDict
@@ -25,27 +19,23 @@
2519
import json
2620
import six
2721

22+
from pkg_resources import resource_string
2823

29-
def _load_graph_ref():
30-
"""
31-
A private method to load the graph reference json files.
32-
33-
:return: (tuple) A tuple of dict objects.
34-
35-
"""
36-
out = []
3724

38-
# this splits directory path from basenames
39-
filenames = [
40-
os.path.split(GRAPH_REFERENCE_GRAPH_OBJS_META)[-1],
41-
os.path.split(GRAPH_REFERENCE_OBJ_MAP)[-1],
42-
os.path.split(GRAPH_REFERENCE_NAME_TO_KEY)[-1],
43-
os.path.split(GRAPH_REFERENCE_KEY_TO_NAME)[-1]
25+
# Define graph reference loader
26+
def _load_graph_ref():
27+
graph_reference_dir = 'graph_reference'
28+
json_files = [
29+
'graph_objs_meta.json',
30+
'OBJ_MAP.json',
31+
'NAME_TO_KEY.json',
32+
'KEY_TO_NAME.json'
4433
]
45-
for filename in filenames:
46-
path = os.path.join(sys.prefix, GRAPH_REFERENCE_DIR, filename)
47-
with open(path, 'r') as f:
48-
tmp = json.load(f, object_pairs_hook=OrderedDict)
34+
out = []
35+
for json_file in json_files:
36+
relative_path = os.path.join(graph_reference_dir, json_file)
37+
s = resource_string('plotly', relative_path).decode('utf-8')
38+
tmp = json.loads(s, object_pairs_hook=OrderedDict)
4939
tmp = utils.decode_unicode(tmp)
5040
out += [tmp]
5141
return tuple(out)

plotly/resources.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

plotly/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.6.18'
1+
__version__ = '1.6.17'

plotly/widgets/graph_widget.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import os
2-
import sys
3-
import uuid
41
from collections import deque
2+
import uuid
3+
import sys
54

65
# TODO: protected imports?
76
from IPython.html import widgets
@@ -11,7 +10,7 @@
1110
import plotly.plotly.plotly as py
1211
from plotly import utils, tools
1312
from plotly.graph_objs import Figure
14-
from plotly.resources import WIDGETS_DIR, WIDGETS_MAIN_JS
13+
from pkg_resources import resource_string
1514

1615
# even though python 2.6 wouldn't be able to run *any* of this...
1716
if sys.version[:3] == '2.6':
@@ -22,10 +21,8 @@
2221
# Load JS widget code
2322
# No officially recommended way to do this in any other way
2423
# http://mail.scipy.org/pipermail/ipython-dev/2014-April/013835.html
25-
js_file_path = os.path.join(sys.prefix, WIDGETS_DIR,
26-
os.path.split(WIDGETS_MAIN_JS)[-1])
27-
with open(js_file_path, 'r') as f:
28-
js_widget_code = f.read()
24+
js_widget_code = resource_string('plotly',
25+
'widgets/graphWidget.js').decode('utf-8')
2926

3027
display(Javascript(js_widget_code))
3128

setup.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import setup
22

33
exec (open('plotly/version.py').read())
4-
exec (open('plotly/resources.py').read())
54

65

76
def readme():
87
with open('README.rst') as f:
98
return f.read()
109

10+
1111
setup(name='plotly',
1212
version=__version__,
1313
use_2to3=False,
@@ -31,9 +31,16 @@ def readme():
3131
'Topic :: Scientific/Engineering :: Visualization',
3232
],
3333
license='MIT',
34-
packages=find_packages(),
35-
data_files=[(GRAPH_REFERENCE_DIR, GRAPH_REFERENCE_FILES),
36-
(WIDGETS_DIR, WIDGETS_FILES)],
34+
packages=['plotly',
35+
'plotly/plotly',
36+
'plotly/plotly/chunked_requests',
37+
'plotly/graph_objs',
38+
'plotly/grid_objs',
39+
'plotly/widgets',
40+
'plotly/matplotlylib',
41+
'plotly/matplotlylib/mplexporter',
42+
'plotly/matplotlylib/mplexporter/renderers'],
43+
package_data={'plotly': ['graph_reference/*.json', 'widgets/*.js']},
3744
install_requires=['requests[security]', 'six', 'pytz'],
3845
extras_require={"PY2.6": ['simplejson', 'ordereddict',
3946
'requests[security]']},

0 commit comments

Comments
 (0)