Metadata-Version: 2.4
Name: measles
Version: 2026.47.2
Summary: Continuous cookiecutter featuring mise
Project-URL: source, https://github.com/biobuddies/measles
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: cookiecutter
Requires-Dist: jinja2
Requires-Dist: pyyaml
Provides-Extra: build
Requires-Dist: setuptools; extra == "build"
Provides-Extra: pre-commit
Requires-Dist: actionlint-py; extra == "pre-commit"
Requires-Dist: basedpyright; extra == "pre-commit"
Requires-Dist: cookiecutter; extra == "pre-commit"
Requires-Dist: django-upgrade; extra == "pre-commit"
Requires-Dist: djlint>=1.45.0; extra == "pre-commit"
Requires-External: hadolint-py @ git+https://github.com/AleksaC/hadolint-py.git ; extra == "pre-commit"
Requires-Dist: pre-commit-hooks; extra == "pre-commit"
Requires-Dist: pyrefly; extra == "pre-commit"
Requires-Dist: ruff; extra == "pre-commit"
Requires-Dist: shellcheck-py; extra == "pre-commit"
Requires-Dist: shfmt-py; extra == "pre-commit"
Requires-Dist: styleforce; extra == "pre-commit"
Requires-Dist: typos; extra == "pre-commit"
Requires-Dist: validate-pyproject[all]; extra == "pre-commit"
Requires-Dist: yamllint; extra == "pre-commit"
Provides-Extra: test
Requires-Dist: django; extra == "test"
Requires-Dist: helicopyter; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-httpserver; extra == "test"

# Measles

Continuous [cookiecutter](https://github.com/cookiecutter/cookiecutter) featuring
[mise](https://github.com/jdx/mise).

```bash
cat <<'EOF' > .cookiecutter.yaml
default_context:
    languages: Node,Python
    python_dependencies:
        - django
        - gunicorn
EOF
mise use --global uv@latest
uv tool run cookiecutter --config-file .cookiecutter.yaml --no-input --overwrite-if-exists https://github.com/biobuddies/measles.git
mise trust --yes
mise install
mise pre-commit-all
mise test
```

## Autoformat Excludes

To exclude files from autoformatting and linting, add extended regular expressions
for relative paths from the repository root to `.config/autoformat-excludes` like:

```
^public/bundle\.min\.js$
^publickey\.asc$
```

## Jinja Templates

Templates live in `{{cookiecutter.dot}}/`, which renders to `.`: cookiecutter assumes templates
render into a codename folder, but measles renders into the repository root.

Each file ends with its final suffix, so editors offering one syntax highlighter pick the final
form's. An infix marks the template syntax:

- `.j2.` for regular Jinja2, such as `pyproject.j2.toml`
- `.hj.` for Hash Jinja, such as `act.hj.yaml`, which hides Jinja in YAML comments so `prettier`
  can autoformat the template

Hash Jinja configuration, from `measles/__init__.py`:

```python
hash_jinja = {
    'block_end_string': '%#',
    'block_start_string': '#%',
    'comment_end_string': '*#',
    'comment_start_string': '#*',
    'lstrip_blocks': True,
    'trim_blocks': True,
    'variable_end_string': '}#',
    'variable_start_string': '#{',
}
```

## Workflow Tasks

`.github/workflows/act.yaml` runs these mise tasks, which can be overridden in `mise.toml`:

- `build` takes no arguments, so it suits environment-agnostic steps like most Python wheels and
  Docker images. Put environment-specific steps in `deploy`.
- `test` runs locally and on GitHub, so it suits unit and integration tests.
- `deploy` takes the environment: the pull request branch or `main`. Put environment-specific
  JavaScript And Markup (JAM) builds here, and start end-to-end tests that need a real hosted
  environment. Guard production-only steps with `[[ ${1-} == main ]]`.

## First GitHub Action Run

Until `main` has `.github/workflows/act.yaml`, rendering adds `TABR` to its `push`
triggers, so a bootstrap branch runs act before its pull request merges. Once `origin/main` has
the workflow, the next render drops that branch.

## GitHub Actions

```mermaid
flowchart TD
    Context[" `mise set-environment` ($ENVI, $GIHA, $TABR)"] --> Check[" `mise pre-commit-all` (check)"]
    Context --> Test[" `mise test`"]
    Check -- "Generated diff" --> Retry["Commit and rerun"]
    Retry --> Context
    Check -- Fail --> Stop["Stop"]
    Test -- Fail --> Stop
    Check -- "Clean pass" --> BuildDeploy["Check and test pass"]
    Test -- Pass --> BuildDeploy
    BuildDeploy -- "Push to main" --> Release[" `mise release` (build-deploy), refresh $TABR"]
    BuildDeploy -- Otherwise --> Build[" `mise build` (build-deploy)"]
    Release --> Build
    Build --> Deploy[" `mise deploy $ENVI` (build-deploy)"]
    Deploy -- "Terraform PR" --> Plan[" `mise tplan main` (PR comment)"]
    Plan --> Apply[" `mise tapply $ENVI`"]
    Deploy -- "Other Terraform runs" --> Apply
    Deploy -- "PyPI, ENVI=main" --> Publish[" `uv publish`"]
```

## Agent Sandboxes

Set environment setup script to

```bash
grep -qs 'setup\.bash' .claude/hooks/session-start.sh || measles/.config/setup.bash
```

This accommodates Claude Code on the web's different single and multiple repository startups.
Always include measles in multiple repository sessions: they start in the parent directory,
where only this script can run setup.

TODO re-test on Codex Cloud, probably leveraging `.codex/setup.sh`
