This page provides a quick reference table of all AfterPython CLI commands, organized by functional category. Each entry includes the command name, description, common options, and links to detailed documentation.
For detailed information about CLI architecture and how commands are organized, see CLI Architecture and Entry Points. For in-depth documentation of individual commands, refer to the specific command pages under sections 4.2 through 4.6.
AfterPython provides two CLI entry points defined in pyproject.toml59-61:
| Entry Point | Module | Purpose |
|---|---|---|
ap | afterpython.main:run_cli | Primary CLI for all AfterPython commands |
pcu | afterpython.main:run_pcu | Dependency update utility (invoked via ap update deps) |
Command Implementation Structure
Sources: pyproject.toml59-61 src/afterpython/cli/commands/init.py42-108 src/afterpython/cli/commands/sync.py37-153 src/afterpython/cli/commands/build.py168-261 src/afterpython/cli/commands/bump.py9-119
Commands for initializing, developing, building, and previewing your project.
| Command | Description | Common Options | Details |
|---|---|---|---|
ap init | Initialize AfterPython project structure, configuration files, and website template | --yes, -y (auto-confirm all prompts) | 4.2.1 |
ap sync | Synchronize configuration between pyproject.toml, afterpython.toml, and generated myst.yml/authors.yml files | None | 4.2.2 |
ap build | Build production website including MyST content and SvelteKit site | --execute (run Jupyter notebooks)Passes extra args to myst build | 4.2.3 |
ap dev | Start development servers for MyST content and SvelteKit website | --doc, --blog, --tutorial, --example, --guide--no-website (skip SvelteKit server) | 4.2.4 |
ap preview | Preview production build locally | None | 4.2.5 |
Sources: src/afterpython/cli/commands/init.py42-108 src/afterpython/cli/commands/sync.py37-153 src/afterpython/cli/commands/build.py168-261
Commands for managing content types (doc, blog, tutorial, example, guide).
| Command | Description | Common Options | Details |
|---|---|---|---|
ap init-content | Initialize MyST configuration for specific content type | --type (doc/blog/tutorial/example/guide) | 4.3 |
ap clean-content | Clean build artifacts for specific content type | --type (content type to clean) | 4.3 |
Sources: Content management commands are referenced in the architecture diagrams.
Commands for managing Python dependencies (via uv and pixi) and Node.js dependencies (via pnpm).
| Command | Description | Common Options | Details |
|---|---|---|---|
ap install | Install all dependencies (Python via uv sync, pixi install; Node.js via pnpm install) | None | 4.4.1 |
ap add | Add new dependency to project | Package name(s)--dev (add to dev dependencies) | 4.4 |
ap remove | Remove dependency from project | Package name(s) | 4.4 |
ap lock | Update lock files (uv.lock, pixi.lock) | None | 4.4.3 |
ap update deps | Update dependency versions in pyproject.toml and .pre-commit-config.yaml | None (delegates to pcu) | 4.4.2 |
ap update website | Update website template from project-website-template repository | None | 4.4.2 |
Sources: The dependency management commands delegate to uv, pixi, and pnpm package managers as documented in the architecture.
Commands for linting and formatting code.
| Command | Description | Common Options | Details |
|---|---|---|---|
ap check | Run ruff check for linting | Passes args to ruff check | 4.5 |
ap lint | Alias for ap check | Passes args to ruff check | 4.5 |
ap format | Run ruff format for code formatting | Passes args to ruff format | 4.5 |
Sources: Code quality commands wrap the ruff tool as referenced in pyproject.toml48
Commands for committing, versioning, and releasing.
| Command | Description | Common Options | Details |
|---|---|---|---|
ap commit | Create conventional commit with interactive prompt (via commitizen) | Passes args to cz commit | 4.6.1 |
ap bump | Bump project version and update lock files | --pre (pre-release bump)--release (stable release bump + push tag)--devrelease N (set dev release number)--prerelease TYPE (set pre-release type) | 4.6.2 |
ap release | Push version tag to trigger GitHub Actions release workflow | None | 4.6.3 |
ap cz | Direct access to commitizen commands | Any commitizen args | 4.6 |
Sources: src/afterpython/cli/commands/bump.py9-119
Typical Command Sequences
Sources: Command workflows inferred from src/afterpython/cli/commands/init.py42-108 src/afterpython/cli/commands/sync.py37-153 src/afterpython/cli/commands/build.py168-261 src/afterpython/cli/commands/bump.py9-119
The ap build command accepts additional options and passes unrecognized arguments to myst build. Key implementation details from src/afterpython/cli/commands/build.py168-261:
| Option | Type | Description |
|---|---|---|
--execute | Flag | Execute Jupyter notebooks during build |
--help | Flag | Show help (passes to myst build --help) |
| Extra args | Passthrough | All other arguments passed to myst build --html |
BASE_PATH Determination: The build command automatically determines BASE_PATH based on website URL configuration:
github.io): BASE_PATH="" (empty)BASE_PATH="/repo-name" (extracted from repository URL)Implementation in src/afterpython/cli/commands/build.py29-62
Sources: src/afterpython/cli/commands/build.py168-261 src/afterpython/cli/commands/build.py29-62
The ap bump command provides granular version control with automatic pixi.lock synchronization. From src/afterpython/cli/commands/bump.py9-119:
| Option | Type | Behavior |
|---|---|---|
--release | Flag | Bump to stable version, push tag, trigger release workflow |
--pre | Flag | Transition to pre-release (dev → rc, or increment pre-release) |
| None | Default | Stay in current phase (increment dev or pre-release number) |
--devrelease N | Override | Set specific dev release number |
--prerelease TYPE | Override | Set pre-release type (alpha/beta/rc) |
Version Phase Logic:
0.1.0.dev3) → increment dev number (0.1.0.dev4)0.1.0a1) → increment pre-release (0.1.0a2)--pre flag → transition to next phase--release flag → bump to stable, push tagPost-bump Actions: Automatically runs pixi install and commits pixi.lock if modified (src/afterpython/cli/commands/bump.py94-119)
Sources: src/afterpython/cli/commands/bump.py9-119
The ap sync command synchronizes configuration from authoritative sources to derived files. From src/afterpython/cli/commands/sync.py37-153:
Synchronization Flow:
Generated Fields:
authors.yml: Author IDs, names, emails (from pyproject.toml authors)myst.yml files: Project title, description, keywords, venue, copyright, thumbnails, logos, faviconspyproject.toml URLs: Updated homepage and documentation URLs (from afterpython.toml website URL)Sources: src/afterpython/cli/commands/sync.py37-153 src/afterpython/cli/commands/sync.py11-35
The ap init command orchestrates multiple initialization steps. From src/afterpython/cli/commands/init.py42-108:
Initialization Sequence:
afterpython/, afterpython/static/)pyproject.toml (add build-system, URLs, authors)afterpython.toml (company, website configuration)py.typed marker file (for type checking)deploy.yml, ci.yml).pre-commit-config.yaml)ruff.toml)cz.toml) + release.yml workflow.github/dependabot.yml)Auto-confirmation: Use --yes or -y flag to skip all prompts and accept defaults.
Sources: src/afterpython/cli/commands/init.py42-108
All commands support --help to show usage information. Commands that delegate to underlying tools (e.g., myst, cz, ruff) also pass --help to the underlying tool.
Several commands use passthrough patterns from src/afterpython/cli/commands/build.py168-177:
This allows extra arguments to be forwarded to underlying tools:
ap build [...] → myst build --html [...]ap bump [...] → cz bump [...]ap commit [...] → cz commit [...]Commands respect environment variables for configuration:
AP_AUTO_SYNC: Automatically run ap sync before certain operationsAP_MOLAB_BADGE: Enable Colab badges in MyST buildsBASE_PATH: Override base path for website routing (auto-determined in build)For complete environment variable reference, see Environment Variables.
Sources: src/afterpython/cli/commands/build.py168-177 src/afterpython/cli/commands/bump.py9-25
| Command | Category | Key Function |
|---|---|---|
ap init | Lifecycle | Initialize project |
ap sync | Lifecycle | Sync configuration files |
ap dev | Lifecycle | Start dev servers |
ap build | Lifecycle | Build production site |
ap preview | Lifecycle | Preview build |
ap install | Dependencies | Install all dependencies |
ap add | Dependencies | Add dependency |
ap remove | Dependencies | Remove dependency |
ap lock | Dependencies | Update lock files |
ap update deps | Dependencies | Update dependency versions |
ap update website | Dependencies | Update website template |
ap check | Quality | Lint code |
ap lint | Quality | Alias for check |
ap format | Quality | Format code |
ap commit | Version Control | Create conventional commit |
ap bump | Version Control | Bump version |
ap release | Version Control | Trigger release |
pcu | Utility | Update dependencies (via ap update deps) |
Sources: All command implementations referenced throughout this document.
Refresh this wiki