From 8ba3dc5b23642aa4c5c0d1c85a624c4e3dcf80bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Cano=20Rodr=C3=ADguez?= Date: Tue, 11 Jul 2023 00:31:08 +0200 Subject: [PATCH] Avoid adding problematic lines to requirements.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kedro is preinstalled in the behave environment, so this should not be needed. In exchange, requirements.txt files can always be read by setuptools automatic parsing. See https://github.com/quantumblacklabs/private-kedro/pull/352#issuecomment-564948371 for motivation of the original logic. Signed-off-by: Juan Luis Cano Rodríguez --- features/environment.py | 1 - features/steps/cli_steps.py | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/features/environment.py b/features/environment.py index c98246dc85..218ff097e4 100644 --- a/features/environment.py +++ b/features/environment.py @@ -56,7 +56,6 @@ def _setup_context_with_venv(context, venv_dir): context.pip = str(bin_dir / "pip") context.python = str(bin_dir / "python") context.kedro = str(bin_dir / "kedro") - context.requirements_path = Path("dependency/requirements.txt").resolve() # clone the environment, remove any condas and venvs and insert our venv context.env = os.environ.copy() diff --git a/features/steps/cli_steps.py b/features/steps/cli_steps.py index 0008841de4..8a8c2875a6 100644 --- a/features/steps/cli_steps.py +++ b/features/steps/cli_steps.py @@ -407,18 +407,16 @@ def update_pyproject_toml(context: behave.runner.Context, new_source_dir): @given("I have updated kedro requirements") def update_kedro_req(context: behave.runner.Context): - """Replace kedro as a standalone requirement with a line - that includes all of kedro's dependencies (-r kedro/requirements.txt) - """ + """Remove kedro as a standalone requirement.""" reqs_path = context.root_project_dir / "src" / "requirements.txt" - kedro_reqs = f"-r {context.requirements_path.as_posix()}" if reqs_path.is_file(): old_reqs = reqs_path.read_text().splitlines() new_reqs = [] for req in old_reqs: if req.startswith("kedro"): - new_reqs.append(kedro_reqs) + # Do not include kedro as it's preinstalled in the environment + pass else: new_reqs.append(req) new_reqs = "\n".join(new_reqs)