codemodder-python
This is the Python version of the Codemodder Framework.
Codemodder is sponsored by pixee.ai.
Development Status
As of v0.80.0 the codemod API is relatively stable. However, backwards compatibility between releases will not be guaranteed until version 1.0.0.
See CHANGELOG.md for detailed release notes.
Installation
The codemodder package is available on PyPI. To install, run:
$ pip install codemodder
WARNING: You should also install the semgrep optional dependency for now as it isn't deprecated yet:
$ pip install codemodder[semgrep]
To install the package from source, use pip:
$ pip install /path/to/codemodder-python
Running codemodder
CLI
Codemodder can be run as a CLI. The codemodder package provides an executable called codemodder. This should be available on your path by default after installation.
For basic usage, run the codemodder command with a target directory path:
$ codemodder /path/to/my-project
Note that by default codemodder will make changes to files in your target directory. To run codemodder without making updates on disk, use the --dry-run flag:
$ codemodder --dry-run /path/to/my-project
To list all available codemods (including any that are registered with installed plugins), use the --list option:
$ codemodder --list
For a full list of options, use the --help flag:
$ codemodder --help
Library
You can also run codemodder as a library by importing the module and running run. For basic usage, pass a target directory path and the dry_run argument:
import codemodder
output, exit_code = codemodder.run("/path/to/my-project", dry_run=True)
Unlike the CLI which has a default dry_run of False, when calling codemodder as a library you must indicate if you want codemodder to make changes to your files.
Architecture
Codemods are composed of the following key components:
- Detector
- Transformer(s)
- Metadata
Custom Codemods
The Python codemodder supports a plugin infrastructure for custom codemods. For users interested in developing a custom codemod plugin, we recommend starting with the Cookiecutter template.
Documentation
Coming soon!
Contributing
See CONTRIBUTING.md.
Metadata
Release files for codemodder 6.5.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| codemodder-6.5.5.tar.gz | 765.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codemodder-6.5.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / codemodder-6.5.5.tar.gz
| Download URL | codemodder-6.5.5.tar.gz |
|---|---|
| Size | 765.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d698ac35d24e249abd0bcbf744c4093a8a2a80a99784eaa67205f788cd3f9147
|
|
BLAKE2b-256 checksum How to use checksums |
4421ef9501dfc5d9a7cbbff8731c39acbb804610ee691700859fc038682b32c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / codemodder-6.5.5-py3-none-any.whl
| Download URL | codemodder-6.5.5-py3-none-any.whl |
|---|---|
| Size | 299.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f8a6916d2c76411729d6551ac6abaf36ce9cf145c21acae8481921441282a40
|
|
BLAKE2b-256 checksum How to use checksums |
8eeec766eeb8070a4671eeb9b41fcf38294f0c3b350de3287b715c45d9d0d0b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|