-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Plotly Offline #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plotly Offline #236
Conversation
res = requests.get(download_url + '/sourcefiles.json') | ||
res.raise_for_status() | ||
|
||
with open(os.path.join(plotlyjs_path, 'sourcefiles.json'), 'w') as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these sourcefiles.json
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they contain the list of plotly.js dependencies:
{
"files": ["dependencies/d3.v3.min.js", "dependencies/jquery-latest.js", "dependencies/typedarray.js", "plotly.min.js"]
}
that way, if we change the dependencies in the future we don't have to change anything on the python lib side. they just explain which files are necessary to include and to download
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOVE IT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be a bundle we build in streambed and then a single download file for folks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is the best thing that happen to IPython since IPython notebook. |
please try it out and review @aneda @cldougl @theengineear ! thx! |
@BRONSOLO @theengineear - did you guys change the folders endpoint on prod? this branch and master are failing in the |
@chriddyp , it's a minor break, looks like
|
This is the only reference to a https://github.com/plotly/python-api/blob/master/plotly/plotly/plotly.py#L774 I don't think the library is breaking because of this test :) Also, I tested the above test changes in python 2.7, i don't think i used TestCase stuff that wasn't around in 2.6... but maybe. |
import requests | ||
|
||
|
||
def download_plotlyjs(download_url, plotlyjs_dir='~/.plotly/plotlyjs'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of the download_url
param and just create a streambed url that we know and can authenticate at?
Then, we can just write a function to decide whether the requesting user has access?
Additionally, why do we need the plotlyjs_dir
arg? is there a good reason for folks to need to change this? Also, i think it's not used in the func?
(obviously, the download_url is perfect for the current dev though :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally, if this didn't require any arguments, we could just call it the first time a user tries to use it, which would mean they don't need to know about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea, going to punt 👟 🏈 this one to a future release
@chriddyp , playing around with this now, nice work! |
nice! plot loads up in nbviewer, that's super solid! http://nbviewer.ipython.org/gist/theengineear/3b986f62836453d470ea |
@etpinard - due to some conflicts in ipython 2.4.1, I'm going to bundle up plotly.js w/out jquery 1.8.3 and instead rely on ipython's 2.0.3 version of jquery. here's the test suite on the different versions:
at first glance, versions look and interact the same |
@etpinard try zooming on the |
@theengineear nice tinkerbell! throwback! |
follow suit of Crypto and py core team: pyca/cryptography@0857894
Not opposed to adding ipython to core-tests, but, then we need to add it as a requirement in I'd suggest we go with I just did a quick search for ipython tests and it seems that there's some support out there for testing in a notebook: https://pypi.python.org/pypi/pytest-ipynb I haven't really tried we might be able to test everything we need to outside of a notebook environment. Again, just haven't really tried. |
yeah, nvm, I thought that the test_optional wasn't being run by circle... but it is! @theengineear - can I get a 💃 ? |
|
||
def download_plotlyjs(download_url): | ||
if not os.path.exists(plotlyjs_path): | ||
os.makedirs(plotlyjs_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check for write permissions and gracefully exit here? I think the tools.py module defines it:
https://github.com/plotly/python-api/blob/master/plotly/tools.py#L61-76
_file_permissions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
non-blocking, are we pushing this up to pypi though? i feel like we might want to just allow folks to download from github master for a bit? 👯 |
@theengineear - yeah, I'm gonna push it up to pypi as those openssl errors that bubbled up through the git+ install scares me. |
thx @chriddyp ! |
Sorry if I ask trivial question |
No description provided.