Files
meshcore-bot/Makefile
T
agessaman fca42c50a7 fix(dependencies): pin ruff version to 0.15.15 in Makefile and CI workflow
- Updated the Makefile and GitHub Actions workflow to install ruff version 0.15.15, ensuring consistent linting behavior across environments.
- Added a required-version entry for ruff in pyproject.toml to prevent drift in lint rules.
- Modified the base_service.py method to return None instead of passing, improving clarity.
- Removed an unnecessary blank line in the test_packet_capture_transport_reconnect.py file.
2026-06-03 19:03:23 -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 modules/ tests/
$(MYPY) modules/
fix: $(VENV)/bin/python
$(RUFF) check --fix modules/ tests/
# ---------------------------------------------------------------------------
# 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