Skip to content

Redesign of Extension

mmcky edited this page Jan 30, 2020 · 1 revision

Redesign of Extension

We are working towards building a new execute builder that will have the sole responsibility of extracting code-blocks from rst files and building a codetree folder to support the builders and translators used in this project.

The codetree will mirror the rst source directory and save each code block as a normalised input block along with output generated through the jupyter kernel. There will be a new kernel for each document. This codetree object can then be used by the builders to update translated notebooks to include output while matching on md5hash of the input code-block.

This will enable:

  1. Single execution of code contained in the rst files across all output types.
  2. A builder specialised to execute code within the Jupyter set of tools
  3. Coverage and Testing infrastructure of the code

The new builders will consist of:

  1. jupyter
  2. jupyterhtml
  3. jupyterpdf

and

  1. execute -> this builder will be used by other builds to generate outputs from contained code blocks

The new translators will consist of:

  1. JupyterCodeBlockTranslator -> SphinxSparseTranslator
  2. JupyterIPYNBTranslator -> SphinxTranslator
  3. JupyterHTMLTranslator -> SphinxTranslator
  4. JupyterPDFTranslator -> SphinxTranslator

The translators will solely be responsible for converting RST to IPYNB tailored to its end use case such as IPYNB, HTML, or PDF production. Managing code execution and updating the translated documents with outputs will be the responsibility of the builder.

Notes:

  1. Check/setup codetree.
  2. Run Translator Code to build codetree with code blocks (jupyter_conversion_mode = "code").
  3. Execute code in codetree.
  4. Run Translator to build the whole rst to notebook (jupyter_conversion_mode = "all"), for any targets of your choosing (pdf, html, jupyter).
  5. Combine the outputs of 4. and 2. using hashes .
Clone this wiki locally