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/tocontext/,main_templateto@@main_template) - Bootstrap 3 to 5 migration (opt-in)
- PEP 420 namespace package migration (opt-in)
setup.py/setup.cfgto PEP 621pyproject.tomlconversion (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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edc28dae0ed0f163c8718ed93c8390016f053a57dd11991a2fb64dceae0e5d75
|
|
| MD5 |
9a5db16e7d74d5b62f8447e2aa955f85
|
|
| BLAKE2b-256 |
9e4f67fdcb26718db411193093bea4575f960d54800b1dbfdf6d29b810a239de
|
Provenance
The following attestation bundles were made for plone_codemod-1.0.0a4.tar.gz:
Publisher:
release.yaml on bluedynamics/plone-codemod
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plone_codemod-1.0.0a4.tar.gz -
Subject digest:
edc28dae0ed0f163c8718ed93c8390016f053a57dd11991a2fb64dceae0e5d75 - Sigstore transparency entry: 1009421627
- Sigstore integration time:
-
Permalink:
bluedynamics/plone-codemod@807e6bfa08277143e854c67109f7d6694cf329bb -
Branch / Tag:
refs/tags/v1.0.0a4 - Owner: https://github.com/bluedynamics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@807e6bfa08277143e854c67109f7d6694cf329bb -
Trigger Event:
release
-
Statement type:
File details
Details for the file plone_codemod-1.0.0a4-py3-none-any.whl.
File metadata
- Download URL: plone_codemod-1.0.0a4-py3-none-any.whl
- Upload date:
- Size: 34.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee13a96f8f222a90daf64fed3d2108c755d550e44aeccf72210c7b0d6ef3e72a
|
|
| MD5 |
8f90e576e16db1827758de20200c98e1
|
|
| BLAKE2b-256 |
1614e21d5ab487ae537ec891c3ed965fa5ac188ebfc6d83a7a5053776c3007ae
|
Provenance
The following attestation bundles were made for plone_codemod-1.0.0a4-py3-none-any.whl:
Publisher:
release.yaml on bluedynamics/plone-codemod
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plone_codemod-1.0.0a4-py3-none-any.whl -
Subject digest:
ee13a96f8f222a90daf64fed3d2108c755d550e44aeccf72210c7b0d6ef3e72a - Sigstore transparency entry: 1009421663
- Sigstore integration time:
-
Permalink:
bluedynamics/plone-codemod@807e6bfa08277143e854c67109f7d6694cf329bb -
Branch / Tag:
refs/tags/v1.0.0a4 - Owner: https://github.com/bluedynamics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@807e6bfa08277143e854c67109f7d6694cf329bb -
Trigger Event:
release
-
Statement type: