Literate package development with Jupyter
Project description
Literary
This package is an exploration of the literate programming idea pioneered by
Donald
Knuth and implemented in the
nbdev
package. Although nbdev
looks to be a very
mature and comprehensive tool, it is quite opinionated. This package is an
investigation into what a smaller nbdev
might look like.
Philosophy
- Low mental overhead
Realistically, most Python programmers that wish to write packages need to have some familiarity with the Python package development model, including the conventional structure of a package. For this reason, I feel that it is important to designliterary
such that these skills translate directly to designing libraries with notebooks - Minimal downstream impact
Users ofliterary
packages should not realise that they are consuming notebook-generated code at runtime. This means that a pure-Python package needs to be generated from the notebooks, and it must use the conventional import model. For this reason,literary
should only exist as a development dependency of the package.
Differences with nbdev
- Use of cell tags instead of comments or magics to dictate exports
- Use of
nbconvert
machinery to build the pure-Python lib package - Use of import hooks to import other notebooks
- Maintains a similar programming model to conventional module development
- Reduces the need to modify notebook contents during conversion
- Minimal runtime overhead
- Features like
patch
are removed from the generated module (& imported notebook source) using AST transformations
- Features like
- Currently no documentation generation
- Loosely, the plan is to use existing notebook-book tooling to re-use the existing Jupyter ecosystem
Design
The plan for this package is:
- Notebooks will be written inside
<PACKAGE_NAME>/
in literary project's root directory - Notebooks will respect relative imports and other pure-Python features to minimise the differences between the generated packages and the notebooks
- A pure-python generated
lib/<PACKAGE_NAME>/
directory will be built before Poetry builds the final project.
E.g.[tool.poetry] # ... packages = [ { include = "<PACKAGE_NAME>", from = "lib" }, ]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
literary-1.3.2.tar.gz
(13.5 kB
view hashes)
Built Distribution
literary-1.3.2-py3-none-any.whl
(14.2 kB
view hashes)