Skip to content

feat: ✨ Add slotscheck to ensure __slots__ are used correctly #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Paillat-dev
Copy link
Member

Implements https://github.com/ariebovenberg/slotscheck to ensure __slots__ are used correctly, and fix some incorrect __slots__ usages.

@Paillat-dev Paillat-dev requested a review from Lulalaby as a code owner August 3, 2025 12:00
@Paillat-dev Paillat-dev requested a review from a team August 3, 2025 12:01
@pre-commit-ci pre-commit-ci bot requested a review from a team as a code owner August 3, 2025 12:01
@Paillat-dev Paillat-dev requested review from Copilot and removed request for a team August 3, 2025 12:09
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates slotscheck to validate proper usage of __slots__ in the py-cord library. The tool helps ensure that __slots__ declarations are correct and consistent across the codebase.

  • Adds slotscheck as a development dependency and CI check
  • Fixes incorrect __slots__ declarations by removing redundant or inherited attributes
  • Adds missing __slots__ declarations for mixin classes

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Adds slotscheck as a development dependency
.pre-commit-config.yaml Configures slotscheck as a pre-commit hook
.github/workflows/lib-checks.yml Adds slotscheck to CI pipeline
discord/widget.py Removes inherited attributes from WidgetMember.slots
discord/sticker.py Removes _state and url attributes from slots declarations
discord/raw_models.py Adds empty slots to _RawReprMixin base class
discord/partial_emoji.py Removes _state from PartialEmoji.slots
discord/emoji.py Removes inherited attributes from BaseEmoji.slots
discord/components.py Removes inherited type attribute from InputText.slots
discord/asset.py Adds slots to AssetMixin and removes _state from Asset.slots
discord/activity.py Removes _created_at from Activity.slots
Comments suppressed due to low confidence (1)

.pre-commit-config.yaml:37

  • The version v0.19.1 for slotscheck should be verified to exist. Based on the pyproject.toml dependency specification of '>=0.19.1', this appears to be the minimum required version, but it's important to confirm this version actually exists in the repository.
    rev: v0.19.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants