Skip to content

Add CI: run unit tests and the cookbook snippet checker on PRs #22

Description

@craigmcchesney

Summary

There is no CI in this repository — no .github/ directory at all. Two things that are checkable
today run only when someone remembers to run them locally:

The second is the reason to file this now. The cookbook's value rests entirely on its accuracy,
and the failure mode is quiet: rename a client method or a result accessor, and 66 snippets go
stale with no signal until a reader copies one and it doesn't work. The checker exists precisely
to catch that, but a checker nobody runs is documentation of good intent rather than a guarantee.

Proposed

A single .github/workflows/ci.yml running on push and pull_request:

  1. pip install -e .[analysis,dev]
  2. pytest tests/
  3. python .dev/tools/check-cookbook-snippets.py

Notes on the third step:

  • The checker resolves mypy at .venv/bin/mypy (VENV_MYPY in the script). In CI there is
    typically no .venv/, so this needs either a venv at that path or a small change to fall back
    to shutil.which("mypy"). The latter is probably the better fix — it makes the script work for
    contributors who don't use that exact layout either.
  • It carries its own canary self-test: if mypy ever stops resolving dp_python_lib, it fails
    loudly rather than passing everything silently. That property is what makes it safe to gate on.
  • Runtime is a few seconds; no server or network required.

requires-python is >=3.10, so a matrix over 3.10–3.13 is worth considering, though a single
version is a fine start.

Out of scope

Integration tests that need a live MLDP stack. Those can't run in CI without an ecosystem to
point at, and this issue is deliberately limited to what runs hermetically.

Context

Came out of the review of #21 (the cookbook PR). That PR tracks the checker and wires up the
[dev] extra, but stops short of running either automatically — noted there as a deliberate
follow-up rather than an omission.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions