Skip to content

Instantly share code, notes, and snippets.

@MtkN1
Created April 4, 2024 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MtkN1/41f36491dbf7162043d89d73a9d87dec to your computer and use it in GitHub Desktop.
Save MtkN1/41f36491dbf7162043d89d73a9d87dec to your computer and use it in GitHub Desktop.
nox for Rye (it works, sort of)
import nox
import os
from pathlib import Path
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]
VENV_BACKEND = "uv"
def ensurepath():
rye_home = os.getenv("RYE_HOME")
rye_py = Path(rye_home) if rye_home else Path.home() / ".rye" / "py"
for py_dir in rye_py.iterdir():
bin_dir = py_dir / "bin"
os.environ["PATH"] = f"{bin_dir}:{os.environ['PATH']}"
ensurepath()
@nox.session()
def fetch(session: nox.Session):
for require_version in PYTHON_VERSIONS:
session.run("rye", "fetch", require_version, external=True)
ensurepath()
@nox.session(python=PYTHON_VERSIONS, venv_backend=VENV_BACKEND)
def tests(session: nox.Session):
session.install("-r", "requirements-dev.lock")
session.run("pytest")
@nox.session(venv_backend=VENV_BACKEND)
def lint(session: nox.Session):
session.install("-r", "requirements-dev.lock")
session.run("ruff", "check")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment