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

Make source_dir discoverable for non-src project #3458

Merged
merged 8 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Removed example pipeline requirements when examples are not selected in `tools`.
* Allowed modern versions of JupyterLab and Jupyter Notebooks.
* Removed setuptools dependency
* Added `source_dir` explicitly in `pyproject.toml` for non-src layout project.

## Breaking changes to the API
* Added logging about not using async mode in `SequentiallRunner` and `ParallelRunner`.
Expand Down
1 change: 1 addition & 0 deletions docs/source/faq/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* [How to use global variables with the `OmegaConfigLoader`](../configuration/advanced_configuration.md#how-to-use-global-variables-with-the-omegaconfigloader)?
* [How do I use resolvers in the `OmegaConfigLoader`](../configuration/advanced_configuration.md#how-to-use-resolvers-in-the-omegaconfigloader)?
* [How do I load credentials through environment variables](../configuration/advanced_configuration.md#how-to-load-credentials-through-environment-variables)?
* [How do I use Kedro with different project structure?](../kedro_project_setup/settings.md#use-kedro-without-the-src-folder)

Check warning on line 47 in docs/source/faq/faq.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/source/faq/faq.md#L47

[Kedro.pronouns] Avoid first-person singular pronouns such as 'I'.
Raw output
{"message": "[Kedro.pronouns] Avoid first-person singular pronouns such as 'I'.", "location": {"path": "docs/source/faq/faq.md", "range": {"start": {"line": 47, "column": 11}}}, "severity": "WARNING"}


## Nodes and pipelines
Expand Down
10 changes: 10 additions & 0 deletions docs/source/kedro_project_setup/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Every Kedro project comes with a default pre-populated `pyproject.toml` file in
package_name = "package_name"
project_name = "project_name"
kedro_init_version = "kedro_version"
tools = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are including tools here we should probably include example_pipeline as well

source_dir = "src"
```

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.
Expand All @@ -40,3 +42,11 @@ this value should also be updated.
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.

### Use Kedro without the `src` folder
Kedro uses the `src` layout by default. It is possible to change this, for example, to use a [flat layout](https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/#src-layout-vs-flat-layout), you can change the `pyproject.toml` as follow.

```diff
+++ source_dir = ""
--- source_dir = "src"
```
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ project_name = "{{ cookiecutter.project_name }}"
kedro_init_version = "{{ cookiecutter.kedro_version }}"
tools = {{ cookiecutter.tools | default('') | string | replace('\"', '\\\"') }}
example_pipeline = "{{ cookiecutter.example_pipeline }}"
source_dir = "src"


[tool.pytest.ini_options]
addopts = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ project_name = "{{ cookiecutter.project_name }}"
kedro_init_version = "{{ cookiecutter.kedro_version }}"
tools = {{ cookiecutter.tools | default('') | string | replace('\"', '\\\"') }}
example_pipeline = "{{ cookiecutter.example_pipeline }}"
source_dir = "src"

[tool.pytest.ini_options]
addopts = """
Expand Down
Loading