Skip to content

Commit

Permalink
✨ Add run function to nox (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
falexwolf authored Apr 25, 2024
1 parent 4b9c8e5 commit 9b73811
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions laminci/nox.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import json
import os
import shlex
from pathlib import Path
from typing import Dict, Optional

import nox
from nox import Session

from . import _nox_logger # noqa, silence logger
from . import _nox_logger # noqa, the import silences the logger
from ._env import get_package_name


Expand Down Expand Up @@ -41,9 +42,14 @@ def login_testuser2(session: Session, env: Optional[Dict[str, str]] = None):
_login_lamin_user("[email protected]", env=env)


def run(session: Session, s: str):
assert (args := shlex.split(s))
return session.run(*args)


def run_pre_commit(session: Session):
if nox.options.default_venv_backend == "none":
session.run(*"pip install pre-commit".split())
session.run(*"uv pip install --system pre-commit".split())
else:
session.install("pre-commit")
session.run("pre-commit", "install")
Expand Down

0 comments on commit 9b73811

Please sign in to comment.