Skip to content

Commit

Permalink
Move default template to static pyproject.toml, take 2 (#2853)
Browse files Browse the repository at this point in the history
* Remove leftover reference to micropkg setup.py

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Replace outdated extras requirement with kedro-datasets

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Remove outdated mention to environment.yml

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Move flake8 configuration to dedicated file

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Replace setup.py with pyproject.toml in default project template

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Adapt link to moving file in docs

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Revert "Replace outdated extras requirement with kedro-datasets"

This reverts commit dfa8a9e.

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Add release notes for pyproject.toml change

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

---------

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
  • Loading branch information
astrojuanlu authored Aug 25, 2023
1 parent e2bb4cd commit e86508e
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 92 deletions.
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

## Bug fixes and other changes
* Updated `kedro pipeline create` and `kedro catalog create` to use new `/conf` file structure.
* Converted `setup.py` in default template to `pyproject.toml` and moved flake8 configuration
to dedicated file `.flake8`.

## Documentation changes
* Revised the `data` section to restructure beginner and advanced pages about the Data Catalog and datasets.
Expand Down
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@
"https://opensource.org/license/apache2-0-php/",
"https://docs.github.com/en/rest/overview/other-authentication-methods#via-username-and-password",
"https://docs.snowflake.com/en/developer-guide/snowpark/reference/python/api/snowflake.snowpark.DataFrameWriter.saveAsTable.html",
"https://www.educative.io/blog/advanced-yaml-syntax-cheatsheet#anchors"
"https://www.educative.io/blog/advanced-yaml-syntax-cheatsheet#anchors",
# temporarily, until the file actually exists in `main`
"https://github.com/kedro-org/kedro/blob/main/kedro/templates/project/%7B%7B%20cookiecutter.repo_name%20%7D%7D/.flake8",
]

# retry before render a link broken (fix for "too many requests")
Expand Down
2 changes: 1 addition & 1 deletion docs/source/deployment/airflow_astronomer.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ To follow this tutorial, ensure you have the following:
├── plugins
├── pyproject.toml
├── requirements.txt
├── setup.cfg
├── .flake8
└── src
```

Expand Down
2 changes: 1 addition & 1 deletion docs/source/development/linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ It is a good practice to [split your line when it is too long](https://beta.ruff

#### Configure `flake8`

Store your `flake8` configuration in a file named `setup.cfg` within your project root. The Kedro starters use the [following configuration](https://github.com/kedro-org/kedro-starters/blob/main/pandas-iris/%7B%7B%20cookiecutter.repo_name%20%7D%7D/setup.cfg):
Store your `flake8` configuration in a file named `.flake8` within your project root. The Kedro default project template use the [following configuration](https://github.com/kedro-org/kedro/blob/main/kedro/templates/project/%7B%7B%20cookiecutter.repo_name%20%7D%7D/.flake8):

```text
[flake8]
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 @@ -72,7 +72,7 @@ project-dir # Parent directory of the template
├── 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
├── README.md # Project README
├── setup.cfg # Configuration options for `pytest` when doing `kedro test` and for the `isort` utility when doing `kedro lint`
├── .flake8 # Configuration options for `flake8` (linting)
└── src # Project source code
```

Expand Down
4 changes: 2 additions & 2 deletions docs/source/kedro_project_setup/starters.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Here is the layout of the project as a Cookiecutter template:
├── docs # Project documentation
├── notebooks # Project related Jupyter notebooks (can be used for experimental code before moving the code to src)
├── README.md # Project README
├── setup.cfg # Configuration options for tools e.g. `pytest` or `black`
├── .flake8 # Configuration options for `flake8` (linting)
└── src # Project source code
└── {{ cookiecutter.python_package }}
├── __init.py__
Expand All @@ -164,7 +164,7 @@ Here is the layout of the project as a Cookiecutter template:
├── __main__.py
└── settings.py
├── requirements.txt
├── setup.py
├── pyproject.toml
└── tests
```

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In order to get the best out of the template:

## How to install dependencies

Declare any dependencies in `src/requirements.txt` for `pip` installation and `src/environment.yml` for `conda` installation.
Declare any dependencies in `src/requirements.txt` for `pip` installation.

To install them, run:

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "{{ cookiecutter.python_package }}"
version = "0.1"
dynamic = ["dependencies"]

[tool.setuptools.packages.find]
exclude = ["tests"]

[project.scripts]
{{ cookiecutter.repo_name }} = "{{ cookiecutter.python_package }}.__main__:main"

[project.optional-dependencies]
docs = [
"docutils<0.18.0",
"sphinx~=3.4.3",
"sphinx_rtd_theme==0.5.1",
"nbsphinx==0.8.1",
"nbstripout~=0.4",
"sphinx-autodoc-typehints==1.11.1",
"sphinx_copybutton==0.3.1",
"ipykernel>=5.3, <7.0",
"Jinja2<3.1.0",
"myst-parser~=0.17.2",
]

[tool.setuptools.dynamic]
dependencies = {file = "requirements.txt"}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "{{ cookiecutter.python_package }}"
version = "0.1"
dynamic = ["dependencies"]

[tool.setuptools.packages.find]
exclude = ["tests"]

[project.scripts]
{{ cookiecutter.repo_name }} = "{{ cookiecutter.python_package }}.__main__:main"

[project.optional-dependencies]
docs = [
"docutils<0.18.0",
"sphinx~=3.4.3",
"sphinx_rtd_theme==0.5.1",
"nbsphinx==0.8.1",
"nbstripout~=0.4",
"sphinx-autodoc-typehints==1.11.1",
"sphinx_copybutton==0.3.1",
"ipykernel>=5.3, <7.0",
"Jinja2<3.1.0",
"myst-parser~=0.17.2",
]

[tool.setuptools.dynamic]
dependencies = {file = "requirements.txt"}
39 changes: 0 additions & 39 deletions kedro/templates/project/{{ cookiecutter.repo_name }}/src/setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/framework/cli/micropkg/test_micropkg_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ def test_empty_pipeline_requirements_txt(
def test_complex_requirements(
self, requirement, fake_project_cli, fake_metadata, fake_package_path
):
"""Options that are valid in requirements.txt but cannot be packaged using
setup.py."""
"""Options that are valid in requirements.txt but cannot be packaged in
pyproject.toml."""
self.call_pipeline_create(fake_project_cli, fake_metadata)
pipeline_requirements_txt = (
fake_package_path / "pipelines" / PIPELINE_NAME / "requirements.txt"
Expand Down

0 comments on commit e86508e

Please sign in to comment.