Files
meshcore-bot/Makefile
T
agessaman 7f9c7eaa5f build: widen ruff scope, raise coverage floor, pin meshcore-cli
ruff now checks the whole tree in CI and in `make lint` instead of only
modules/ and tests/. scripts/ and the root-level scripts ship to users
too and were going unlinted; the wider scope flags nothing today, which
makes now the cheap time to widen it.

Coverage floor raised 35 to 50 against an actual 53.21%.

meshcore-cli was the only dependency with no version floor. It is still
required — meshcore_cli.next_cmd backs contact and channel operations
with no equivalent in the meshcore library — so it is pinned rather than
dropped, and the reason is recorded next to it.

Removes the dead [tool.pytest.ini_options] block: pytest.ini takes
precedence, so those settings were never in effect and could only drift
from the ones that are.
2026-08-07 13:45:38 -07:00

85 lines
2.8 KiB
Makefile

# Makefile for meshcore-bot
# Usage:
# make install — install runtime + optional dependencies into a venv
# make dev — install everything needed for development (tests, lint)
# make test — run pytest with coverage
# make lint — run ruff check + mypy
# make fix — auto-fix ruff lint errors
# make deb — build a .deb package (requires fakeroot + dpkg-deb)
# make config — launch the interactive ncurses config editor
# make clean — remove venv and build artefacts
PYTHON ?= python3
VENV := .venv
PIP := $(VENV)/bin/pip
PYTEST := $(VENV)/bin/pytest
RUFF := $(VENV)/bin/ruff
MYPY := $(VENV)/bin/mypy
.PHONY: all install dev test test-no-cov lint fix deb config clean
all: dev
# ---------------------------------------------------------------------------
# Environment setup
# ---------------------------------------------------------------------------
$(VENV)/bin/python:
$(PYTHON) -m venv $(VENV)
$(PIP) install --upgrade pip setuptools wheel
install: $(VENV)/bin/python
$(PIP) install -e ".[profanity,geo]"
dev: $(VENV)/bin/python
$(PIP) install -e ".[profanity,geo,test]"
$(PIP) install "ruff==0.15.15" mypy
# ---------------------------------------------------------------------------
# Testing
# ---------------------------------------------------------------------------
test: $(VENV)/bin/python
$(PYTEST) tests/ -v --tb=short
# Run tests without the coverage threshold (useful during initial development)
test-no-cov: $(VENV)/bin/python
$(PYTEST) tests/ -v --tb=short --no-cov
# ---------------------------------------------------------------------------
# Linting
# ---------------------------------------------------------------------------
lint: $(VENV)/bin/python
$(RUFF) check .
$(MYPY) modules/
fix: $(VENV)/bin/python
$(RUFF) check --fix .
# ---------------------------------------------------------------------------
# Packaging
# ---------------------------------------------------------------------------
# Build a .deb package. Pass VERSION= to override the version from pyproject.toml.
# Requires: fakeroot, dpkg-deb (sudo apt install fakeroot)
deb:
bash scripts/build-deb.sh $(VERSION)
# ---------------------------------------------------------------------------
# Configuration
# ---------------------------------------------------------------------------
# Launch the interactive ncurses config editor.
# Pass CONFIG= to open a specific config file (default: config.ini).
config: $(VENV)/bin/python
$(VENV)/bin/python scripts/config_tui.py $(CONFIG)
# ---------------------------------------------------------------------------
# Housekeeping
# ---------------------------------------------------------------------------
clean:
rm -rf $(VENV) build dist/*.egg-info .mypy_cache .ruff_cache __pycache__ .pytest_cache
rm -rf dist/deb-build