-
Notifications
You must be signed in to change notification settings - Fork 0
feat: setup basedpyright #10
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
base: master
Are you sure you want to change the base?
Conversation
ba45351
to
31089b1
Compare
There was a problem hiding this 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 pull request adds a basedpyright CI job with a “baseline” configuration and modernizes type annotations across the codebase by replacing Union[...]
with the new |
syntax, plus a couple of strict-parameter adjustments in zip
calls.
- Introduce
basedpyright
run in GitHub Actions for gradual typing - Replace
typing.Union
annotations with PEP 604-style unions (A | B
) - Add explicit
strict=False
tozip
in two methods (though default is alreadyFalse
) - Update changelog to note removal of Python 3.9 support
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
discord/state.py | Updated Channel union syntax; added strict=False to zip in _delay_ready |
discord/role.py | Added strict=False to zip in _move payload comprehension |
discord/object.py | Updated SupportsIntCast alias to PEP 604 union syntax |
discord/message.py | Modernized EmojiInputType to use ` |
discord/member.py | Replaced VocalGuildChannel Union with ` |
discord/iterators.py | Replaced internal _Func return union with ` |
discord/invite.py | Swapped out Union[...] for TypeAlias -style unions |
discord/interactions.py | Modernized InteractionChannel union syntax |
discord/guild.py | Converted channel-type aliases to PEP 604 unions |
discord/ext/commands/flags.py | Adjusted optional flag handling; removed import of Union |
discord/ext/commands/context.py | Updated BotT bound to `Bot |
discord/ext/commands/_types.py | Converted many Union -based definitions to ` |
discord/ext/bridge/context.py | Simplified Context union to ` |
discord/errors.py | Replaced _ResponseType union with PEP 604 syntax |
discord/commands/options.py | Refactored InputType to new union grouping syntax |
discord/commands/core.py | Marked deprecated Union[...] usage with TODO and noqa |
discord/activity.py | Updated ActivityTypes to use PEP 604 unions |
discord/abc.py | Cleaned up MessageableChannel and SnowflakeTime aliases |
CHANGELOG-V3.md | Noted removal of Python 3.9 support |
.github/workflows/lib-checks.yml | Added basedpyright job to CI workflow |
Comments suppressed due to low confidence (1)
discord/ext/commands/flags.py:421
- You removed the
Union
import at the top but still referenceUnion
here, which will cause aNameError
. Re-importUnion
or replace this with the modern|
syntax.
annotation = Union[annotation.__args__[:-1]] # noqa: UP007
In an effort to have better typing, this sets up basedpyright with the "baseline" feature, which will ignore all typing errors from before this pull request and allow for gradual typing of code. Idk if this is the best, but I figured I might as well try. This needs #4 to be merged first.