Skip to content

Loading the Extension

Angus Hollands edited this page May 12, 2022 · 8 revisions

When developing a package, it is useful to be able to perform relative imports with from . import foo, which is provided by the __package__ module-scoped variable. Additionally, Literary provides tools like the patch decorator to improve the narrative flow of a notebook module. In order to make these features known to the user namespace, an IPython extension is provided:

%load_ext literary.module

This should be performed in a non-exported cell. Upon loading the extension, the following things take place:

  • The __package__ global variable is defined such that relative imports can be performed.
  • The current working directory is removed from sys.path (unless a non-package)
  • A patch decorator is defined that provides runtime monkeypatching and build-time clean AST generation.

Notebook Development

Development of Literate notebooks using the IPython extension.

Package Development

Building packages from a collection of Literate notebooks.

Literary Development

About Literary

Clone this wiki locally