Skip to content

fix(ui): accept None for required/default and correct Label kwarg - #3337

Open
vmphase wants to merge 17 commits into
masterfrom
fix/3331
Open

fix(ui): accept None for required/default and correct Label kwarg#3337
vmphase wants to merge 17 commits into
masterfrom
fix/3331

Conversation

@vmphase

@vmphase vmphase commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Fixes Label.set_radio_group() option kwarg typo #3331 (option => options kwarg)
  • Select.__init__ now has an overload accepting a non-literal ComponentType
  • RadioGroup, CheckboxGroup, and FileUpload now accept None for required (defaults to True), and Checkbox accepts None for default (defaults to False). This was earlier stated in class-docstrings, but not implemented.
  • Label.set_select overloads now return Self instead of None.

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.
  • I have read the Contributing Guidelines.
  • AI Usage has been disclosed.
    • If AI has been used, I understand fully what the code does

@vmphase
vmphase requested review from a team and VincentRPS August 7, 2026 09:25
@vmphase
vmphase requested review from DA-344 and plun1331 August 7, 2026 09:25
@github-project-automation github-project-automation Bot moved this to Todo in Pycord Aug 7, 2026
@vmphase
vmphase requested a review from JustaSqu1d August 7, 2026 09:25
@vmphase
vmphase requested a review from a team as a code owner August 7, 2026 09:25
@pycord-app

pycord-app Bot commented Aug 7, 2026

Copy link
Copy Markdown

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/3337/head:pr-3337
git checkout pr-3337

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3337/head

@Paillat-dev Paillat-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changelog should not be this specific, and should focus on what was fixed/modified and not why & how.

Comment thread discord/ui/checkbox.py
Comment thread discord/ui/checkbox_group.py

@ToothyDev ToothyDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not a huge fan of having multiple heterogenous changes in one PR cause it's hard to review buttttt
I'm generally fine with all this, but I disagree with making required and default None-able. I don't see any reason to allow this, since it's converted to its respective boolean default anyway, and never goes out to the API as MISSING or anything.

Comment thread discord/ui/checkbox.py Outdated
Comment thread discord/ui/checkbox_group.py Outdated
Comment thread discord/ui/radio_group.py Outdated
@vmphase

vmphase commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

I have pushed the changes; however, according to semver, this is a breaking change.
Even though you wouldn't expect users to pass None there.

@ToothyDev
ToothyDev requested a review from NeloBlivion August 7, 2026 12:54
Comment thread discord/ui/checkbox.py Outdated
Comment thread CHANGELOG.md
Comment on lines +29 to +30
- Fix `option` keyword argument in `Label.set_radio_group` and
`Label.set_checkbox_group`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is fine to just say more generally that those functions were fixed; a regular user won't know what this means because it's internal code
Like "Fixed Label.set_radio_group and Label.set_checkbox_group to no longer cause TypeErrors when used" or something. But @JustaSqu1d might know better

Comment thread discord/ui/select.py
default_values: Sequence[SelectDefaultValue | ST] | None = ...,
) -> None: ...

@overload

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just checking, what exactly is the purpose of this new overload?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

To allow a non-literal ComponentType in Label.set_select. Without it basedpyright complains:

No overloads for "__init__" match the provided arguments
  Argument types: ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Label.set_radio_group() option kwarg typo

4 participants