Command line interface¶

slotscheck¶

Check whether your __slots__ are working properly.

Usage

slotscheck [OPTIONS] [FILES]...

Options

-m, --module <module>¶

Check this module. Cannot be combined with FILES argument. Can be repeated multiple times to scan several modules.

--require-superclass, --no-require-superclass¶

Report an error when a slots class inherits from a non-slotted (or __dict__) class.

Default:

'required'

--require-subclass, --no-require-subclass¶

Report an error when a non-slotted class inherits from a slotted class. In effect, this option enforces the use of slots wherever possible.

Default:

'not required'

--include-modules <include_modules>¶

A regular expression that matches modules to include. Exclusions are determined first, then inclusions. Uses Python’s verbose regex dialect, so whitespace is mostly ignored.

--exclude-modules <exclude_modules>¶

A regular expression that matches modules to exclude. Excluded modules will not be imported. Uses Python’s verbose regex dialect, so whitespace is mostly ignored.

Default:

'``(^|\\.)__main__(\\.|$)’``

--include-classes <include_classes>¶

A regular expression that matches classes to include. Use : to separate module and class paths. For example: app\.config:.*Settings, :(Foo|Bar). Exclusions are determined first, then inclusions. Uses Python’s verbose regex dialect, so whitespace is mostly ignored.

--exclude-classes <exclude_classes>¶

A regular expression that matches classes to exclude. Use : to separate module and class paths. For example: app\.config:Settings, :.*(Exception|Error). Uses Python’s verbose regex dialect, so whitespace is mostly ignored.

Default:

'``^$’``

--strict-imports, --no-strict-imports¶

Treat failed imports as errors.

Default:

'strict'

--detect-unused-slots, --no-detect-unused-slots¶

[Experimental, Python 3.13+] Detect slots that are never assigned within the class body. Disabled by default.

Default:

'disabled'

--exclude-slots <exclude_slots>¶

A regular expression matching slots to exclude from unused-slot detection. Matches against ‘module.path:Class.slot_name’. Uses Python’s verbose regex dialect.

-v, --verbose¶

Display extra descriptive output.

--settings <settings>¶

Path to the configuration file to use. Allowed extensions are toml, cfg, ini.

--version¶

Show the version and exit.

Arguments

FILES¶

Optional argument(s)