Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: Set up uv
uses: astral-sh/setup-uv@e06108dd0aef18192324c70427afc47652e63a82 # v7.5.0
with:
python-version: "3.12"
enable-cache: false

- name: "Run checks"
run: |
python ./check.py
./check.py
29 changes: 2 additions & 27 deletions check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env -S uv run --group check
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -7,30 +7,8 @@

import argparse
import os
import pathlib
import subprocess
import sys
import venv

ROOT = pathlib.Path(os.path.abspath(__file__)).parent
VENV = ROOT / "venv.dev"
PIP = VENV / "bin" / "pip"
PYTHON = VENV / "bin" / "python"
REQUIREMENTS = ROOT / "requirements.dev.txt"


def bootstrap():
venv.create(VENV, with_pip=True)

subprocess.run([str(PIP), "install", "-r", str(REQUIREMENTS)], check=True)

os.environ["PYBUILD_BOOTSTRAPPED"] = "1"
os.environ["PATH"] = "%s:%s" % (str(VENV / "bin"), os.environ["PATH"])
os.environ["PYTHONPATH"] = str(ROOT)

args = [str(PYTHON), __file__, *sys.argv[1:]]

os.execv(str(PYTHON), args)


def run_command(command: list[str]) -> int:
Expand Down Expand Up @@ -76,9 +54,6 @@ def run():

if __name__ == "__main__":
try:
if "PYBUILD_BOOTSTRAPPED" not in os.environ:
bootstrap()
else:
run()
run()
except subprocess.CalledProcessError as e:
sys.exit(e.returncode)
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,12 @@ build-backend = "uv_build"
[tool.uv.build-backend]
module-name = "pythonbuild"
module-root = ""

[dependency-groups]
check = [
"mypy>=1.19.1",
"ruff>=0.15.7",
"types-jinja2>=2.11.9",
"types-jsonschema>=4.26.0.20260324",
"types-pyyaml>=6.0.12.20250915",
]
Loading