Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation about pyproject.toml #2427

Merged
merged 10 commits into from
Mar 22, 2023
2 changes: 1 addition & 1 deletion docs/source/faq/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ To later upgrade Kedro to a different version, simply run:
pip install kedro -U
```

When migrating an existing project to a newer Kedro version, make sure you also update the `project_version` in your `pyproject.toml` file from the project root directory or, for projects generated with Kedro<0.17.0, in your `ProjectContext`, which is found in `src/<package_name>/run.py`.
When migrating an existing project to a newer Kedro version, make sure you also update the `kedro_init_version` in your `pyproject.toml` file from the project root directory or, for projects generated with Kedro<0.17.0, in your `ProjectContext`, which is found in `src/<package_name>/run.py`.

ankatiyar marked this conversation as resolved.
Show resolved Hide resolved
## How can I use a development version of Kedro?

Expand Down
2 changes: 1 addition & 1 deletion docs/source/get_started/kedro_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ project-dir # Parent directory of the template
├── docs # Project documentation
├── logs # Project output logs (not committed to version control)
├── notebooks # Project-related Jupyter notebooks (can be used for experimental code before moving the code to src)
├── pyproject.toml # Identifies the project root and [contains configuration information](../faq/architecture_overview.md#kedro-project)
├── pyproject.toml # Identifies the project root and contains configuration information
├── README.md # Project README
├── setup.cfg # Configuration options for `pytest` when doing `kedro test` and for the `isort` utility when doing `kedro lint`
└── src # Project source code
Expand Down
23 changes: 22 additions & 1 deletion docs/source/kedro_project_setup/settings.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Project settings

## Application settings

A Kedro project's `settings.py` file contains the application settings for the project, including registration of Hooks and library components. This page explains how settings work, and which settings are available.

```{note}
Application settings is distinct from [run time configuration](configuration.md), which is stored in the `conf` folder and can vary by configuration environment, and [pyproject.toml](../faq/architecture_overview.md#kedro-project) , which provides project metadata and build configuration.
Application settings is distinct from [run time configuration](configuration.md), which is stored in the `conf` folder and can vary by configuration environment, and [pyproject.toml](#settings-in-pyproject.toml) , which provides project metadata and build configuration.
```

By default, all code in `settings.py` is commented out. When settings are not supplied, Kedro chooses sensible default values. You only need to edit `settings.py` if you wish to change to values other than the defaults.
Expand All @@ -19,3 +21,22 @@ By default, all code in `settings.py` is commented out. When settings are not su
| `CONFIG_LOADER_CLASS` | `kedro.config.ConfigLoader` | Customise how project configuration is handled. |
| `CONFIG_LOADER_ARGS` | `dict()` | Keyword arguments for the `CONFIG_LOADER_CLASS` constructor. |
| `DATA_CATALOG_CLASS` | `kedro.io.DataCatalog` | Customise how the [Data Catalog](../data/data_catalog.md) is handled. |

## Settings in `pyproject.toml`
The `pyproject.toml` file is the standard way to store build metadata and tool settings for Python projects.
Every Kedro project comes with a default pre-populated `pyproject.toml` file in your project root directory with the following keys specified under the `[tool.kedro]` section:

```toml
[tool.kedro]
package_name = <package_name>
project_name = <project_name>
kedro_init_version = <kedro_version>
```

The `package_name` should be a [valid Python package name](https://peps.python.org/pep-0423/) and the `project_name` should be a human-readable name. They are both mandatory keys for your project.
`kedro_init_version` specifies the version of Kedro the project was created with. When you upgrade to a newer Kedro version,
this value should also be updated.
Comment on lines +37 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it the version of the "starter"? Just double checking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the version of Kedro used to create the project. It's also there when you make a blank project with kedro new


You can also use `pyproject.toml` to specify settings for functionalities such as [micro-packaging](../nodes_and_pipelines/micro_packaging.md).
You can also store the settings for the other tools you've used in your project, such as [`pytest` for automated testing](../development/automated_testing.md).
Consult the respective documentation for the tools you have used to check how you can configure the settings with the `pyproject.toml` file for your project.