Development
Work on a feature or bug-fix branch. Open a pull request and merge to main only when CI is green. Documentation-only updates may go straight to main without a pull request; CI still runs there, and deploy is skipped when no runtime paths changed (see below).
Shared writes belong in mampio/services.py. Scope every query to the current user. Do not add a PWA, SPA, or dependency without a clear product need.
Tests
bin/test
bin/test runs what CI runs: ruff, pyright, the Sphinx build, the JavaScript checks, the full pytest suite and the PostgreSQL regressions below. Extra arguments go to pytest, for example bin/test -k planner. The pytest suite alone is uv run python -m pytest; pytest-xdist runs it in parallel (-n auto). Model, service, API, permission, and view tests live under src/mampio/tests/. Browser journeys live in e2e/ and use Playwright. Install Chromium once:
uv run playwright install chromium
Browser tests only:
uv run python -m pytest e2e
This documentation is built in the same suite. Sphinx treats warnings as errors.
PostgreSQL write regressions
The normal suite uses SQLite. Row locking, concurrent article creation and merged quantity limits are checked against PostgreSQL: bin/test runs these tests against the local PostgreSQL from docker-compose.yaml, CI in the job postgres. The file list lives in both places.
Use a test role with permission to create databases. pytest creates and removes
its own test_<POSTGRES_DB> database; do not point this at production. The
postgres CI job runs the same tests against PostgreSQL 17 and is required by
the production image build. PostgreSQL-only tests skip during SQLite runs.
JavaScript checks
Node.js 24 or newer is needed for the development checks and vendor updates. Install the exact package versions from the committed lockfile and run the same checks as CI:
npm ci --ignore-scripts
npm run lint
npm run format:check
npm run test:vendor
npm run vendor:check
Run npm run format to apply the shared Prettier format to the JavaScript and its
tooling configuration. ESLint checks browser globals and correctness rules across
application JavaScript and the Node scripts. Generated vendor files are excluded
from lint and formatting. The javascript CI job checks lint, formatting, the
vendor build tests, and the committed vendor files; the production build requires
this job as well as the Python and browser tests.
Vendor assets
Bootstrap 5.3.3, Bootstrap Icons 1.11.3, HTMX 2.0.4, and SortableJS 1.15.6 are
pinned npm development dependencies. Their runtime files and license notices are
committed under src/mampio/static/mampio/vendor/ and served through
Django staticfiles. Bootstrap’s bundle includes Popper, whose license is copied
as well. Production and ordinary Python development do not need Node.js or an
asset build. The Google Fonts stylesheet remains an external request; browser
font fallbacks work when that service is unavailable.
To regenerate the vendor files:
npm ci --ignore-scripts
npm run vendor:build
npm run vendor:check
scripts/vendor.mjs uses Node’s filesystem APIs and an explicit copy list.
It verifies installed versions against the lockfile and prepares all assets in
a temporary sibling directory before replacing vendor/. Copy failures leave
the current vendor files intact. If the final rename fails, the script restores
the previous directory; if restoration also fails, it preserves the backup and
prints its recovery path. Run builds with the development server stopped because
the two renames briefly remove the destination directory.
Only the compiled Bootstrap CSS and bundle, the minified Bootstrap Icons CSS
with its two referenced fonts, and the minified HTMX and SortableJS scripts are
shipped. Bootstrap Icons retains its font/fonts/ layout so relative URLs resolve.
SCSS, icon metadata, alternative CSS files, and source maps are omitted.
Source-map comments are removed from the copied CSS and JavaScript to avoid
requests for maps and source trees that are not shipped. Debugging uses the
distributed minified files.
For an intentional dependency update, change its exact version in package.json,
run npm install --package-lock-only --ignore-scripts, then run the commands
above and the test suite. Commit package.json, package-lock.json, and the
regenerated vendor files together. vendor:check compares filenames and bytes,
detects missing, changed, and unexpected files, and never replaces the current
vendor directory.
Cards and editor rows use createSortable, which returns the SortableJS instance
and destroys it during HTMX cleanup.
Article and recipe suggestion lists display at most 20 matches. Typing a more
specific query still searches the complete catalog.
Documentation
Build the HTML locally:
uv sync --all-groups
uv run sphinx-build -W -b html docs docs/_build/html
Open docs/_build/html/index.html. scripts/deploy-docs.sh mampio in iqpp_prod builds them from a clean checkout and publishes them at https://docs.mampio.com.
CI/CD
.github/workflows/ci-cd.yml runs on pull requests and on main:
javascript — ESLint, Prettier, vendor build tests, and vendor consistency checks using locked npm dependencies.
test — Ruff (including docstrings,
ruff check src e2e), pyright (uv run pyright, must report no errors), pytest, and the browser suite (every pull request and every push tomain).build — on every pull request and push. Builds the image, then probes it under the production settings against an empty Postgres service:
check,migrate,import project.wsgi, andcollectstatic. Only a push tomainwith runtime changes (src/,Dockerfile, lockfiles) pushesghcr.io/diefenbach/mampio:<tag>, where<tag>is the commit date and short SHA, for example20261125-02f9793. The last 10 versions stay on ghcr.io.deploy — same gate as the push. Calls
.github/workflows/deploy.yml, which runsdeploy mampio <tag>over SSH. The secrets live in the GitHub environmentproduction, which accepts only runs frommain. The server key may only startiqpp_prod/scripts/deploy.sh --only mampio. That script backs up the database, migrates, collects static files, restartsmampioandmampio-mcp, checks the site, and starts the previous image again if anything fails.
Roll back to an older image with gh workflow run deploy.yml -R diefenbach/mampio -f tag=<tag>. The full description lives in iqpp_prod/docs/deploy.md.
Documentation-only changes (for example docs/, AGENTS.md, or README.md) still run test and the build probe, but push no image and skip deploy. The docs are published by hand with scripts/deploy-docs.sh mampio in iqpp_prod.
Feature branches are tested. They are not deployed.
Dependency updates
Dependabot opens one grouped pull request per week for each of uv (uv.lock), npm, GitHub Actions, and the Dockerfile base image (.github/dependabot.yml). It skips new Python versions in the base image, because moving from 3.15 to 3.16 is a deliberate change. npm comes as two pull requests: tooling (ESLint, Prettier) passes on its own, while frontend (Bootstrap, Bootstrap Icons, htmx, SortableJS) fails vendor:check until someone runs npm run vendor:build, commits the vendor files, and checks the pages in a browser. Security fixes arrive as separate pull requests as soon as an advisory is published. Every one of these pull requests runs the full CI. Merge one only when CI is green; a merge that changes uv.lock or the Dockerfile deploys like any other.