QuantEcon / sphinxcontrib-jupyter

A Sphinx Extension for Generating Jupyter Notebooks
BSD 3-Clause "New" or "Revised" License
74 stars 23 forks source link

FEAT: Execute downloaded notebooks #269

Closed AakashGfude closed 4 years ago

AakashGfude commented 4 years ago

This PR implements the feature to execute notebooks in _downloads folder. To enable this feature, one has to set jupyter_download_nb_execute variable to True in config

mmcky commented 4 years ago

thanks @AakashGfude

AakashGfude commented 4 years ago

@mmcky testing on lecture-source-py worked well

mmcky commented 4 years ago

@AakashGfude would you mind to test on julia as well. Thanks.

mmcky commented 4 years ago

@arnavs would you have time to give this branch a try on the julia repo?

arnavs commented 4 years ago

@mmcky Sure, will give this a go in the next few hours.

mmcky commented 4 years ago

@AakashGfude when I tested this on the anu workstation it appears the index.html is writen using url links to lectures.quantecon.org rather than relative links as is the case on the master branch. Can you replicate this?

<li><a href="https://lectures.quantecon.org/multi_agent_models/index.html">Multiple Agent Models</a><ul>
<li><a href="https://lectures.quantecon.org/multi_agent_models/schelling.html">Schelling’s Segregation Model</a></li>

should be more like

<li><a href="getting_started_julia/index.html">Getting Started with Julia</a><ul>
<li><a href="getting_started_julia/getting_started.html">Setting up Your Julia Environment</a></li>
arnavs commented 4 years ago

Just started a test on this and make website. Will approve and merge if it looks good.

arnavs commented 4 years ago

Maybe it's just me, but I find two things:

  1. The spinning up of the execution (i.e., Starting notebook execution for website and html conversion(if set in config)...) is taking much longer.

  2. The notebooks in arnavsood@imp:~/research/quantecon/lecture-source-jl/_build/website/jupyter/executed/dynamic_programming are still referring to _static. So then the images are ?s... and _static is still copied.

I set the conf.py in https://github.com/QuantEcon/lecture-source-jl/commit/a8903e415ce78b81957df50d214ed2b25a4c3762.

mmcky commented 4 years ago

thanks @arnavs your second point is an issue with Julia and how statics are treated internally in the extension. We have a fix on the aws instance that copies statics to all nested folders at the moment. This PR will fix this in favour of a much more robust implementation of static files: https://github.com/QuantEcon/sphinxcontrib-jupyter/pull/268

@AakashGfude can you look into the first point raised?

mmcky commented 4 years ago

@arnavs regarding point #1 -- execution will take twice as long with this option enabled as it is running the html set of notebooks and the download set of notebooks. Is there something else that is taking a lot longer?

arnavs commented 4 years ago

@mmcky Maybe that was it. I'm looking through this PR and I don't see anything troublesome, so I'm willing to take the plunge. This will be a great help on the Julia side.

mmcky commented 4 years ago

@AakashGfude we need to update this so that if jupyter_download_nb_execute = True then we copy the executed set of notebooks in jupyter/_downloads/executed to jupyter_html/_downloads/ipynb

AakashGfude commented 4 years ago

@AakashGfude we need to update this so that if jupyter_download_nb_execute = True then we copy the executed set of notebooks in jupyter/_downloads/executed to jupyter_html/_downloads/ipynb

@mmcky done. Testing it now

mmcky commented 4 years ago

thanks @AakashGfude this is looking good now. Once your testing is complete and your happy with it -- let me know and I will merge and release 0.4.4. Please change tag to ready when you're happy.