Migration Guide

Migrating from ad-hoc doctests

If you're using pytest doctests, Jupyter notebooks, custom shell scripts, or manual spot-checks to verify code examples in your docs, this guide shows how to replace them with DocsCI — typically in under an hour, with zero friction for authors.

Migration effort: ~30 min for most repos.

Before vs. After

Before (ad-hoc)After (DocsCI)
Run tests manually before releasesRuns on every push automatically
Only Python supported via pytestPython + JavaScript + TypeScript
No accessibility or copy checksa11y + copy lint built in
No API drift detectionOpenAPI spec drift detected
Failures discovered latePRs annotated with precise fixes
Test infra maintained by youZero infra: hosted, scalable
Custom scripts per teamSingle docsci.yml per repo
No AI fix suggestionsAI patch diffs for every error

Step-by-step migration

1

Create a DocsCI project

~5 min

Go to Projects and click + New Project. In the wizard:

  • Point it at your GitHub repo
  • Set docs path to wherever your Markdown lives (e.g. docs)
  • Optionally set your OpenAPI spec path for drift detection
2

Run your first check

~2 min

Click ▶ Run CI on the project page. DocsCI will immediately find the same issues your doctests would — plus accessibility and copy problems.

Tip: review the findings before committing the CI template — this gives you a baseline.

3

Add docsci.yml (optional but recommended)

~5 min

Create docsci.yml in your repo root to match your existing test scope:

# docsci.yml
docs:
  path: docs          # where your Markdown lives
  include:
    - "docs/**/*.md"
  exclude:
    - "docs/internal/**"  # exclude internal drafts

snippets:
  languages: [python, javascript]  # match your existing doctest languages
  skip_patterns:
    - "# doctest: skip"   # reuse your existing skip markers!
    - "# docsci: skip"

checks:
  accessibility: true
  copy_lint: true

The skip_patterns field is backward compatible — your existing # doctest: skip markers will work.

4

Add the CI template

~5 min

Pick the template for your CI system:

Set DOCSCI_TOKEN as a CI secret and DOCSCI_PROJECT_ID as a variable.

5

Remove your old doctest scripts

~10 min

Once DocsCI is running clean, remove the ad-hoc doctest infra:

Remove

pytest --doctest-glob

Replace with

DocsCI snippet execution

💡 Same Python execution, plus JS/TS, plus AI fix suggestions

Remove

nbval / nbmake (Jupyter)

Replace with

Extract code cells to .md and run via DocsCI

💡 Use nbconvert to export notebooks to Markdown first

Remove

Custom bash test script

Replace with

docsci.yml + /api/runs/queue

💡 Replace with the curl fallback script template

Remove

Manual review before releases

Replace with

PR comments with AI patch diffs

💡 Findings annotated on every PR automatically
6

Configure skip markers (backward compat)

~5 min

If your docs already use skip markers, add them to docsci.yml:

snippets:
  skip_patterns:
    - "# doctest: skip"       # pytest doctest marker
    - "# doctest: +SKIP"      # alternate pytest marker
    - "# type: ignore"        # mypy ignore (usually means untestable)
    - "# noqa"                # flake8 ignore
    - "# docsci: skip"        # DocsCI native marker
    - "// @ts-nocheck"        # TypeScript skip
    - "/* eslint-disable */"  # JS linting disable

Frequently asked questions

Q: Can I keep running pytest doctests alongside DocsCI?

A: Yes. DocsCI is additive — run both. Over time you can remove doctests as DocsCI covers the same ground plus more (a11y, drift, copy).

Q: What if my code examples need environment setup (pip install, env vars)?

A: Use skip_patterns to skip snippets that require specific setup. DocsCI sandboxes are ephemeral — they can't install arbitrary packages yet (roadmap: custom runtime images).

Q: How do I handle examples that are intentionally wrong (showing error output)?

A: Add `# docsci: skip` to those snippets, or configure a custom skip_pattern like `# expected error`.

Q: Can I migrate GitBook / Mintlify / ReadMe docs?

A: Yes — DocsCI works with any Markdown. Point docs.path at the folder containing your .md files.

Q: Do I need to change how authors write docs?

A: No. Fenced code blocks work as-is. Authors only need to add `# docsci: skip` to examples that can't run.

🚀

Ready to migrate?

Create your first project and run a check in under 5 minutes. No credit card required.