Fissix is a Python library that monkeypatches and overrides the default behavior of the standard library `lib2to3`. It provides an enhanced and actively maintained version of `lib2to3`, primarily used for transforming Python code, especially for backporting `2to3` fixes for Python 3 codebases. It aims to be a drop-in replacement for `lib2to3`'s code transformation utilities. The current version is 24.4.24, and it often sees updates in conjunction with CPython development.
pip install fissixVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically use `fissix`'s `RefactoringTool` to apply all available code fixers to a given string. This is the core mechanism for transforming Python code using `fissix` without relying on file I/O or the command-line interface.
Ensure `fissix` is imported early in your application's lifecycle if you intend for its monkeypatching to take effect globally. If conflicts arise, isolate `fissix` usage to specific contexts or consider alternatives if strict `lib2to3` behavior is required elsewhere.
Review the `fissix` GitHub repository and documentation for specific changes or enhancements. Perform comprehensive regression tests when integrating `fissix` into existing `lib2to3`-reliant projects.
Ensure you are running `fissix` in a Python 3 environment. Its purpose is to provide an improved code transformation framework within Python 3.
While `fissix` monkeypatches `lib2to3`, it's best to explicitly import fixers and utilities from `fissix` modules (e.g., `from fissix.fixes import fix_print` or `from fissix.fixer_util import Name`). If using `RefactoringTool`, pass the fully-qualified string name like `'fissix.fixes.fix_print'`.
This warning is expected and generally harmless when using `fissix`, as `fissix` aims to maintain and enhance `lib2to3`. It indicates Python's stance on the *standard library* `lib2to3`, not a problem with `fissix` itself. You can choose to suppress `DeprecationWarning` if it becomes too noisy, but it's important to understand its origin.
If you need to call `fissix.main.main()` programmatically, wrap the call in a `try...except SystemExit` block to prevent your script from exiting. For purely programmatic code transformations without command-line behavior, it's generally better to use `fissix.refactor.RefactoringTool` directly.
No dependency data recorded yet.