--- id: slotscheck version: "0.20.1" license: MIT license_treatment: permissive maintenance: active --- # slotscheck — Ensure your __slots__ are working properly. License: permissive · Maintenance: active · Downloads: 160.5K/mo ## What it is and what it does Slotscheck is a runtime validator for Python's `__slots__` mechanism, which developers use to optimize class memory and attribute access. The tool runs your code, inspects the resulting class tree, and detects common slots mistakes that static analyzers miss: overlapping slots across inheritance hierarchies, slots defined in child classes when parents lack them, duplicate slot names, and unused slots. It works by actually importing and executing your modules, which lets it catch slots generated at import time by decorators, metaclasses, and frameworks like dataclasses, attrs, and pydantic—cases that static analysis cannot see. You run it from the command line against files or modules, and it reports errors with class paths and problem types. It integrates into pre-commit hooks and CI pipelines to prevent slots mistakes from reaching production. The tool is CPython-specific because it relies on CPython internals to inspect the class tree; it will not work on alternative Python implementations. Use it for: - Validate slots inheritance in a large codebase before committing to catch mistakes early via pre-commit. - Audit a third-party library (e.g., sanic) to find slots violations in its class hierarchy. - Enforce slots usage across a team's code to ensure consistent performance optimization practices. - Detect unused or duplicate slots in classes that auto-generate slots via decorators or metaclasses. - Add to CI pipeline to prevent slots regressions as code evolves and class hierarchies change. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Validates that `__slots__` are correctly implemented across class hierarchies, detecting overlapping slots, inheritance errors, and duplicate slot definitions by running and inspecting your code. Yes. Slotscheck fills a real gap: static analyzers cannot catch slots mistakes that arise from runtime code generation, conditional imports, or deep inheritance trees. If you use `__slots__` for performance, this tool prevents silent failures that are hard to debug. Low install friction, active maintenance, MIT license, and no known vulnerabilities make it a safe addition to your development workflow. ## Install pip install slotscheck uv add slotscheck poetry add slotscheck ## Installing slotscheck Before you install: Low install friction with a single lightweight runtime dependency (tomli). Active maintenance with recent releases and a stable repository. License in practice: MIT license permits unrestricted use, modification, and distribution with minimal restrictions. Quickstart: pip install slotscheck python -m slotscheck [FILES]... # or slotscheck -m [MODULES]... Requires CPython 3.10+; does not work on PyPy, Jython, or IronPython. Will import and potentially execute all submodules of target packages. Verify before relying: - Whether slotscheck can be integrated into automated CI/CD pipelines beyond pre-commit hooks. - Performance impact when scanning large codebases or packages with many modules. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 160.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags slots validation python, check slots inheritance, detect overlapping slots, slots linter, class slots verification, performance-optimization, class-validation, cpython-specific [View on SkillFed](https://skillfed.io/packages/slotscheck) · [View on PyPI](https://pypi.org/project/slotscheck/)