[IPython-dev] Absolute Path IPython
Matthias Bussonnier
bussonniermatthias at gmail.com
Tue Sep 23 08:25:36 EDT 2014
Hi,
Le 23 sept. 2014 à 13:50, Akim Demaille a écrit :
>> Thanks for the explanation, I better understand what you want to do.
>> You are trying do build something under some assumption that are wrong and cannot reliably always work.
>
> Yes, we know :) That's why we are looking for The Better Way.
>
>> Let assume the following:
>>
>> - I am on my laptop (it does not have python installed)
>> - the IPython notebook server is on my Desktop with an open port on the internet.
>> - My kernel were my code runs in on my lab cluster.
>>
>> Webbrower.open(url) is runned on the cluster, though the ipynb files are obviously on my desktop, and what you want is open a page on your laptop. So this cannot reliably work. It needs you to get information on the network architecture you might not have.
>
> This is not right, the notebooks we are referring to here
> are where the server is. Our application, Vaucanson, is
> a Python binding of a C++ library. "make install" installs
> not only the shared libs and Python modules, but also a
> collection of notebooks (some of them can be looked at here:
>
> https://www.lrde.epita.fr/dload//vaucanson/2.0/notebooks/algos/
>
> Here they are available both as notebooks, and html. Unfortunately
> on occasion the Mathjax rendering is broken, but I have read
> somewhere this is known, and fixed in the repo (for instance
> https://www.lrde.epita.fr/dload/vaucanson/2.0/notebooks/algos/automaton.reduce.html)
Yep, you can just replace
<script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
by
<script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML'></script>
and it should work.
Your use case make more sens if you have your own application.
>
> I agree though that our use case is not taking the full
> generality of what IPython can do.
>
>> That beeing said. You might be able to workaround by :
>>
>> - display html instead of trying web browser open
>
> This is possible, indeed. Which means that we should also install
> the html rendering. Why not, after all.
I was referring in using the IPython display machinery to show a ilk to the user, and this link could open another tab.
Yo could even use js to trigger the opening of this tab.
If you look at what Julia is doing, their "info methods" for "objects" do return html with direct link to github source code.
As you know the hash of the current version of the project, you can directly link to a rendered version. Which also avoid to build the doc locally, but I won't go into the debatee of having or not local build of docs.
>
>> - avoid absolute url, use '/notebook/<path>'
>
> yes we need to address the scenario where the user fired the
> notebook from /home/foo, yet the documentation is in /usr/local.
>
>> - have a look at nbopen[1] that does what you ask in **some** cases
>>
>> You cannot get around the fact that you cannot access ../ url thing. It is a question of **security**.
>
> We understand that. However, since the user launches the
> notebook via a wrapper of ours, we would be happy if there
> were a means, from the command line or elsewhere, to pre-approve
> some other paths.
This is a complicated problem, and we are not sure wether or not sure we want to go to that route yet.
One easy way would be for the time being to symlink into the home folder.
Also you probably want these notebook to be immutable I suppose, which might force some refactor.
>
>> You project of having ipynb as documentation is interesting, we would be glad to see how you did it, and how it feels for users.
>
> Currently it feels bad, as it is not interactive: the user
> has to open the documentation page but hand, and then click.
> It's precisely to make her life easier that we are trying
> to have some thing like "?"/"??", but which would open these
> pages. Inline rendering of HTML would also be ok actually.
That is also our long term goal, but we are low on bandwidth to deal with it.
There are security questions, as with this docs could become attack vectors.
And how do you render theses docs on non-html capable frontend.
One thing I can see you doing, is if you can export to html fragments, is having
doc('somehting') just return a IPython.display.HTML object with the content of the doc.
This would allow to see doc in the notebook.
(Note that ?/?? are actually %pinfo ind %pinfo2 magics, so you might be able to hook in there. )
If you want to go to the ?/?? route, you could define an
@property
def __doc__(self):
….
That fetch and return whatever is needed.
We don't have a way (yet) to display rich things wit ?/?? but investigation on this
would be welcomed. Julia is also going this way with a global registry of object/help
and yo can query the help local db for a specific format.
I'll think of a non-ivasive way to deploy an extension that can allow easier integration of your ipynb docs.
--
M
> Thanks again!
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
More information about the IPython-dev
mailing list