Command line interface¶
Check whether your __slots__ are working properly.
usage: slotscheck [-h] [-m MODULE]
[--require-superclass | --no-require-superclass]
[--require-subclass | --no-require-subclass]
[--include-modules INCLUDE_MODULES]
[--exclude-modules EXCLUDE_MODULES]
[--include-classes INCLUDE_CLASSES]
[--exclude-classes EXCLUDE_CLASSES]
[--strict-imports | --no-strict-imports]
[--detect-unused-slots | --no-detect-unused-slots]
[--exclude-slots EXCLUDE_SLOTS] [-v] [--settings SETTINGS]
[--version]
[FILES ...]
Positional Arguments¶
- FILES
Named Arguments¶
- -m, --module
Check this module. Cannot be combined with FILES argument. Can be repeated multiple times to scan several modules.
Default:
[]- --require-superclass, --no-require-superclass
Report an error when a slots class inherits from a non-slotted (or __dict__) class.
- --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.
- --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
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.
- --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
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.- --strict-imports, --no-strict-imports
Treat failed imports as errors.
- --detect-unused-slots, --no-detect-unused-slots
[Experimental, Python 3.13+] Detect slots that are never assigned within the class body. Disabled by default.
- --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.
Default:
False- --settings
Path to the configuration file to use. Allowed extensions are toml, cfg, ini.
- --version
show program’s version number and exit