Packaging a project¶
This section explains how to build your project documentation, and how to bundle your project into a Python package.
Add documentation to your project¶
You can generate project-specific documentation by running
kedro build-docs in the project’s root directory. Kedro builds the resulting HTML files in
docs/build/html/. To browse the documentation generated, open
docs/build/html/index.html in your browser, or run
kedro build-docs --open to automatically open the documentation after building.
build-docs command creates documentation based on the code structure of your project. Documentation includes any
docstrings defined in your code.
Package your project¶
To package your project, run the following in your project’s root directory:
Kedro builds the package into the
src/dist/ folder of your project, and creates one
.egg file and one
.whl file, which are Python packaging formats for binary distribution.
The resulting package only contains the Python source code of your Kedro pipeline, not any of the
logs/ subfolders. This means that you can distribute the project to run elsewhere, such as on a separate computer with different configuration, data and logging. When distributed, the packaged project must be run from within a directory that contains the
conf/ subfolder (and
logs/ if your pipeline loads/saves local data or uses logging).
Recipients of the
.whl files need to have Python and
pip on their machines, but do not need to have Kedro installed. The project is installed to the root of a folder with the relevant
logs/ subfolders, by navigating to the root and calling:
pip install <path-to-wheel-file>
For example, having installed project
kedro-spaceflights and package
kedro_spaceflights, a recipient can run the Kedro project as follows from the root of the project:
python -m kedro_spaceflights.run
kedro-spaceflights, is also placed in the
bin/ subfolder of the Python installation location.