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

Move default template to static pyproject.toml, take 2 #2853

Merged
merged 9 commits into from
Aug 25, 2023
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",
Comment on lines +231 to +232
Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently this has no effect in preventing the warning (then turned into an error) 🤔 Will ignore it for now

]

# 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)
astrojuanlu marked this conversation as resolved.
Show resolved Hide resolved
└── 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"}

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