Skip to content

Commit 12bb30b

Browse files
committed
Move all our package_data files into one dir.
This has been a source of confusion every time we end up needing a new resource (like a js or json file). If you forget to add the new pattern in `setup.py`, the installed site-package just won’t include the file. Now all our non `.py` files should live in `package_data/`.
1 parent 13372f2 commit 12bb30b

File tree

6 files changed

+4
-6
lines changed

6 files changed

+4
-6
lines changed

Diff for: makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ update_plotlyjs_for_offline :
6868
cdn_url = 'https://cdn.plot.ly/plotly-latest.min.js';\
6969
response = urllib2.urlopen(cdn_url);\
7070
html = response.read();\
71-
f = open('./plotly/offline/plotly.min.js', 'w');\
71+
f = open('./plotly/package_data/plotly.min.js', 'w');\
7272
f.write(html);\
7373
f.close()"
7474
@echo "---------------------------------"

Diff for: plotly/offline/offline.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def download_plotlyjs(download_url):
4545

4646

4747
def get_plotlyjs():
48-
path = os.path.join('offline', 'plotly.min.js')
48+
path = os.path.join('package_data', 'plotly.min.js')
4949
plotlyjs = resource_string('plotly', path).decode('utf-8')
5050
return plotlyjs
5151

File renamed without changes.
File renamed without changes.

Diff for: plotly/widgets/graph_widget.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# No officially recommended way to do this in any other way
2222
# http://mail.scipy.org/pipermail/ipython-dev/2014-April/013835.html
2323
js_widget_code = resource_string('plotly',
24-
'widgets/graphWidget.js').decode('utf-8')
24+
'package_data/graphWidget.js').decode('utf-8')
2525

2626
display(Javascript(js_widget_code))
2727

Diff for: setup.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ def readme():
4040
'plotly/matplotlylib',
4141
'plotly/matplotlylib/mplexporter',
4242
'plotly/matplotlylib/mplexporter/renderers'],
43-
package_data={
44-
'plotly': ['package_data/*.json', 'widgets/*.js', 'offline/*.js']
45-
},
43+
package_data={'plotly': ['package_data/*']},
4644
install_requires=['requests', 'six', 'pytz'],
4745
zip_safe=False)

0 commit comments

Comments
 (0)