Skip to content

Commit

Permalink
Fix deprecated Kedro commands after metadata and tests moved
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 Jul 28, 2023
1 parent dfb83ac commit 8e2c6e9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions kedro/framework/cli/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ def lint(
click.secho(deprecation_message, fg="red")

source_path = metadata.source_dir
project_path = metadata.project_path
package_name = metadata.package_name
files = files or (str(source_path / "tests"), str(source_path / package_name))
# TODO: Detect whether tests are under project_path or source_path
files = files or (str(project_path / "tests"), str(source_path / package_name))

if "PYTHONPATH" not in os.environ:
# isort needs the source path to be in the 'PYTHONPATH' environment
Expand Down Expand Up @@ -147,17 +149,18 @@ 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."""
source_path = metadata.source_dir
# TODO: Detect whether metadata is under project_path or source_path
project_path = metadata.project_path
call(
[
sys.executable,
"-m",
"build",
"--wheel",
"--outdir",
"../dist",
"dist",
],
cwd=str(source_path),
cwd=str(project_path),
)

directory = (
Expand Down Expand Up @@ -197,9 +200,11 @@ def build_docs(metadata: ProjectMetadata, open_docs):
click.secho(deprecation_message, fg="red")

source_path = metadata.source_dir
project_path = metadata.project_path
package_name = metadata.package_name

python_call("pip", ["install", str(source_path / "[docs]")])
# TODO: Detect whether metadata is under project_path or source_path
python_call("pip", ["install", str(project_path / "[docs]")])
python_call("pip", ["install", "-r", str(source_path / "requirements.txt")])
python_call("ipykernel", ["install", "--user", f"--name={package_name}"])
shutil.rmtree("docs/build", ignore_errors=True)
Expand Down

0 comments on commit 8e2c6e9

Please sign in to comment.