Skip to content

Commit

Permalink
Install pip-requirements-parser in workspace
Browse files Browse the repository at this point in the history
and not in the virtualenv.
  • Loading branch information
akaihola committed Jul 29, 2024
1 parent 8972d66 commit 46964e6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions action/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,27 @@
print(f"::error::Working directory does not exist: {WORKING_DIRECTORY}", flush=True)
sys.exit(21)

run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True) # nosec

def pip_install(*packages):
proc = run( # nosec
[str(ENV_BIN / "python"), "-m", "pip", "install", *packages],
def pip_install(*packages, python):

Check failure on line 26 in action/main.py

View workflow job for this annotation

GitHub Actions / Pylint

action/main.py#L26

Missing function or method docstring (missing-function-docstring, C0116)
pip_proc = run( # nosec
[str(python), "-m", "pip", "install", *packages],
check=False,
stdout=PIPE,
stderr=STDOUT,
encoding="utf-8",
)
print(proc.stdout, end="")
if proc.returncode:
print(pip_proc.stdout, end="")
if pip_proc.returncode:
print(f"::error::Failed to install {' '.join(packages)}.", flush=True)
sys.exit(proc.returncode)
sys.exit(pip_proc.returncode)


pip_install("pip-requirements-parser")
pip_install("pip-requirements-parser", python=sys.executable)

from pip_requirements_parser import parse_reqparts_from_string

Check failure on line 42 in action/main.py

View workflow job for this annotation

GitHub Actions / flake8

module level import not at top of file

Check failure on line 42 in action/main.py

View workflow job for this annotation

GitHub Actions / Pylint

action/main.py#L42

Import "from pip_requirements_parser import parse_reqparts_from_string" should be placed at the top of the module (wrong-import-position, C0413)

run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True) # nosec

req = ["graylint[color]"]
if VERSION:
if VERSION.startswith("@"):
Expand All @@ -62,7 +64,7 @@ def pip_install(*packages):
req.append(str(linter_requirement))
linter_options.extend(["--lint", linter])

pip_install(*req)
pip_install(*req, python=ENV_BIN / "python")


base_cmd = [str(ENV_BIN / "darker")]
Expand Down

0 comments on commit 46964e6

Please sign in to comment.