Skip to content

Building

Angus Hollands edited this page May 13, 2021 · 4 revisions

Manual Build

To prevent the end user from needing literary, a manual literary build step can be performed. 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

Automatic Build

The literary-build package provides a setuptools-derived PEP 517 backend for building literary projects before an sdist or bdist_wheel build. To use this backend, the pyproject.toml file becomes

[build-system]
requires = ["setuptools>=40.6.0", "wheel", "literary-build>=1.0.2,<1.1.0"]
build-backend = "literary.build_meta"

and the setuptools.cfg should contain the sections outlined above in the Manual Build section.

NB

The literary-build backend has to set JUPYTER_PATH in order for the Jupyter data files to be found. This is only required for the pip isolated build feature, which is enabled by default. Other tools like pyproject-build (build on PyPI) create a new venv for the build environment, which behaves as expected.

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