Skip to content

Commit

Permalink
Make kedro package backwards compatible
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
  • Loading branch information
astrojuanlu committed Oct 2, 2023
1 parent 42ad7b2 commit 08e3ab6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions kedro/framework/cli/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,27 @@ def ipython(metadata: ProjectMetadata, env, args, **kwargs): # noqa: unused-arg
@click.pass_obj # this will pass the metadata as first argument
def package(metadata: ProjectMetadata):
"""Package the project as a Python wheel."""
# TODO: Detect whether metadata is under project_path or source_path
project_path = metadata.project_path
# Even if the user decides for the older setup.py on purpose,
# pyproject.toml is needed for Kedro metadata
if (metadata.project_path / "pyproject.toml").is_file():
metadata_dir = metadata.project_path
destination_dir = "dist"
else:
# Assume it's an old Kedro project, packaging metadata was under src
# (could be pyproject.toml or setup.py, it's not important)
metadata_dir = metadata.source_dir
destination_dir = "../dist"

call(
[
sys.executable,
"-m",
"build",
"--wheel",
"--outdir",
"dist",
destination_dir,
],
cwd=str(project_path),
cwd=str(metadata_dir),
)

directory = (
Expand Down

0 comments on commit 08e3ab6

Please sign in to comment.