Skip to content

Building

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

Automatic Build

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!)

Editable Installs

The Hatch build hook facilitates editable installs by lazily registering the Literary import hook, and adding the notebooks directory to sys.path.

Manual Build

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.

Poetry

Example pyproject.toml:

[tool.poetry]
# ...
packages = [
  { include = "<PACKAGE_NAME>", from = "lib" },
]

Setuptools

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.

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