question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poetry Support for Kedro Projects

See original GitHub issue

Description

The way kedro initiate a new project and create the folder structure does not goes well with Poetry . Usually I would create a Poetry environment before doing anything and then install all my required pacakges one by one. After I create a Poetry environment and added the kedro package the pyproject toml looks as followes:

poetry new --src KedroPoetry

[tool.poetry]
name = "KedroPoetry"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "^3.8"
kedro = {version = "~0.18.2", python = ">=3.8,<3.11"}

[tool.poetry.dev-dependencies]
pytest = "^7.1"

... (more lines)

Lets run the demo pytest to see if everything works.

poetry run pytest .

This goes well:

KedroPoetry|⇒ poetry run pytest .
platform darwin -- Python 3.8.12, pytest-7.1.2, pluggy-1.0.0
rootdir: /Users/ALAMSHC/PythonProjects/KedroPoetry
collected 1 item                                                                                                       

tests/test_kedropoetry.py .                                                                                      [100%]

Now its time to add a Kedro Project: kedro new

The command completely ignored the current pyproject.toml file. and as there is a src file it did not add the project in the src folder instead create a directory on the root outside of src. Now there is no kedro setup section in pyproject.toml so kedro cli will complain for broken setup.

Context

As Poetry provide one of the modern approach for packaging Python projects it will be good to have direct support for Poetry like project structure for Kedro or at-least a hackable way out will also work.

Possible Implementation

There could be a new flag in cli to initiate project with Kedro when there is already a pyproject.toml file and a project setup for Poetry.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:22 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
AntonyMilneQBcommented, Aug 1, 2022

I’m reopening this because I think it’s a very good topic and I’d be interested in hearing from other users about it 🙂 It’s been mentioned several times before by differently people but we’ve never had thoughts collected together in one place, so let’s start doing that here! In the past we’ve also wondered whether we should switch to using poetry. Currently we support a pip-compile workflow but we’re planning to remove that in favour of just a plain requirements.txt file. Given https://github.com/kedro-org/kedro/issues/1724, it might be time to re-assess what system we use exactly.

Some previous related issues (there’s probably others too): https://github.com/kedro-org/kedro/issues/398 https://github.com/kedro-org/kedro/issues/391

From these and other conversations I know the following users have independently shown interest in kedro + poetry. There’s also been interest within QB, though I’m not sure exactly who. So I definitely think there’s some significant interest in this. @datajoely do you know anyone else here? @fkromer @danhje @Kastakin @Larkinnjm1 @shaunc

3reactions
arnaldog12commented, Aug 2, 2022

TBH, I like the idea of adding support for Poetry in Kedro projects. I think the main advantages of Poetry are:

  • it’s a widely used package manager (more than pip-compile at least)
  • eliminate the need for setup.py
  • it provides a better way to manage project/dev requirements.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Kedro does not play well with Poetry · Issue #398 - GitHub
I have created a virtual environment with Poetry into <kedro-project-root>/.venv/ and added Kedro as development dependency.
Read more >
Kedro architecture overview - Read the Docs
Kedro library consists of independent units, each responsible for one aspect of computation in a data pipeline: Config Loader provides utility to parse...
Read more >
How can I import local package dependencies into Kedro ...
I'm using a venv installed into <project-root>/.venv and manage it using Poetry. Packages are referenced in pyproject.toml like this (here e.g. ...
Read more >
Understanding Best Practice Python Tooling by Comparing ...
For your next project, consider adding Poetry and Dependabot. ... that while not yet being supported by a majority of project templates, ...
Read more >
black · PyPI
Black is already successfully used by many projects, small and big. ... Formatting 3.6 code will still be supported until further notice.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found