An extension for Flake8 that enforces a consistent order for attributes within Python classes. It analyzes various attribute types, including docstrings, properties, methods, nested classes, and constants, and can also detect Django model fields. The current version is 0.3.0, and it maintains an active release cadence with regular updates.
pip install flake8-class-attributes-orderVerified import paths — ran on the pinned version, not inferred.
To use `flake8-class-attributes-order`, first install it. Then, run `flake8` as you normally would. The plugin automatically integrates. You can configure the order or enable strict mode via a configuration file such as `setup.cfg` or `.flake8`.
Upgrade to Python 3.9 or a later compatible version.
Upgrade to Python 3.8 or a later compatible version.
Add `[flake8]\nuse_class_attributes_order_strict_mode = True` to your project's `setup.cfg` or `.flake8` file.
Add `ignore = CCE001,CCE002` (or specific codes) under the `[flake8]` section of your configuration file.
Refer to the documentation for the default order and define `class_attributes_order` in your `[flake8]` config section to match your desired sequence.