Skip to content

Commit 13372f2

Browse files
committed
Fix duplicate import source graph_reference.
In Python 2, you *must* have an `__init__.py` file to have a python package. However, in Python 3, you don’t need that! We have `/graph_reference` and `graph_reference.py` defined, which seems to *work*, but is poorly organized and should be fixed. For instance, it causes `unresolved import errors` in IDEs that have `goto-source`-type functionality. Conflicts: makefile
1 parent 51ef008 commit 13372f2

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

Diff for: makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ update_default_schema :
2121
python -c "import requests;/
2222
from requests.compat import json as _json;\
2323
response = requests.get('https://api.plot.ly/v2/plot-schema?sha1';/
24-
f = open('plotly/graph_reference/default-schema.json', 'w');\
24+
f = open('plotly/package_data/default-schema.json', 'w');\
2525
_json.dump(response.json()['schema'], f, indent=4,\
2626
sort_keys=True, separators=(',', ': '));\
2727
f.close()"

Diff for: plotly/graph_reference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def get_graph_reference():
6666
:return: (dict) The graph reference.
6767
6868
"""
69-
path = os.path.join('graph_reference', 'default-schema.json')
69+
path = os.path.join('package_data', 'default-schema.json')
7070
s = resource_string('plotly', path).decode('utf-8')
7171
graph_reference = _json.loads(s)
7272

File renamed without changes.

Diff for: plotly/tests/test_core/test_graph_reference/test_graph_reference.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_get_graph_reference(self):
2424

2525
# if we don't have a graph reference we load an outdated default
2626

27-
path = os.path.join('graph_reference', 'default-schema.json')
27+
path = os.path.join('package_data', 'default-schema.json')
2828
s = resource_string('plotly', path).decode('utf-8')
2929
default_graph_reference = json.loads(s)
3030
graph_reference = gr.get_graph_reference()
@@ -41,7 +41,7 @@ def test_default_schema_is_up_to_date(self):
4141
content = response.content
4242
schema = json.loads(content)['schema']
4343

44-
path = os.path.join('graph_reference', 'default-schema.json')
44+
path = os.path.join('package_data', 'default-schema.json')
4545
s = resource_string('plotly', path).decode('utf-8')
4646
default_schema = json.loads(s)
4747

Diff for: setup.py

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

0 commit comments

Comments
 (0)