Skip to content

Conversation

@shiftinv
Copy link
Member

Summary

Fixes #1422.
See https://disnake--1431.org.readthedocs.build/en/1431/ext/commands/commands.html#typing-annotated for a proper explanation :>

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running uv run nox -s lint
    • I have type-checked the code by running uv run nox -s pyright
  • 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, ...)

@shiftinv shiftinv added this to the disnake v2.12 milestone Oct 12, 2025
@shiftinv shiftinv added the t: enhancement New feature label Oct 12, 2025
@read-the-docs-community
Copy link

read-the-docs-community bot commented Oct 12, 2025

Documentation build overview

📚 disnake | 🛠️ Build #30378746 | 📁 Comparing f333072 against latest (66e27d8)


🔍 Preview build

Show files changed (50 files in total): 📝 50 modified | ➕ 0 added | ➖ 0 deleted
File Status
index.html 📝 modified
whats_new.html 📝 modified
api/abc.html 📝 modified
api/activities.html 📝 modified
api/app_commands.html 📝 modified
api/app_info.html 📝 modified
api/audit_logs.html 📝 modified
api/automod.html 📝 modified
api/channels.html 📝 modified
api/clients.html 📝 modified
api/components.html 📝 modified
api/emoji.html 📝 modified
api/entitlements.html 📝 modified
api/events.html 📝 modified
api/exceptions.html 📝 modified
api/guild_scheduled_events.html 📝 modified
api/guilds.html 📝 modified
api/integrations.html 📝 modified
api/interactions.html 📝 modified
api/invites.html 📝 modified
api/localization.html 📝 modified
api/members.html 📝 modified
api/messages.html 📝 modified
api/misc.html 📝 modified
api/permissions.html 📝 modified
api/roles.html 📝 modified
api/skus.html 📝 modified
api/soundboard.html 📝 modified
api/stage_instances.html 📝 modified
api/stickers.html 📝 modified
api/subscriptions.html 📝 modified
api/ui.html 📝 modified
api/users.html 📝 modified
api/utilities.html 📝 modified
api/voice.html 📝 modified
api/webhooks.html 📝 modified
api/widgets.html 📝 modified
ext/commands/commands.html 📝 modified
ext/commands/slash_commands.html 📝 modified
ext/tasks/index.html 📝 modified
ext/commands/api/app_commands.html 📝 modified
ext/commands/api/bots.html 📝 modified
ext/commands/api/checks.html 📝 modified
ext/commands/api/cogs.html 📝 modified
ext/commands/api/context.html 📝 modified
ext/commands/api/converters.html 📝 modified
ext/commands/api/exceptions.html 📝 modified
ext/commands/api/help_commands.html 📝 modified
ext/commands/api/misc.html 📝 modified
ext/commands/api/prefix_commands.html 📝 modified

Copy link
Member

@onerandomusername onerandomusername left a comment

Choose a reason for hiding this comment

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

looks good, but we should make sure we support typing_extensions Annotated as well. This can be done by implementing typing_extensions.get_type_hints.

@onerandomusername onerandomusername enabled auto-merge (squash) November 19, 2025 04:36
@Enegg
Copy link
Contributor

Enegg commented Nov 19, 2025

I'm wondering if it's a good idea to make converters the only use of Annotated (in the context of prefix commands)
If we intend to upkeep/expand on prefix commands, perhaps it could be useful to have something akin to commands.Param for them?

@shiftinv
Copy link
Member Author

looks good, but we should make sure we support typing_extensions Annotated as well. This can be done by implementing typing_extensions.get_type_hints.

@onerandomusername typing_extensions.Annotated is a simple alias in 3.10+, I don't expect that to be necessary:

$ uv run -p 3.10 python
Python 3.10.12 (main, Aug 15 2025, 14:32:43) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing, typing_extensions
>>> typing.Annotated is typing_extensions.Annotated
True

@shiftinv
Copy link
Member Author

I'm wondering if it's a good idea to make converters the only use of Annotated (in the context of prefix commands) If we intend to upkeep/expand on prefix commands, perhaps it could be useful to have something akin to commands.Param for them?

@Enegg Yeah, it would be nice to have prefix/slash commands diverge less long-term. Not necessarily with some sort of hybrid command, but more so by just reusing internals more between the two command types

@onerandomusername onerandomusername merged commit 7d79372 into master Nov 19, 2025
34 checks passed
@onerandomusername onerandomusername deleted the feat/prefix-typing-annotated-converters branch November 19, 2025 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t: enhancement New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Converters should support annotated typing

3 participants