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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ credentials/*
coverage.xml
.tox/
venv*
.venv/
*.pyc
.idea/
.python-version
Expand Down
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.PHONY: help install-dev test lint schema ci

# Python interpreter inside the project venv. Works on Windows GNU Make
# (forward slashes are fine) and on Linux/Mac. Check $(OS) == Windows_NT
# explicitly — testing for "non-empty" would mis-route Linux/Darwin shells
# that happen to export OS=Linux / OS=Darwin to the Windows path.
ifeq ($(OS),Windows_NT)
PY := .venv/Scripts/python
else
PY := .venv/bin/python
endif
Comment thread
tommyjcarpenter marked this conversation as resolved.

# ---- Default: show targets ----
help:
@echo "Common targets:"
@echo " make test Run the same unittest command CI runs (.github/workflows/test.yml)"
@echo " make lint Run the same ruff checks CI runs (.github/workflows/lint.yml)"
@echo " make schema Validate sample_config.json (.github/workflows/schema.yml)"
@echo " make ci Full pre-push verification: lint + test + schema"
@echo " make install-dev Install runtime + dev deps (adds ruff) via Poetry"

# `poetry install` alone leaves out the dev group, so `make lint` would fail
# on a fresh clone. `--with dev` pulls in ruff at the CI-pinned version.
Comment thread
tommyjcarpenter marked this conversation as resolved.
# The committed poetry.toml pins virtualenvs.in-project = true so Poetry
# creates the venv at .venv/ inside the project, which is where the $(PY)
# above looks for it; without that, Poetry would cache the venv elsewhere
# and the subsequent test/lint/schema targets would not find Python.
install-dev:
poetry install --with dev

# =============================================================================
# CI-equivalent targets. These mirror .github/workflows/*.yml exactly so a
# clean run locally means the GitHub run will also pass.
# =============================================================================

# Mirrors .github/workflows/test.yml — discovers and runs every unittest
# under tests/. The package itself imports cleanly on any OS (only the
# inner functions shell out to OS-specific tools), so the same command
# passes on the Linux/macOS/Windows runners CI matrixes over.
test:
$(PY) -m unittest discover -v tests

# Mirrors .github/workflows/lint.yml — ruff check + ruff format --check.
lint:
$(PY) -m ruff check bootstrap/
$(PY) -m ruff format --check bootstrap/

# Mirrors .github/workflows/schema.yml — loads sample_config.json and runs
# it through bootstrap.schema.config_validate. Catches regressions where a
# schema change makes the documented sample config invalid.
schema:
$(PY) -c "import json; from bootstrap.schema import config_validate; config_validate(json.load(open('sample_config.json'))); print('sample_config.json is valid')"

# Full pre-push verification: everything CI runs, in one shot.
ci: lint test schema
93 changes: 61 additions & 32 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true
Comment thread
tommyjcarpenter marked this conversation as resolved.
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ python = "^3.10"
click = "^8.1.3"
jsonschema = "^4.14.0"

[tool.poetry.dev-dependencies]
# Mark the dev group optional so plain `poetry install` (runtime use of the
# `runboot` script) does not pull ruff. Contributors get it via the
# Makefile's `install-dev` target, which passes `--with dev`.
[tool.poetry.group.dev]
optional = true

[tool.poetry.group.dev.dependencies]
# Pinned to the same version CI installs (.github/workflows/lint.yml). Bump
# in lockstep with the workflow so `make lint` and CI agree on formatting.
ruff = "0.15.12"
Comment thread
tommyjcarpenter marked this conversation as resolved.

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
Loading