flake8-slots

A Flake8 plugin to require __slots__ to be defined for subclasses of immutable types.


Keywords
flake8, python
License
MIT
Install
pip install flake8-slots==0.1.6

Documentation

flake8-slots

A Flake8 plugin to require __slots__ to be defined for subclasses of immutable types.

Docs Documentation Build Status Docs Check Status
Tests Linux Test Status Windows Test Status macOS Test Status Coverage
PyPI PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel
Anaconda Conda - Package Version Conda - Platform
Activity GitHub last commit GitHub commits since tagged version Maintenance PyPI - Downloads
QA CodeFactor Grade Flake8 Status mypy status
Other License GitHub top language Requirements Status

Installation

flake8-slots can be installed from PyPI or Anaconda.

To install with pip:

$ python -m pip install flake8-slots

To install with conda:

  • First add the required channels
$ conda config --add channels https://conda.anaconda.org/conda-forge
$ conda config --add channels https://conda.anaconda.org/domdfcoding
  • Then install
$ conda install flake8-slots

Flake8 codes

Code Description
SLOT000 Define __slots__ for subclasses of str
SLOT001 Define __slots__ for subclasses of tuple
SLOT002 Define __slots__ for subclasses of collections.namedtuple

Use as a pre-commit hook

See pre-commit for instructions

Sample .pre-commit-config.yaml:

- repo: https://gitlab.com/pycqa/flake8
  rev: 3.8.1
  hooks:
   - id: flake8
     additional_dependencies: [flake8-slots==0.1.6]