Tweak %load to get raw gist #2149

Closed
Carreau opened this Issue Jul 17, 2012 · 8 comments

Comments

Projects
None yet
7 participants
Owner

Carreau commented Jul 17, 2012

discuted at SciPy2012,
Tweak the load magic to turn gist url into raw-gist url, because it does not make sens to load an html gist page.

Contributor

bfroehle commented Jul 17, 2012

On the other hand, it's a bit questionable about what should be done for multi-file gists.

Owner

Carreau commented Jul 17, 2012

For frontend that support it, I suggest we use stdin to ask what to do.

This url contains N files,
[put here a list of files]
which one(s) do you want to load ? [None/Raw/All/Numbers] :

In notebook you can easily call load on each subfile that will open in a differents cells
But IMHO what we want is to provide a more extensible solution of url rewriting for load. For example matplotlib gallery and i'm sure we'll find some other cases.

tbonza commented Apr 14, 2014

I'll be working on this for the sprints

Owner

jdfreder commented Apr 21, 2014

What happens when the gist contains multiple files?

tbonza commented Apr 21, 2014

The user will see an error, "error_reporting(0);" or the first gist (ex. curl https://gist.githubusercontent.com/Sinetheta/6003037/raw/). If we use the github api to return the gist links (ex. curl https://api.github.com/gists/6003037 -H "Accept: application/vnd.github.v3.raw"), then each raw-url is returned but we have to parse the output then make separate requests for each.

There could be an easier way to do this that I don't know about. If parsing the output then requesting each raw-url is the preferred way to go then I can make that revision. I wanted to go with the simplest solution first.

tbonza commented Apr 22, 2014

Wondering if the default could be for gists with only one file. The user could use a flag (ex. "%load -m https://gist.github.com/Bonza-Times/10945158") for multi-file gists. The more general question is could we make %load more extensible by implementing various flags? A multi-file gist could be one example.

Owner

ivanov commented Apr 23, 2014

i'm not convinced this is a feature that needs to live in ipython. the same thing can happen with file links in regular repos, not just gists, should we fix that, as well?

Owner

takluyver commented Jun 5, 2014

We decided in the dev meeting today that this is probably not in scope for %load - see my comment on PR #5683 for the reasoning.

takluyver closed this Jun 5, 2014

@minrk minrk modified the milestone: no action, wishlist Jun 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment