-
Notifications
You must be signed in to change notification settings - Fork 1
Building
The literary-build-hatch
package provides a Hatch plugin for building literary projects before a bdist_wheel
build. This backend also supports editable installs.
This can automate the compiling of notebooks into Python modules, and the generation of the various Python packaging artefacts (including editable wheels!)
The Hatch build hook facilitates editable installs by lazily registering the Literary import hook, and adding the notebooks directory to sys.path
.
If you want to use your own tools, you can build a pure Python package manually. Literary offers a literary build
entry point. This will use the configuration file to determine where to place the generated Python module. It is recommended that this be lib/<PACKAGE_NAME>
in the root of the project.
Then, conventional packaging tools can be used, e.g.
Example pyproject.toml
:
[tool.poetry]
# ...
packages = [
{ include = "<PACKAGE_NAME>", from = "lib" },
]
Example setup.cfg
:
[options]
packages = find:
package_dir =
=lib
[options.packages.find]
where = lib
Using packaging tools like this means that the editable installations are less useful - only the generated Python files are editable, not the notebooks.
Development of Literate notebooks using the IPython extension.
- Setting up the Environment
- Loading the IPython Extension
- Cell Exports
- Patching Classes
- Recommended Extensions
Building packages from a collection of Literate notebooks.