chore: replace Taskfile with mise tasks (#9040)

This commit is contained in:
Hayden authored and GitHub committed 2026-11-07 17:27:17 -06:00
1 parent 6911655ce6
commit c017113860
16 files changed
+306 -440

No files matched your search

+11 -11
View File
@@ -30,28 +30,28 @@ lsof -a -p <PID> -d cwd -Fn | tail -1
Run each one with the Bash tool's `run_in_background: true` so it keeps running and its output stays readable. Backend first:
```bash
task py
mise run py
```
```bash
task ui
mise run ui
```
The frontend proxies `/api`, `/docs`, and `/openapi.json` to `API_URL` (default `http://localhost:9000`), so the browser only ever talks to the frontend port.
**Alternate ports** (when the defaults are taken by another checkout). Shell env wins over the Taskfile `env:` block, so prefix the commands:
**Alternate ports** (when the defaults are taken by another checkout). Shell env wins over the `[env]` block in `mise.toml`, so prefix the commands:
```bash
API_PORT=9100 BASE_URL=http://localhost:3100 task py
API_PORT=9100 BASE_URL=http://localhost:3100 mise run py
```
```bash
API_URL=http://localhost:9100 PORT=3100 task ui
API_URL=http://localhost:9100 PORT=3100 mise run ui
```
Then use `http://localhost:3100` everywhere below.
If `task ui` exits with `pnpm: could not resolve pnpm to a regular file within 40 symlink hops`, the shell is using a pnpm other than the one `packageManager` in `frontend/package.json` pins. Install that version, or run the same command from `frontend/` directly: `pnpm run dev --no-fork`, with the same env prefix.
If `mise run ui` exits with `pnpm: could not resolve pnpm to a regular file within 40 symlink hops`, the shell is using a pnpm other than the one `packageManager` in `frontend/package.json` pins. Install that version, or run the same command from `frontend/` directly: `pnpm run dev --no-fork`, with the same env prefix.
**Wait for readiness** without `sleep`:
@@ -60,9 +60,9 @@ curl -sf --retry 30 --retry-delay 2 --retry-all-errors -o /dev/null http://local
curl -sf --retry 60 --retry-delay 2 --retry-all-errors -o /dev/null http://localhost:3000 && echo frontend up
```
The first frontend load compiles on demand and can take 30s or more. If a check fails, read the background task's output before retrying -- a missing `uv sync` / `pnpm install` (`task setup`) or a migration error shows up there.
The first frontend load compiles on demand and can take 30s or more. If a check fails, read the background task's output before retrying -- a missing `uv sync` / `pnpm install` (`mise run setup`) or a migration error shows up there.
Dev data lives in `dev/data/` (SQLite). It persists across runs. Don't run `task dev:clean` without asking -- it deletes the user's local data.
Dev data lives in `dev/data/` (SQLite). It persists across runs. Don't run `mise run dev:clean` without asking -- it deletes the user's local data.
## 3. Log in
@@ -125,7 +125,7 @@ Mealie uses Vuetify, so many inputs are composites: the snapshot shows the label
- **Frontend** (`frontend/app/**`): Nuxt HMR applies most changes without a reload. After changes to plugins, middleware, `nuxt.config.ts`, or layouts, `browser_navigate` to the same URL to reload. The MCP blocks service workers, so the PWA cache won't serve stale bundles.
- **Backend** (`mealie/**`): uvicorn reloads on save with a 2s delay. Check the backend task output for import errors before blaming the UI.
- **Pydantic schema changes**: run `task dev:generate` so the TypeScript types in `frontend/app/lib/api/types/` match, then reload the page.
- **Pydantic schema changes**: run `mise run dev:generate` so the TypeScript types in `frontend/app/lib/api/types/` match, then reload the page.
- **New UI strings**: add them only to `frontend/app/lang/messages/en-US.json`.
Verify the actual behavior -- what the user would see -- not just that the page rendered. Check the console and network panel once more before calling it done.
@@ -138,10 +138,10 @@ Run a spec against the dev servers:
```bash
cd tests/e2e
pnpm install && pnpm exec playwright install chromium # once; `task setup:e2e` installs every browser plus OS deps && E2E_BASE_URL=http://localhost:3000 PLAYWRIGHT_HTML_OPEN=never pnpm playwright test recipe-card.spec.ts --project chromium
pnpm install && pnpm exec playwright install chromium # once; `mise run setup:e2e` installs every browser plus OS deps && E2E_BASE_URL=http://localhost:3000 PLAYWRIGHT_HTML_OPEN=never pnpm playwright test recipe-card.spec.ts --project chromium
```
`login.spec.ts` and `oidc-native.spec.ts` need the LDAP and OIDC mock servers, so they only pass against the full stack. CI runs that with `task e2e`, which builds the production Docker image and serves the app on port 9000 -- it takes several minutes, and it fails if a dev backend already holds port 9000. Run it only when asked or when the change touches auth.
`login.spec.ts` and `oidc-native.spec.ts` need the LDAP and OIDC mock servers, so they only pass against the full stack. CI runs that with `mise run e2e`, which builds the production Docker image and serves the app on port 9000 -- it takes several minutes, and it fails if a dev backend already holds port 9000. Run it only when asked or when the change touches auth.
## 8. Clean up
+1 -1
View File
@@ -41,7 +41,7 @@
51204, // used for test coverage report
24678 // used by nuxt when hot-reloading using polling
],
"onCreateCommand": "sudo chown vscode:vscode /workspaces/mealie/.venv /workspaces/mealie/frontend/node_modules && mise install && task setup --force",
"onCreateCommand": "sudo chown vscode:vscode /workspaces/mealie/.venv /workspaces/mealie/frontend/node_modules && mise install && mise run setup --force",
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
+7
View File
@@ -18,6 +18,13 @@ runs:
# renovate: datasource=github-releases depName=jdx/mise extractVersion=^v(?<version>.+)$
version: 2026.10.25
install_args: ${{ inputs.tools }}
# [env] in mise.toml is for mise tasks; don't export it to every later step
env: false
# `mise run` would otherwise install every tool in mise.toml, not only the ones this job asked for
- name: Keep mise run to the installed tools
shell: bash
run: echo "MISE_TASK_RUN_AUTO_INSTALL=false" >> "$GITHUB_ENV"
- name: Find pnpm store
id: pnpm-store
+2 -2
View File
@@ -24,7 +24,7 @@ jobs:
- name: Set up tools
uses: ./.github/actions/setup-tools
with:
tools: python node pnpm uv task
tools: python node pnpm uv
cache-pnpm-store: true
- name: Install dependencies 👨🏻‍💻
@@ -48,7 +48,7 @@ jobs:
env:
SKIP_PACKAGE_DEPS: true
run: |
task py:package
mise run py:package
- name: Archive built package
uses: actions/upload-artifact@v6
+4 -4
View File
@@ -52,7 +52,7 @@ jobs:
- name: Set up tools
uses: ./.github/actions/setup-tools
with:
tools: python uv task
tools: python uv pipx:semgrep
# Catches a lockfile resolved by an out-of-date uv, which silently ignores
# the `exclude-newer` cooling window instead of erroring. UV_FROZEN must be
@@ -102,11 +102,11 @@ jobs:
- name: Mypy Typecheck
run: |
task py:mypy
mise run py:mypy
- name: Semgrep (authz rules)
run: |
task py:semgrep
mise run py:semgrep
- name: Pytest
env:
@@ -125,4 +125,4 @@ jobs:
LDAP_NAME_ATTRIBUTE: cn
LDAP_MAIL_ATTRIBUTE: mail
run: |
task py:test
mise run py:test
-1
View File
@@ -173,7 +173,6 @@ lcov.info
dev/code-generation/openapi.json
.run/
.task/*
.dev.env
frontend/eslint.config.deprecated.js
+1 -1
View File
@@ -1,4 +1,4 @@
# Test cases for authz.yml. Run with `task py:semgrep`.
# Test cases for authz.yml. Run with `mise run py:semgrep`.
from fastapi import HTTPException, status
from mealie.routes._base.permissions import forbidden, not_found
+5 -5
View File
@@ -3,7 +3,7 @@
"tasks": [
{
"label": "Production: Build and Start Docker Compose",
"command": "task docker:prod",
"command": "mise run docker:prod",
"type": "shell",
"args": [],
"problemMatcher": [
@@ -16,7 +16,7 @@
},
{
"label": "Dev: Start Backend",
"command": "task py",
"command": "mise run py",
"type": "shell",
"presentation": {
"reveal": "always",
@@ -26,7 +26,7 @@
},
{
"label": "Dev: Start Frontend",
"command": "task ui",
"command": "mise run ui",
"type": "shell",
"presentation": {
"reveal": "always",
@@ -36,7 +36,7 @@
},
{
"label": "Dev: Start Docs Server",
"command": "task docs",
"command": "mise run docs",
"type": "shell",
"presentation": {
"reveal": "always",
@@ -46,7 +46,7 @@
},
{
"label": "Run python tests",
"command": "task py:test",
"command": "mise run py:test",
"type": "shell",
"presentation": {
"reveal": "always"
+28 -28
View File
@@ -32,14 +32,14 @@ Mealie is a self-hosted recipe manager, meal planner, and shopping list applicat
- `XOut`: a saved entity as the API returns it; `XSummary`: a slimmer list-view version
- `XDraft`: lenient input that may lack ids or slugs until the server resolves them (e.g. `RecipeDraft`, `TagDraft`)
- Response schemas extend `MealieOutModel`, which marks defaulted fields as required in the generated TypeScript types. Request bodies extend `MealieModel`.
- Auto-exported from submodules via `__init__.py` files (generated by `task dev:generate`)
- Auto-exported from submodules via `__init__.py` files (generated by `mise run dev:generate`)
- TypeScript types auto-generated from Pydantic schemas - **never manually edit** `frontend/app/lib/api/types/`
**Database & Sessions:**
- Session management via `Depends(generate_session)` in FastAPI routes
- Use `session_context()` context manager in services/scripts
- SQLAlchemy models in `mealie/db/models/`, migrations in `mealie/alembic/`
- Create migrations: `task py:migrate -- "description"`
- Create migrations: `mise run py:migrate -- "description"`
### Frontend Architecture (frontend/)
@@ -60,43 +60,43 @@ Mealie is a self-hosted recipe manager, meal planner, and shopping list applicat
- Auth state via `use-mealie-auth.ts` composable
- Prefer composables over global state stores
## Essential Commands (via Task/Taskfile.yml)
## Essential Commands (mise tasks in mise.toml)
**Development workflow:**
```bash
mise install
task setup # Install all dependencies (Python + Node)
task dev:services # Start Postgres & Mailpit containers
task py # Start FastAPI backend (port 9000)
task ui # Start Nuxt frontend (port 3000)
task docs # Start Zensical documentation server
mise run setup # Install all dependencies (Python + Node)
mise run dev:services # Start Postgres & Mailpit containers
mise run py # Start FastAPI backend (port 9000)
mise run ui # Start Nuxt frontend (port 3000)
mise run docs # Start Zensical documentation server
```
**Code generation (REQUIRED after schema changes):**
```bash
task dev:generate # Generate TypeScript types, schema exports, test helpers
mise run dev:generate # Generate TypeScript types, schema exports, test helpers
```
**Testing & Quality:**
```bash
task py:test # Run pytest (supports args: task py:test -- -k test_name)
task py:check # Format + lint + type-check + test (full validation)
task py:format # Ruff format
task py:lint # Ruff check
task py:mypy # Type checking
task ui:test # Vitest frontend tests
task ui:check # Frontend lint + test
mise run py:test # Run pytest (supports args: mise run py:test -- -k test_name)
mise run py:check # Format + lint + type-check + test (full validation)
mise run py:format # Ruff format
mise run py:lint # Ruff check
mise run py:mypy # Type checking
mise run ui:test # Vitest frontend tests
mise run ui:check # Frontend lint + test
```
**Database:**
```bash
task py:migrate -- "description" # Generate Alembic migration
task py:postgres # Run backend with PostgreSQL config
mise run py:migrate -- "description" # Generate Alembic migration
mise run py:postgres # Run backend with PostgreSQL config
```
**Docker:**
```bash
task docker:prod # Build and run production Docker compose
mise run docker:prod # Build and run production Docker compose
```
## Critical Development Practices
@@ -133,7 +133,7 @@ task docker:prod # Build and run production Docker compose
### Frontend
1. **Run code generation after backend schema changes:** `task dev:generate`
1. **Run code generation after backend schema changes:** `mise run dev:generate`
2. **TypeScript strict mode:** All code must pass type checking
@@ -151,7 +151,7 @@ task docker:prod # Build and run production Docker compose
### Cross-Cutting Concerns
1. **Code generation is source of truth:** After Pydantic schema changes, run `task dev:generate` to update:
1. **Code generation is source of truth:** After Pydantic schema changes, run `mise run dev:generate` to update:
- TypeScript types (`frontend/app/lib/api/types/`)
- Schema exports (`mealie/schema/*/__init__.py`)
- Test data paths and routes
@@ -161,9 +161,9 @@ task docker:prod # Build and run production Docker compose
- Households contain recipes, meal plans, shopping lists
- Repositories automatically filter by group/household context
3. **Pre-commit hooks:** Install via `task setup:py`, enforces Ruff formatting/linting
3. **Pre-commit hooks:** Install via `mise run setup:py`, enforces Ruff formatting/linting
4. **Testing before PRs:** Run `task py:check` and `task ui:check` before submitting PRs
4. **Testing before PRs:** Run `mise run py:check` and `mise run ui:check` before submitting PRs
## Pull Request Best Practices
@@ -173,7 +173,7 @@ Read `CONTRIBUTING.md` first. Its "Writing Style" section sets the rules for PR
1. **Draft PRs are optional:** Create a draft PR early if you want feedback while working, or open directly as ready when complete
2. **Verify code generation:** If you modified Pydantic schemas, ensure `task dev:generate` was run
2. **Verify code generation:** If you modified Pydantic schemas, ensure `mise run dev:generate` was run
3. **Follow Conventional Commits:** Title your PR according to the conventional commits format (see PR template)
4. **Add release notes:** Include user-facing changes in the PR description
@@ -198,7 +198,7 @@ Read `CONTRIBUTING.md` first. Its "Writing Style" section sets the rules for PR
**Generated Files:**
- Verify `frontend/app/lib/api/types/` files weren't manually edited (they're auto-generated)
- Check that `mealie/schema/*/__init__.py` exports match actual schema files (auto-generated)
- If schemas changed, confirm generated files were updated via `task dev:generate`
- If schemas changed, confirm generated files were updated via `mise run dev:generate`
**Code Quality:**
- Is the code readable and well-organized?
@@ -226,14 +226,14 @@ Read `CONTRIBUTING.md` first. Its "Writing Style" section sets the rules for PR
- **Don't manually edit generated files:** `frontend/app/lib/api/types/`, schema `__init__.py` files
- **Repository context:** Repos are group/household-scoped - passing wrong IDs causes 404s
- **Session handling:** Don't create sessions manually, use dependency injection or `session_context()`
- **Schema changes require codegen:** After changing Pydantic models, run `task dev:generate`
- **Schema changes require codegen:** After changing Pydantic models, run `mise run dev:generate`
- **Translation files:** Only modify `en-US` locale files - all other locales are managed by Crowdin
- **Dev containers:** This project uses VS Code dev containers - leverage the pre-configured environment
- **Task commands:** Use `task` commands instead of direct tool invocation for consistency
- **Task commands:** Use `mise run` tasks instead of direct tool invocation for consistency
## Key Files to Reference
- `Taskfile.yml` - All development commands and workflows
- `mise.toml` - Toolchain versions and all development tasks (`mise tasks` lists them)
- `mealie/routes/_base/base_controllers.py` - Controller base classes and patterns
- `mealie/repos/repository_factory.py` - Repository factory and available repos
- `frontend/app/lib/api/base/base-clients.ts` - API client base classes
+2 -2
View File
@@ -13,7 +13,7 @@ Pull requests are the best way to propose changes to the codebase (we use [GitHu
3. If you're interested on working on major changes please get in touch on discord and coordinate with other developers. No sense in doubling up on work if someones already on it.
4. Once you've got an idea of what changes you want to make, create a draft PR as soon as you can to let us know what you're working on and how we can help!
5. If you've changed APIs, update the documentation.
6. Run tests, including `task py:check`.
6. Run tests, including `mise run py:check`.
7. Issue that pull request! First make a draft PR, make sure that the automated GitHub tests all pass, then mark as ready for review. We follow Conventional Commits syntax; please title your PR as described in the PR template.
8. Be sure to add release notes to the pull request.
@@ -24,7 +24,7 @@ This guidance applies to all contributor prose. It includes pull request titles,
**LLM authors**: Use [ASD-STE100 Simplified Technical English](https://www.asd-ste100.org/) for all text. Use this practical subset:
- Use words from the STE approved-vocabulary dictionary. Technical names that are not in the dictionary can be used as-is (for example `mealie-next`, `task py:check`, `BaseUserController`, or `HttpRepo`).
- Use words from the STE approved-vocabulary dictionary. Technical names that are not in the dictionary can be used as-is (for example `mealie-next`, `mise run py:check`, `BaseUserController`, or `HttpRepo`).
- Use one word for one meaning. Do not vary synonyms for style.
- Use active voice only. Do not use passive constructions.
- Use present or simple past tense. Do not use `-ing` gerunds or participles as nouns.
-372
View File
@@ -1,372 +0,0 @@
# https://taskfile.dev
version: "3"
vars:
GREETING: Hello, World!
env:
DEFAULT_GROUP: Home
DEFAULT_HOUSEHOLD: Family
PRODUCTION: false
# Install from the committed lockfile; never re-resolve. Required because the
# rolling `exclude-newer` cooling window (pyproject [tool.uv]) would otherwise
# make every `uv run`/`uv sync` re-resolve and fail on in-window pins.
UV_FROZEN: "1"
API_PORT: 9000
API_DOCS: True
TOKEN_TIME: 256 # hours
# mailplit SMTP config
# start dev:services to use mailpit
SMTP_HOST: localhost
SMTP_PORT: 1025
SMTP_FROM_NAME: MealieDev
SMTP_FROM_EMAIL: mealie@example.com
SMTP_AUTH_STRATEGY: NONE
BASE_URL: http://localhost:3000
LANG: en-US
# loads .env file if it exists
dotenv:
- .env
- .dev.env
tasks:
docs:
desc: runs the documentation server
dir: docs
cmds:
- uv run zensical serve
setup:ui:
desc: setup frontend dependencies
dir: frontend
run: once
cmds:
- pnpm install
sources:
- package.json
- pnpm-lock.yaml
setup:py:
desc: setup python dependencies
run: once
cmds:
- uv sync --extra pgsql --group dev
- uv run pre-commit install
sources:
- uv.lock
- pyproject.toml
- .pre-commit-config.yaml
setup:e2e:
desc: setup e2e test dependencies
dir: tests/e2e
run: once
cmds:
- pnpm install
- pnpm run playwright install --with-deps
sources:
- package.json
- playwright.config.ts
- pnpm-lock.yaml
setup:
desc: setup all dependencies
deps:
- setup:ui
- setup:py
dev:generate:
desc: run code generators
cmds:
- uv run python dev/code-generation/main.py {{ .CLI_ARGS }}
- task: py:format
dev:services:
desc: starts postgres and mailpit containers
dir: docker
cmds:
- docker compose -f docker-compose.dev.yml up
dev:clean:
desc: cleans up dev environment !! removes all data files !!
vars:
DEV_DATA: ""
cmds:
- rm -r ./dev/data/recipes/
- rm -r ./dev/data/users/
- rm -rf ./dev/data/postgres/
- rm -f ./dev/data/mealie*.db
- rm -f ./dev/data/mealie*.db-shm
- rm -f ./dev/data/mealie*.db-wal
- rm -f ./dev/data/mealie.log
- rm -f ./dev/data/.secret
py:mypy:
desc: runs python type checking
cmds:
- uv run mypy mealie
py:test:
desc: runs python tests in parallel across CPU cores (support args after '--')
cmds:
# --dist loadfile: each test file runs in order on a single worker
- uv run pytest -n auto --dist loadfile {{ .CLI_ARGS }}
py:format:
desc: runs python code formatter
cmds:
- uv run ruff format .
py:lint:
desc: runs python linter
cmds:
- uv run ruff check .
py:semgrep:
desc: runs the authz semgrep rules in .semgrep and their tests
vars:
# semgrep still imports pkg_resources and does not support every Python version uv picks.
SEMGREP: uvx --python 3.12 --with setuptools semgrep==1.179.0
cmds:
- "{{ .SEMGREP }} scan --test --metrics off --config .semgrep/authz.yml .semgrep/authz.py"
- "{{ .SEMGREP }} scan --error --metrics off --config .semgrep mealie"
py:check:
desc: runs all linters, type checkers, and formatters
deps:
- py:format
- py:lint
- py:semgrep
- py:mypy
- py:test
py:coverage:
desc: runs python coverage and generates html report
cmds:
- uv run pytest
- uv run coverage report -m
- uv run coveragepy-lcov
- uv run coverage html
- open htmlcov/index.html
py:package:copy-frontend:
desc: copy the frontend files into the Python package
internal: true
deps:
- ui:generate
cmds:
- rm -rf mealie/frontend
- cp -a frontend/dist mealie/frontend
sources:
- frontend/dist/**
generates:
- mealie/frontend/**
py:package:generate-requirements:
desc: Generate requirements file to pin all packages, effectively a "pip freeze"
before installation begins
internal: true
cmds:
- uv export --no-dev --no-editable --no-emit-project --extra pgsql --format
requirements-txt --output-file dist/dependencies.txt
- cp dist/dependencies.txt dist/requirements.txt
# Include mealie in the requirements, hashing the package that was just built to ensure it's the one installed
- echo "mealie[pgsql]=={{.MEALIE_VERSION}} \\" >> dist/requirements.txt
- pip hash dist/mealie-{{.MEALIE_VERSION}}-py3-none-any.whl | tail -n1 |
tr -d '\n' >> dist/requirements.txt
- echo " \\" >> dist/requirements.txt
- pip hash dist/mealie-{{.MEALIE_VERSION}}.tar.gz | tail -n1 >>
dist/requirements.txt
vars:
MEALIE_VERSION:
sh: python -c "import tomllib; print(tomllib.load(open('pyproject.toml',
'rb'))['project']['version'])"
sources:
- uv.lock
- pyproject.toml
- dist/mealie-*.whl
- dist/mealie-*.tar.gz
generates:
- dist/dependencies.txt
- dist/requirements.txt
py:package:deps-parallel:
desc: Run py:package dependencies in parallel
internal: true
deps:
- setup:py
- py:package:copy-frontend
py:package:deps:
desc: Dependencies of py:package, skippable by setting SKIP_PACKAGE_DEPS=true
internal: true
cmds:
- task: py:package:deps-parallel
status:
- "{{ .SKIP_PACKAGE_DEPS | default \"false\"}}"
py:package:build:
internal: true
deps:
- py:package:deps
cmds:
- uv build --out-dir dist
sources:
- uv.lock
- pyproject.toml
- mealie/**
py:package:
desc: builds Python packages (sdist and wheel) in top-level dist directory
cmds:
- task: py:package:build
- task: py:package:generate-requirements
py:
desc: runs the backend server
cmds:
- uv run python mealie/app.py
py:postgres:
desc: runs the backend server configured for containerized postgres
env:
DB_ENGINE: postgres
POSTGRES_USER: mealie
POSTGRES_PASSWORD: mealie
POSTGRES_SERVER: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: mealie
cmds:
- uv run python mealie/app.py
py:migrate:
desc: generates a new database migration file e.g. task py:migrate -- "add new
column"
cmds:
- uv run alembic --config mealie/alembic/alembic.ini revision
--autogenerate -m "{{ .CLI_ARGS }}"
- task: py:format
ui:build:
desc: builds the frontend in frontend/dist
dir: frontend
cmds:
- pnpm build
sources:
- "**"
- exclude: .nuxt/**
- exclude: .output/**
- exclude: dist/**
- exclude: node_modules/.cache/**
ui:generate:
desc: generates a static version of the frontend in frontend/dist
dir: frontend
deps:
- setup:ui
cmds:
- pnpm generate
sources:
- "**"
- exclude: .nuxt/**
- exclude: .output/**
- exclude: dist/**
- exclude: node_modules/.cache/**
ui:lint:
desc: runs the frontend linter
dir: frontend
cmds:
- pnpm lint --max-warnings=0
sources:
- "**"
- exclude: .nuxt/**
- exclude: .output/**
- exclude: dist/**
- exclude: node_modules/.cache/**
ui:test:
desc: runs the frontend tests
dir: frontend
cmds:
- pnpm test
sources:
- "**"
- exclude: .nuxt/**
- exclude: .output/**
- exclude: dist/**
- exclude: node_modules/.cache/**
ui:check:
desc: runs all frontend checks
deps:
- ui:lint
- ui:test
ui:
desc: runs the frontend server
dir: frontend
cmds:
- pnpm run dev --no-fork
docker:build-from-package:
desc: Builds the Docker image from the existing Python package in dist/
deps:
- py:package
cmds:
- docker build --tag mealie:dev --file docker/Dockerfile --build-arg
COMMIT={{.GIT_COMMIT}} --build-context packages=dist .
vars:
GIT_COMMIT:
sh: git rev-parse HEAD
docker:prod:
desc: builds and runs the production docker image locally
dir: docker
cmds:
- docker compose -f docker-compose.yml -p mealie up -d --build
e2e:build-image:
desc: builds the e2e test docker image
deps:
- py:package
cmds:
- docker build --tag mealie:e2e --file docker/Dockerfile --build-context
packages=dist .
sources:
- docker/Dockerfile
- dist/**
e2e:start-server:
desc: Builds the image and starts the containers for e2e testing
dir: tests/e2e/docker
deps:
- e2e:build-image
vars:
WAIT_UNTIL_HEALTHY: "{{if .WAIT_UNTIL_HEALTHY}}--wait{{else}}{{end}}"
cmds:
- docker compose up -d {{.WAIT_UNTIL_HEALTHY}}
e2e:stop-server:
desc: Shuts down the e2e testing containers
dir: tests/e2e/docker
cmds:
- docker compose down --volumes
e2e:test:
desc: runs the e2e tests
dir: tests/e2e
deps:
- setup:e2e
vars:
PREVENT_REPORT_OPEN: "{{if .PREVENT_REPORT_OPEN}}PLAYWRIGHT_HTML_OPEN=never{{else}}{{end}}"
cmds:
- "{{.PREVENT_REPORT_OPEN}} pnpm playwright test"
e2e:
desc: runs the full e2e test suite
cmds:
- task: e2e:start-server
vars: { WAIT_UNTIL_HEALTHY: true }
- defer: { task: e2e:stop-server }
- task: e2e:test
vars: { PREVENT_REPORT_OPEN: true }
+1 -1
View File
@@ -1,7 +1,7 @@
###############################################
# Frontend Build
###############################################
FROM node:26@sha256:438603bbb5cda404b9416f0b5c8026f61501ab911760d861ec28c36b5d675725 \
FROM node:24@sha256:e7add2a490bb17d97b485b8641bd88455fff7839ade0f5eba493c3508124d413 \
AS frontend-builder
# renovate: datasource=npm depName=pnpm
@@ -4,7 +4,7 @@ Released packages are [built and published via GitHub actions](maintainers.md#dr
## Python packages
To build Python packages locally for testing, use [`task`](starting-dev-server.md#without-dev-containers). After installing `task`, run `task py:package` to perform all the steps needed to build the package and a requirements file. To do it manually, run:
To build Python packages locally for testing, use [mise](starting-dev-server.md#without-dev-containers). Run `mise run py:package` to perform all the steps needed to build the package and a requirements file. To do it manually, run:
```sh
pushd frontend
yarnpkg install
@@ -37,7 +37,7 @@ One way to build the Docker image is to run the following command in the project
docker build --tag mealie:dev --file docker/Dockerfile --build-arg COMMIT=$(git rev-parse HEAD) .
```
The Docker image can be built from the pre-built Python packages with the task command `task docker:build-from-package`. This is equivalent to:
The Docker image can be built from the pre-built Python packages with `mise run docker:build-from-package`. This is equivalent to:
```sh
docker build --tag mealie:dev --file docker/Dockerfile --build-arg COMMIT=$(git rev-parse HEAD) --build-context packages=dist .
```
@@ -9,7 +9,7 @@ How exactly you need to modify it is of course highly contextual to the change y
## Using Alembic to generate upgrade script
In your dev container you can run something like (change the message) `task py:migrate -- "Add creation tag to group preferences"` to have Alembic generate an upgrade script for you.
In your dev container you can run something like (change the message) `mise run py:migrate -- "Add creation tag to group preferences"` to have Alembic generate an upgrade script for you.
Alembic's script migration isn't perfect, so you will need to review which changes are generated. You will also need to make sure any custom operations work on both SQLite and Postgres.
There are some known limitations with our migrations and Alembic's auto-generation, which is accounted for in `/alembic/env.py`. If any of your migrations overlap with the columns in `include_object`, you may need to manually adjust the migration.
@@ -46,7 +46,7 @@ If you'd rather install them yourself, use the versions in `mise.toml`.
### Installing Dependencies
Once the prerequisites are installed you can cd into the project base directory and run `task setup` to install the python and node dependencies, and download the NLP model.
Once the prerequisites are installed you can cd into the project base directory and run `mise run setup` to install the python and node dependencies, and download the NLP model.
=== "Linux / macOS"
@@ -54,16 +54,16 @@ Once the prerequisites are installed you can cd into the project base directory
# Navigate To The Root Directory
cd /path/to/project
# Utilize the Taskfile to Install Dependencies
task setup
# Install Python and frontend dependencies
mise run setup
```
## Postgres
The taskfile has two commands that need to be run to run the development environment against a postgres database.
There are two tasks that need to be run to run the development environment against a postgres database.
- `task dev:services` - This will start the postgres database, and a smtp server for email testing.
- `task py:postgres` - This will run that backend API configured for the local postgres database.
- `mise run dev:services` - This will start the postgres database, and a smtp server for email testing.
- `mise run py:postgres` - This will run that backend API configured for the local postgres database.
## Starting The Server
@@ -73,10 +73,10 @@ Now you're ready to start the servers. You'll need two shells open, One for the
```bash
# Terminal #1
task py
mise run py
# Terminal #2
task ui
mise run ui
```
## Internationalization
+233 -1
View File
@@ -3,9 +3,241 @@ python = "3.14.10"
node = "26"
pnpm = "12.17.0"
uv = "0.13.6"
task = "3.54.0"
"npm:json-schema-to-typescript" = "16.0.0"
# semgrep still imports pkg_resources and does not support every Python version uv picks.
"pipx:semgrep" = { version = "1.179.0", uvx_args = "--python 3.12 --with setuptools" }
[env]
DEFAULT_GROUP = "Home"
DEFAULT_HOUSEHOLD = "Family"
PRODUCTION = "false"
# Install from the committed lockfile; never re-resolve. Required because the
# rolling `exclude-newer` cooling window (pyproject [tool.uv]) would otherwise
# make every `uv run`/`uv sync` re-resolve and fail on in-window pins.
UV_FROZEN = "1"
API_PORT = "9000"
API_DOCS = "True"
TOKEN_TIME = "256"
SMTP_HOST = "localhost"
SMTP_PORT = "1025"
SMTP_FROM_NAME = "MealieDev"
SMTP_FROM_EMAIL = "mealie@example.com"
SMTP_AUTH_STRATEGY = "NONE"
BASE_URL = "http://localhost:3000"
# Local overrides; listed after the defaults so they take precedence
_.file = [".dev.env", ".env"]
[settings]
# A mise.lock from a newer mise can't be read by the older mise in the dev container and CI
lockfile = false
[tasks.setup]
description = "Install Python and frontend dependencies"
depends = ["setup:py", "setup:ui"]
[tasks."setup:py"]
description = "Install Python dependencies and pre-commit hooks"
sources = ["uv.lock", "pyproject.toml", ".pre-commit-config.yaml"]
outputs = { auto = true }
run = ["uv sync --extra pgsql --group dev", "uv run pre-commit install"]
[tasks."setup:ui"]
description = "Install frontend dependencies"
dir = "frontend"
sources = ["frontend/package.json", "frontend/pnpm-lock.yaml"]
outputs = { auto = true }
run = "pnpm install"
[tasks."setup:e2e"]
description = "Install e2e test dependencies and Playwright browsers"
dir = "tests/e2e"
sources = ["tests/e2e/package.json", "tests/e2e/playwright.config.ts", "tests/e2e/pnpm-lock.yaml"]
outputs = { auto = true }
run = ["pnpm install", "pnpm run playwright install --with-deps"]
[tasks."dev:generate"]
description = "Run code generators (TypeScript types, schema exports, test helpers)"
run = "uv run python dev/code-generation/main.py"
depends_post = ["py:format"]
[tasks."dev:services"]
description = "Start Postgres and Mailpit containers"
dir = "docker"
run = "docker compose -f docker-compose.dev.yml up"
[tasks."dev:clean"]
description = "Delete all local dev data (dev/data)"
run = [
"rm -r ./dev/data/recipes/",
"rm -r ./dev/data/users/",
"rm -rf ./dev/data/postgres/",
"rm -f ./dev/data/mealie*.db",
"rm -f ./dev/data/mealie*.db-shm",
"rm -f ./dev/data/mealie*.db-wal",
"rm -f ./dev/data/mealie.log",
"rm -f ./dev/data/.secret",
]
[tasks.docs]
description = "Run the documentation server"
dir = "docs"
run = "uv run zensical serve"
[tasks.py]
description = "Run the backend server"
run = "uv run python mealie/app.py"
[tasks."py:postgres"]
description = "Run the backend server against the dev:services Postgres"
run = "uv run python mealie/app.py"
[tasks."py:postgres".env]
DB_ENGINE = "postgres"
POSTGRES_USER = "mealie"
POSTGRES_PASSWORD = "mealie"
POSTGRES_SERVER = "localhost"
POSTGRES_PORT = "5432"
POSTGRES_DB = "mealie"
[tasks."py:test"]
description = "Run Python tests in parallel (pass pytest args after --)"
# --dist loadfile: each test file runs in order on a single worker
run = "uv run pytest -n auto --dist loadfile"
[tasks."py:format"]
description = "Format Python code"
run = "uv run ruff format ."
[tasks."py:lint"]
description = "Lint Python code"
run = "uv run ruff check ."
[tasks."py:mypy"]
description = "Type check Python code"
run = "uv run mypy mealie"
[tasks."py:semgrep"]
description = "Run the authz semgrep rules in .semgrep and their tests"
run = [
"semgrep scan --test --metrics off --config .semgrep/authz.yml .semgrep/authz.py",
"semgrep scan --error --metrics off --config .semgrep mealie",
]
[tasks."py:check"]
description = "Run all Python formatters, linters, type checks, and tests"
depends = ["py:format", "py:lint", "py:semgrep", "py:mypy", "py:test"]
[tasks."py:coverage"]
description = "Run Python tests with coverage and open the HTML report"
run = [
"uv run pytest",
"uv run coverage report -m",
"uv run coveragepy-lcov",
"uv run coverage html",
"open htmlcov/index.html",
]
[tasks."py:migrate"]
description = 'Generate a database migration, e.g. mise run py:migrate -- "add new column"'
run = "uv run alembic --config mealie/alembic/alembic.ini revision --autogenerate -m"
depends_post = ["py:format"]
[tasks."py:package"]
description = "Build the Python sdist and wheel plus pinned requirements files in dist/"
depends = ["py:package:build"]
run = '''
version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
uv export --no-dev --no-editable --no-emit-project --extra pgsql --format requirements-txt --output-file dist/dependencies.txt
cp dist/dependencies.txt dist/requirements.txt
# Include mealie in the requirements, hashing the package that was just built to ensure it's the one installed
echo "mealie[pgsql]==$version \\" >> dist/requirements.txt
pip hash "dist/mealie-$version-py3-none-any.whl" | tail -n1 | tr -d '\n' >> dist/requirements.txt
echo " \\" >> dist/requirements.txt
pip hash "dist/mealie-$version.tar.gz" | tail -n1 >> dist/requirements.txt
'''
[tasks."py:package:build"]
hide = true
# CI builds the frontend in an earlier step and sets SKIP_PACKAGE_DEPS=true
run = '''
if [ "${SKIP_PACKAGE_DEPS:-false}" != "true" ]; then
mise run setup:py ::: py:package:copy-frontend
fi
uv build --out-dir dist
'''
[tasks."py:package:copy-frontend"]
hide = true
depends = ["ui:generate"]
run = ["rm -rf mealie/frontend", "cp -a frontend/dist mealie/frontend"]
[tasks.ui]
description = "Run the frontend dev server"
dir = "frontend"
run = "pnpm run dev --no-fork"
[tasks."ui:build"]
description = "Build the frontend in frontend/dist"
dir = "frontend"
run = "pnpm build"
[tasks."ui:generate"]
description = "Generate a static frontend in frontend/dist"
depends = ["setup:ui"]
dir = "frontend"
run = "pnpm generate"
[tasks."ui:lint"]
description = "Lint the frontend"
dir = "frontend"
run = "pnpm lint --max-warnings=0"
[tasks."ui:test"]
description = "Run the frontend tests"
dir = "frontend"
run = "pnpm test"
[tasks."ui:check"]
description = "Run all frontend checks"
depends = ["ui:lint", "ui:test"]
[tasks."docker:build-from-package"]
description = "Build the Docker image from the Python package in dist/"
depends = ["py:package"]
run = 'docker build --tag mealie:dev --file docker/Dockerfile --build-arg COMMIT="$(git rev-parse HEAD)" --build-context packages=dist .'
[tasks."docker:prod"]
description = "Build and run the production Docker image locally"
dir = "docker"
run = "docker compose -f docker-compose.yml -p mealie up -d --build"
[tasks.e2e]
description = "Run the full e2e suite: build and start the server, test, and stop the server"
env = { PLAYWRIGHT_HTML_OPEN = "never" }
run = '''
mise run e2e:start-server
trap 'mise run e2e:stop-server' EXIT
mise run e2e:test
'''
[tasks."e2e:build-image"]
description = "Build the e2e Docker image"
depends = ["py:package"]
run = "docker build --tag mealie:e2e --file docker/Dockerfile --build-context packages=dist ."
[tasks."e2e:start-server"]
description = "Build the image and start the e2e containers"
depends = ["e2e:build-image"]
dir = "tests/e2e/docker"
run = "docker compose up -d --wait"
[tasks."e2e:stop-server"]
description = "Stop the e2e containers"
dir = "tests/e2e/docker"
run = "docker compose down --volumes"
[tasks."e2e:test"]
description = "Run the e2e tests"
depends = ["setup:e2e"]
dir = "tests/e2e"
run = "pnpm playwright test"