Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin Pip and fix lint e2e tests #201

Merged
merged 7 commits into from
Dec 20, 2023
Merged

Conversation

noklam
Copy link
Contributor

@noklam noklam commented Dec 20, 2023

Motivation and Context

  1. Lint doesn't require project requirements anymore since we moved to ruff and not using kedro lint
  2. Pin pip <=23.2, see https://github.com/kedro-org/kedro/blame/b11666e33fce76e724d15922a786a6ce9fd4e791/features/environment.py#L107

Noted pip version is set twice. Previously pip version are sometimes in 23.3 or 21 depending on the OS/tests combo.

  1. During e2e test, a new virtualenv is created, so pip is pin.
  2. during e2e test before installing the test requirements, pip is also fix.

How has this been tested?

Checklist

  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Assigned myself to the PR
  • Added tests to cover my changes

@noklam noklam marked this pull request as draft December 20, 2023 14:00
@noklam noklam marked this pull request as ready for review December 20, 2023 15:53
Copy link
Contributor

@ankatiyar ankatiyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @noklam

Copy link
Member

@astrojuanlu astrojuanlu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Left a couple of nonimportant comments

Comment on lines +18 to +59
def run(
cmd: list | str, split: bool = True, print_output: bool = False, **kwargs: Any
) -> subprocess.CompletedProcess:
"""Run a shell command.

Args:
cmd: A command string, or a command followed by program
arguments that will be submitted to Popen to run.

split: Flag that splits command to provide as multiple *args
to Popen. Default is True.

print_output: If True will print previously captured stdout.
Default is False.

**kwargs: Extra options to pass to subprocess.

Example:
::
"ls"
"ls -la"
"chmod 754 local/file"

Returns:
Result with attributes args, returncode, stdout and stderr.

"""
if isinstance(cmd, str) and split:
cmd = shlex.split(cmd)
result = subprocess.run(cmd, input="", capture_output=True, **kwargs) # noqa: PLW1510
result.stdout = result.stdout.decode("utf-8")
result.stderr = result.stderr.decode("utf-8")
if print_output:
print(result.stdout)
return result

def call(cmd, env):
res = run(cmd, env=env)
if res.returncode:
print(res.stdout)
print(res.stderr)
assert False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chunk of code is borrowed from Kedro repo.

"-m",
"pip",
"install",
"-U",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: No need to do -U if installing a specific version?

@astrojuanlu
Copy link
Member

Merging anyway, we can address the comments later

@astrojuanlu astrojuanlu merged commit e5da357 into main Dec 20, 2023
19 checks passed
@astrojuanlu astrojuanlu deleted the noklam/fix-e2e-test-starter branch December 20, 2023 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants