Skip to content

Commit

Permalink
overkill
Browse files Browse the repository at this point in the history
Signed-off-by: ravi-kumar-pilla <[email protected]>
  • Loading branch information
ravi-kumar-pilla committed Jun 20, 2024
1 parent bf313d4 commit 1dd04f2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions package/features/steps/cli_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ def _create_config_file(context, include_example):
yaml.dump(config, config_file, default_flow_style=False)


def _add_numpy_pin(requirements_path: str) -> None:
# numpy 2.0 breaks with old versions of pandas and this
# could be removed when the lowest version supported is updated
def _add_package_pin(requirements_path: str, package_name: str, version: str) -> None:
"""Adds a package pin to the requirements file"""
with open(requirements_path, "r") as req_file:
requirements = req_file.readlines()

requirements.append("numpy==1.26.4")
requirements.append(f"{package_name}=={version}")

with open(requirements_path, "w") as req_file:
req_file.writelines(requirements)
Expand Down Expand Up @@ -92,7 +91,9 @@ def install_project_requirements(context):
"""Run ``pip install -r requirements.txt``."""
if context.kedro_version != "latest":
requirements_path = str(context.root_project_dir) + "/src/requirements.txt"
_add_numpy_pin(requirements_path)
# numpy 2.0 breaks with old versions of pandas and this
# could be removed when the lowest version supported is updated
_add_package_pin(requirements_path, "numpy", "1.26.4")
else:
requirements_path = str(context.root_project_dir) + "/requirements.txt"

Expand Down

0 comments on commit 1dd04f2

Please sign in to comment.