Install & Compatibility
Where this runs
tested against v2.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 1.036s · 35.4MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.8s · import 0.927s · 37MB
35MB installed
● package 35MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
LintRule
✓ from fixit import LintRule
InvalidTestCase
✓ from fixit import InvalidTestCase
Used for defining invalid code examples in custom lint rule tests. Also 'Invalid' is an alias.
ValidTestCase
✓ from fixit import ValidTestCase
Used for defining valid code examples in custom lint rule tests. Also 'Valid' is an alias.
Configuration
✓ from fixit.ftypes import Configuration
✗ from fixit.configuration import Configuration
Configuration types and utilities have moved to `fixit.ftypes`.
This quickstart demonstrates how to use Fixit from the command line to lint a Python file and then apply available autofixes. It creates a temporary Python file with common linting issues, runs `fixit lint` to identify them, and then `fixit fix` to resolve them automatically.
import os
import subprocess
# Create a dummy Python file
with open('my_module.py', 'w') as f:
f.write('x = 1\n')
f.write('def foo():\n')
f.write(' return 1 + 2 # Bad spacing\n')
f.write('class MyClass(object): # Inheriting from object is redundant in Python 3\n')
f.write(' pass\n')
# Run fixit lint to see issues
print('--- Running fixit lint ---')
subprocess.run(['fixit', 'lint', 'my_module.py'])
# Run fixit fix to apply autofixes
print('\n--- Running fixit fix ---')
subprocess.run(['fixit', 'fix', 'my_module.py'])
# Print the fixed file content
print('\n--- Fixed file content ---')
with open('my_module.py', 'r') as f:
print(f.read())
# Clean up
os.remove('my_module.py')
fixit --version
Debug
Known issues
breakingFixit 2.0 (and newer) introduced a foundational rewrite from Fixit 1.x. Configuration files changed from YAML to TOML (e.g., `pyproject.toml` or `fixit.toml`), rule referencing syntax was updated, and the internal API for custom rules changed significantly.fixRefer to the 'Upgrading' guide in the official documentation. Migrate `.fixit.config.yaml` to `pyproject.toml` or `fixit.toml` using the new TOML format. Update custom lint rules to align with the Fixit 2.x API.
affects: >=2.0.0
breakingFlake8-style suppression comments (`# noqa`) are no longer supported in Fixit 2.x. They have been replaced by `# lint-ignore` or `# lint-fixme` directives.fixReplace all instances of `# noqa` with `# lint-ignore` or `# lint-fixme` in your codebase. You can optionally specify rule names after the directive for granular suppression.
affects: >=2.0.0
gotchaFixit's autofix functionality might not work as expected when integrated with external formatters like 'Black' if Black makes no changes to the file. This can lead to a state where `fixit fix` reports no changes, even if lint issues are present that Fixit *could* fix.fixThis is a known issue (GitHub issue #427). A workaround might involve running `fixit fix` separately from formatter runs, or inspecting `fixit`'s output carefully when an external formatter is also in use.
affects: All 2.x versions
gotchaWhen using `fixit_file()` or similar functions with `parallel=True` (for multiprocessing), Fixit currently does not support applying individual fixes interactively. Automated autofix (`autofix=True`) will still apply changes, but interactive selection is disabled.fixIf interactive fixes are desired, set `parallel=False` when calling relevant API functions. For fully automated fixes, set `autofix=True`.
affects: All 2.x versions
gotchaWhile Fixit offers per-file multiprocessing for performance, it may still be slow on very large codebases without caching or further optimizations.fixMonitor Fixit's performance on your codebase. Consider implementing caching mechanisms if not already integrated. The Fixit team has plans for future performance improvements, including caching.
affects: All 2.x versions
Errors
Common errors & fixes
KeyError: 'rules' or similar when running fixit with custom rules after upgrade.
The configuration format for Fixit 2.x changed from YAML to TOML, and the way rules are enabled/disabled also changed. Older configuration files are no longer valid.
fixMigrate your `.fixit.config.yaml` to `pyproject.toml` or `fixit.toml`. Rules are now enabled using `enable = ["mypackage.rules:CustomLintRule", "another_package.rules"]` in the `[tool.fixit]` section.
AttributeError: 'module' object has no attribute 'LegacyRule' or 'BaseLintRule'
The base class for custom lint rules and other core API types were renamed or refactored in Fixit 2.x for conciseness.
fixUpdate your custom lint rule definitions. The primary base class for new rules is now `fixit.LintRule`. Review the 'Upgrading' guide and API reference for specific class name changes.
SyntaxError: invalid syntax (on newer Python features) or similar parsing errors.
Fixit relies on LibCST for parsing. If your Python environment's LibCST version is outdated, it might not support the latest Python syntax features.
fixEnsure both `fixit` and `libcst` are updated to their latest versions compatible with your Python interpreter (`pip install --upgrade fixit libcst`). Fixit requires Python >=3.9.
Upgrade
Version history
2.2.1latest on PyPI · released Nov 12, 2025
Audit
Dependencies
libcstrequiredFixit is built on LibCST for parsing Python code and applying accurate code modifications.