diff --git a/.gitignore b/.gitignore index d681636..9602e3a 100644 --- a/.gitignore +++ b/.gitignore @@ -157,6 +157,18 @@ config-pymc.ini data/* !data/.gitkeep +# Node.js / frontend test framework artifacts +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.npm +package-lock.json +# keep package.json, .eslintrc.json, .htmlhintrc (committed) + +# .deb build artifacts +dist/deb-build/ + # Local user plugins and config (keep README and .gitkeep only) local/config.ini local/commands/* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5432f89 --- /dev/null +++ b/Makefile @@ -0,0 +1,84 @@ +# 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 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 diff --git a/requirements.txt b/requirements.txt index e1c7bf0..11b25f4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,20 +4,18 @@ asyncio-mqtt>=0.11.0 paho-mqtt>=1.6.0 configparser>=5.3.0 python-dateutil>=2.8.2 -schedule>=1.2.0 +apscheduler>=3.10.0 colorlog>=6.7.0 requests>=2.31.0 urllib3>=2.0.0 pyephem>=4.1.4 geopy>=2.3.0 maidenhead>=1.4.0 -# Optional but recommended for improved geocoding accuracy: -# pycountry>=23.12.0 # Country name validation and normalization -# us>=2.0.0 # US state name/abbreviation handling pytz>=2023.3 aiohttp>=3.8.0 cryptography>=41.0.0 pynacl>=1.5.0 +aiosqlite>=0.19.0 meshcore>=2.2.31 openmeteo-requests>=1.7.2 requests-cache>=1.1.1 @@ -26,12 +24,18 @@ flask>=2.3.0 flask-socketio>=5.3.0 meshcore-cli feedparser>=6.0.10 -# Discord/Telegram bridge profanity filter (drop or censor mode) -better-profanity>=0.7.0 -unidecode>=1.3.0 # Unicode-to-ASCII normalization so homoglyph slurs are caught + +# Optional: profanity filtering (pip install meshcore-bot[profanity]) +# better-profanity>=0.7.0 +# unidecode>=1.3.0 + +# Optional: improved geocoding accuracy (pip install meshcore-bot[geo]) +# pycountry>=23.12.0 +# us>=2.0.0 # Testing dependencies pytest>=7.0.0 pytest-asyncio>=0.21.0 pytest-mock>=3.10.0 pytest-cov>=4.0.0 +pytest-timeout>=2.1.0