Skip to main content

Automated code migration tool for Plone 5.2 → 6.x upgrades

Project description

plone-codemod

Automated code migration tool for upgrading Plone add-ons and projects from Plone 5.2 to Plone 6.x.

Unlike simple sed/find scripts, plone-codemod uses libcst (a concrete syntax tree parser) to correctly handle multi-line imports, aliased imports, mixed imports, and scoped usage-site renaming.

What it covers:

  • 129+ Python import rewrites with usage-site renaming
  • ZCML dotted-name updates
  • GenericSetup XML interface and view replacements
  • Page template fixes (here/ to context/, main_template to @@main_template)
  • Bootstrap 3 to 5 migration (opt-in)
  • PEP 420 namespace package migration (opt-in)
  • setup.py/setup.cfg to PEP 621 pyproject.toml conversion (opt-in)
  • 35+ semgrep audit rules for issues needing manual attention

Installation

pip install plone-codemod

# Or with uv
uv pip install plone-codemod

# Optional: for audit phase
pip install plone-codemod[audit]

Quick Start

# Preview what would change (no files modified)
plone-codemod /path/to/your/src/ --dry-run

# Apply all default migrations
plone-codemod /path/to/your/src/

# Include Bootstrap 3 to 5
plone-codemod /path/to/your/src/ --bootstrap

# Full modernization (namespace packages + pyproject.toml)
plone-codemod /path/to/your/src/ --namespaces --packaging

After running, review changes with git diff and commit.

Documentation

Full documentation: https://bluedynamics.github.io/plone-codemod/

Development

git clone https://github.com/bluedynamics/plone-codemod.git
cd plone-codemod
uv venv && uv pip install -e ".[dev]"
uv run pytest tests/ -v

Source Code and Contributions

The source code is managed in a Git repository, with its main branches hosted on GitHub. Issues can be reported there too.

We'd be happy to see many forks and pull requests to make this tool even better. We welcome AI-assisted contributions, but expect every contributor to fully understand and be able to explain the code they submit. Please don't send bulk auto-generated pull requests.

Maintainers are Jens Klein, Johannes Raggam and the BlueDynamics Alliance developer team. We appreciate any contribution and if a release on PyPI is needed, please just contact one of us. We also offer commercial support if any training, coaching, integration or adaptations are needed.

License

GPL-2.0 -- same as Plone.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plone_codemod-1.0.0a4.tar.gz (60.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plone_codemod-1.0.0a4-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file plone_codemod-1.0.0a4.tar.gz.

File metadata

  • Download URL: plone_codemod-1.0.0a4.tar.gz
  • Upload date:
  • Size: 60.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for plone_codemod-1.0.0a4.tar.gz
Algorithm Hash digest
SHA256 edc28dae0ed0f163c8718ed93c8390016f053a57dd11991a2fb64dceae0e5d75
MD5 9a5db16e7d74d5b62f8447e2aa955f85
BLAKE2b-256 9e4f67fdcb26718db411193093bea4575f960d54800b1dbfdf6d29b810a239de

See more details on using hashes here.

Provenance

The following attestation bundles were made for plone_codemod-1.0.0a4.tar.gz:

Publisher: release.yaml on bluedynamics/plone-codemod

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file plone_codemod-1.0.0a4-py3-none-any.whl.

File metadata

File hashes

Hashes for plone_codemod-1.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 ee13a96f8f222a90daf64fed3d2108c755d550e44aeccf72210c7b0d6ef3e72a
MD5 8f90e576e16db1827758de20200c98e1
BLAKE2b-256 1614e21d5ab487ae537ec891c3ed965fa5ac188ebfc6d83a7a5053776c3007ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for plone_codemod-1.0.0a4-py3-none-any.whl:

Publisher: release.yaml on bluedynamics/plone-codemod

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page