Skip to content

Commit

Permalink
Migrate default project template to static project metadata
Browse files Browse the repository at this point in the history
See gh-2280.

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
  • Loading branch information
astrojuanlu committed May 8, 2023
1 parent a3444d4 commit 8c3023a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 49 deletions.
Expand Up @@ -17,12 +17,12 @@ In order to get the best out of the template:

## How to install dependencies

Declare any dependencies in `requirements.txt` for `pip` installation and `environment.yml` for `conda` installation.
Declare any dependencies in `pyproject.toml` for `pip` installation and `environment.yml` for `conda` installation.

To install them, run:

```
pip install -r requirements.txt
pip install -e .
```

## How to run your Kedro pipeline
Expand Down Expand Up @@ -51,9 +51,9 @@ To generate or update the dependency requirements for your project:
kedro build-reqs
```

This will `pip-compile` the contents of `requirements.txt` into a new file `requirements.lock`. You can see the output of the resolution by opening `requirements.lock`.
This will `pip-compile` the contents of `pyproject.toml` into a new file `requirements.lock`. You can see the output of the resolution by opening `requirements.lock`.

After this, if you'd like to update your project requirements, please update `requirements.txt` and re-run `kedro build-reqs`.
After this, if you'd like to update your project requirements, please update `pyproject.toml` and re-run `kedro build-reqs`.

[Further information about project dependencies](https://docs.kedro.org/en/stable/kedro_project_setup/dependencies.html#project-specific-dependencies)

Expand Down
@@ -1,3 +1,39 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "{{ cookiecutter.python_package }}"
dependencies = [
"kedro~={{ cookiecutter.kedro_version }}",
"kedro-telemetry~=0.2.0",
]
dynamic = ["version"]

[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]
version = {attr = "{{ cookiecutter.python_package }}.__version__"}

[tool.setuptools.packages.find]
where = ["src"]
namespaces = false

[tool.kedro]
package_name = "{{ cookiecutter.python_package }}"
project_name = "{{ cookiecutter.project_name }}"
Expand Down

This file was deleted.

39 changes: 0 additions & 39 deletions kedro/templates/project/{{ cookiecutter.repo_name }}/setup.py

This file was deleted.

6 changes: 2 additions & 4 deletions tests/framework/cli/test_starters.py
Expand Up @@ -17,7 +17,7 @@
KedroStarterSpec,
)

FILES_IN_TEMPLATE = 31
FILES_IN_TEMPLATE = 30


@pytest.fixture
Expand Down Expand Up @@ -70,9 +70,7 @@ def _assert_template_ok(
assert (full_path / ".gitignore").is_file()
assert project_name in (full_path / "README.md").read_text(encoding="utf-8")
assert "KEDRO" in (full_path / ".gitignore").read_text(encoding="utf-8")
assert kedro_version in (full_path / "src" / "requirements.txt").read_text(
encoding="utf-8"
)
assert kedro_version in (full_path / "pyproject.toml").read_text(encoding="utf-8")
assert (full_path / "src" / python_package / "__init__.py").is_file()


Expand Down

0 comments on commit 8c3023a

Please sign in to comment.