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.0a6.tar.gz (61.3 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.0a6-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: plone_codemod-1.0.0a6.tar.gz
  • Upload date:
  • Size: 61.3 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.0a6.tar.gz
Algorithm Hash digest
SHA256 7ee18e64291b024ec83b6b5128e04c6e7c31e1719277252d4cbb79514bdef26e
MD5 037e55a5106698337130cfc841805888
BLAKE2b-256 5d30c6476c231cc6ad389bc4538218193358a0da2f7025be4eec8bc949971762

See more details on using hashes here.

Provenance

The following attestation bundles were made for plone_codemod-1.0.0a6.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.0a6-py3-none-any.whl.

File metadata

File hashes

Hashes for plone_codemod-1.0.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 ec09bd66ba5422dd55bf83c3fe02e14df61ce5c877865bff83976b71cb2604e5
MD5 cd16e1cf5ae78e8c0c598f118958c2a5
BLAKE2b-256 e28f82c6e3c28d4aa2623448df645e53451edf54e6b27de9b5ee976edaf5b5bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for plone_codemod-1.0.0a6-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