https://kedro.org/ logo
#questions
Title
# questions
a

Andrew Stewart

01/30/2023, 9:59 PM
What's the use-case difference between
Copy code
## from <https://kedro.readthedocs.io/en/stable/kedro_project_setup/session.html>

from kedro.framework.session import KedroSession
from kedro.framework.startup import bootstrap_project
from pathlib import Path

bootstrap_project(Path.cwd())
with KedroSession.create() as session:
    session.run()
vs
Copy code
## from <https://kedro.readthedocs.io/en/stable/tutorial/package_a_project.html>

from kedro_tutorial.__main__ import main

main(
    ["--pipeline", "__default__"]
)  # or simply main() if you don't want to provide any arguments
If I understand correctly, only the second is really intended for portable execution (distributing a package etc)
the first I believe would require not just
conf
but also
pyproject.toml
👍 1
?
d

datajoely

01/31/2023, 10:09 AM
• So the first one is if you want to use Kedro via the Python API. You can do this, but I would make sure you have a good reason to do so. • The second issue is is about running from the CLI, the preferred route for ~95% of situations and we make a few assumptions about folder structure
i

Ivan Danov

01/31/2023, 10:15 AM
@Andrew Stewart correct, the first one will require
pyproject.toml
and in a way is only meant to be used by Kedro’s CLI internally or only during development of your project. If you intent to run your project somewhere in production, the second one is the preferred method.
a

Andrew Stewart

01/31/2023, 4:51 PM
Thanks @datajoely and @Ivan Danov - makes sense.
K 1
3 Views