From 9464dc716c987ac0bcadba49aa97a4fa1ae18248 Mon Sep 17 00:00:00 2001 From: "L. R. Couto" <57910428+lrcouto@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:37:40 -0300 Subject: [PATCH] Change pyproject.toml on Kedro project template to be compatible with `uv`, `rye`, `pdm` (#4263) * Changes to pyproject.toml template Signed-off-by: Laura Couto * add requires-python to pyproject.toml Signed-off-by: Laura Couto * Lint Signed-off-by: Laura Couto * Failing test Signed-off-by: Laura Couto * Change requirements.txt to -e . Signed-off-by: Laura Couto * Revert Signed-off-by: Laura Couto * Changes to pyproject.toml template Signed-off-by: Laura Couto * add requires-python to pyproject.toml Signed-off-by: Laura Couto * Lint Signed-off-by: Laura Couto * Failing test Signed-off-by: Laura Couto * Change requirements.txt to -e . Signed-off-by: Laura Couto * Revert Signed-off-by: Laura Couto * Formatting on cookiecutter placeholders on default template Signed-off-by: Laura Couto * Add change to release notes Signed-off-by: Laura Couto * Elaborate on release notes Signed-off-by: Laura Couto * Update pyproject.toml on test_project Signed-off-by: Laura Couto * Syntax issues Signed-off-by: Laura Couto * Changes to pyproject.toml template Signed-off-by: Laura Couto * add requires-python to pyproject.toml Signed-off-by: Laura Couto * Lint Signed-off-by: Laura Couto * Failing test Signed-off-by: Laura Couto * Change requirements.txt to -e . Signed-off-by: Laura Couto * Revert Signed-off-by: Laura Couto * add requires-python to pyproject.toml Signed-off-by: Laura Couto * Lint Signed-off-by: Laura Couto * Failing test Signed-off-by: Laura Couto * Change requirements.txt to -e . Signed-off-by: Laura Couto * Revert Signed-off-by: Laura Couto * Formatting on cookiecutter placeholders on default template Signed-off-by: Laura Couto * Add change to release notes Signed-off-by: Laura Couto * Elaborate on release notes Signed-off-by: Laura Couto * Update pyproject.toml on test_project Signed-off-by: Laura Couto * Syntax issues Signed-off-by: Laura Couto * Fix accidentally removed line Signed-off-by: Laura Couto * Fix duplicated line Signed-off-by: Laura Couto --------- Signed-off-by: Laura Couto --- RELEASE.md | 1 + .../{{ cookiecutter.repo_name }}/pyproject.toml | 15 +++++++++++---- .../{{ cookiecutter.repo_name }}/requirements.txt | 2 +- .../{{ cookiecutter.repo_name }}/pyproject.toml | 15 ++++++++++----- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index c3c78fe0a2..c9a5752ef2 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,6 +3,7 @@ ## Major features and improvements * Implemented dict-like interface for `KedroDataCatalog`. * Implemented lazy dataset initializing for `KedroDataCatalog`. +* Project dependencies on both the default template and on starter templates are now explicitly declared on the `pyproject.toml` file, allowing Kedro projects to work with project management tools like `uv`, `pdm`, and `rye`. **Note:** ``KedroDataCatalog`` is an experimental feature and is under active development. Therefore, it is possible we'll introduce breaking changes to this class, so be mindful of that if you decide to use it already. Let us know if you have any feedback about the ``KedroDataCatalog`` or ideas for new features. diff --git a/features/steps/test_starter/{{ cookiecutter.repo_name }}/pyproject.toml b/features/steps/test_starter/{{ cookiecutter.repo_name }}/pyproject.toml index eb7cb5f113..ea11850fef 100644 --- a/features/steps/test_starter/{{ cookiecutter.repo_name }}/pyproject.toml +++ b/features/steps/test_starter/{{ cookiecutter.repo_name }}/pyproject.toml @@ -3,12 +3,20 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] +requires-python = ">=3.9" name = "{{ cookiecutter.python_package }}" readme = "README.md" -dynamic = ["dependencies", "version"] +dynamic = ["version"] +dependencies = [ + "ipython>=8.10", + "jupyterlab>=3.0", + "notebook", + "kedro~={{ cookiecutter.kedro_version }}", + "kedro-datasets[pandas-csvdataset]" +] [project.scripts] -{{ cookiecutter.repo_name }} = "{{ cookiecutter.python_package }}.__main__:main" +"{{ cookiecutter.repo_name }}" = "{{ cookiecutter.python_package }}.__main__:main" [project.optional-dependencies] docs = [ @@ -30,7 +38,6 @@ dev = [ ] [tool.setuptools.dynamic] -dependencies = {file = "requirements.txt"} version = {attr = "{{ cookiecutter.python_package }}.__version__"} [tool.setuptools.packages.find] @@ -41,7 +48,7 @@ namespaces = false package_name = "{{ cookiecutter.python_package }}" project_name = "{{ cookiecutter.project_name }}" kedro_init_version = "{{ cookiecutter.kedro_version }}" -tools = {{ cookiecutter.tools | default('') | string | replace('\"', '\\\"') }} +tools = "{{ cookiecutter.tools | default('') | string | replace('\"', '\\\"') }}" example_pipeline = "{{ cookiecutter.example_pipeline }}" source_dir = "src" diff --git a/features/steps/test_starter/{{ cookiecutter.repo_name }}/requirements.txt b/features/steps/test_starter/{{ cookiecutter.repo_name }}/requirements.txt index 014df14d12..bc0a4b4d04 100644 --- a/features/steps/test_starter/{{ cookiecutter.repo_name }}/requirements.txt +++ b/features/steps/test_starter/{{ cookiecutter.repo_name }}/requirements.txt @@ -1,5 +1,5 @@ ipython>=8.10 jupyterlab>=3.0 notebook -kedro~={{ cookiecutter.kedro_version}} +kedro~={{ cookiecutter.kedro_version }} kedro-datasets[pandas-csvdataset] diff --git a/kedro/templates/project/{{ cookiecutter.repo_name }}/pyproject.toml b/kedro/templates/project/{{ cookiecutter.repo_name }}/pyproject.toml index b2ab54c3bb..02eac94ae0 100644 --- a/kedro/templates/project/{{ cookiecutter.repo_name }}/pyproject.toml +++ b/kedro/templates/project/{{ cookiecutter.repo_name }}/pyproject.toml @@ -3,12 +3,19 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] +requires-python = ">=3.9" name = "{{ cookiecutter.python_package }}" readme = "README.md" -dynamic = ["dependencies", "version"] +dynamic = ["version"] +dependencies = [ + "ipython>=8.10", + "jupyterlab>=3.0", + "notebook", + "kedro~={{ cookiecutter.kedro_version }}" +] [project.scripts] -{{ cookiecutter.repo_name }} = "{{ cookiecutter.python_package }}.__main__:main" +"{{ cookiecutter.repo_name }}" = "{{ cookiecutter.python_package }}.__main__:main" [project.entry-points."kedro.hooks"] @@ -31,9 +38,7 @@ dev = [ "ruff~=0.1.8" ] - [tool.setuptools.dynamic] -dependencies = {file = "requirements.txt"} version = {attr = "{{ cookiecutter.python_package }}.__version__"} [tool.setuptools.packages.find] @@ -44,7 +49,7 @@ namespaces = false package_name = "{{ cookiecutter.python_package }}" project_name = "{{ cookiecutter.project_name }}" kedro_init_version = "{{ cookiecutter.kedro_version }}" -tools = {{ cookiecutter.tools | default('') | string | replace('\"', '\\\"') }} +tools = "{{ cookiecutter.tools | default('') | string | replace('\"', '\\\"') }}" example_pipeline = "{{ cookiecutter.example_pipeline }}" source_dir = "src"