CLI Reference¶
Synopsis¶
plone-codemod [OPTIONS] SOURCE_DIR
Positional Arguments¶
SOURCE_DIRRoot directory of the source code to migrate (typically
src/).
Options¶
--config PATHPath to
migration_config.yaml. Defaults to the config bundled with the package.--dry-runPreview what would change without writing any files.
--bootstrapEnable Bootstrap 3 to 5 migration (opt-in, not run by default).
--skip-pythonSkip Phase 1 (Python import migration).
--skip-zcmlSkip Phase 2 (ZCML migration).
--skip-xmlSkip Phase 3 (GenericSetup XML migration).
--skip-ptSkip Phase 4 (Page template migration).
--skip-auditSkip Phase 6 (semgrep audit).
--project-dir PATHProject root directory (where
setup.py/pyproject.tomllive). Auto-detected by default by walking up fromSOURCE_DIR.--namespacesEnable Phase 7: PEP 420 namespace package migration (opt-in).
--packagingEnable Phase 8:
setup.pytopyproject.tomlmigration (opt-in).
Examples¶
# Default: phases 1-6 (no Bootstrap, no packaging)
plone-codemod ./src/
# Preview changes without modifying files
plone-codemod ./src/ --dry-run
# Include Bootstrap 3 to 5 migration
plone-codemod ./src/ --bootstrap
# Full modernization (PEP 420 + pyproject.toml)
plone-codemod ./src/ --namespaces --packaging
# Custom config file
plone-codemod ./src/ --config my_config.yaml
# Skip specific phases
plone-codemod ./src/ --skip-python --skip-audit
# Explicit project root for packaging
plone-codemod ./src/ --packaging --project-dir /path/to/project
Phase Execution Order¶
Phases run in this fixed order:
Python imports (
--skip-pythonto disable)ZCML (
--skip-zcmlto disable)GenericSetup XML (
--skip-xmlto disable)Page templates (
--skip-ptto disable)Bootstrap (
--bootstrapto enable)Audit (
--skip-auditto disable)Namespace packages (
--namespacesto enable)Packaging (
--packagingto enable)
Phase 7 always runs before Phase 8 so that namespace_packages is cleaned from setup.py before pyproject.toml generation.