Skip to content
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

fix(libraries): use TYPE_CHECKING to resolve import loop in disnake #40

Merged
merged 2 commits into from
Feb 15, 2023

Conversation

ooliver1
Copy link
Owner

Summary

Report from @Kraots https://canary.discord.com/channels/864563184919773226/1075508816914960384/1075510719350571069.

Traceback (most recent call last):
  File "/home/Kraots/okiyu/main.py", line 17, in <module>
    import mafic
  File "/home/Kraots/venv/lib/python3.10/site-packages/mafic/__init__.py", line 13, in <module>
    from . import __libraries
  File "/home/Kraots/venv/lib/python3.10/site-packages/mafic/__libraries.py", line 92, in <module>
    from disnake.types.gateway import (
  File "/home/Kraots/venv/lib/python3.10/site-packages/disnake/types/gateway.py", line 11, in <module>
    from .audit_log import AuditLogEntry
  File "/home/Kraots/venv/lib/python3.10/site-packages/disnake/types/audit_log.py", line 17, in <module>
    from .channel import ChannelType, PermissionOverwrite, VideoQualityMode
  File "/home/Kraots/venv/lib/python3.10/site-packages/disnake/types/channel.py", line 8, in <module>
    from .threads import ForumTag, ThreadArchiveDurationLiteral, ThreadMember, ThreadMetadata
  File "/home/Kraots/venv/lib/python3.10/site-packages/disnake/types/threads.py", line 11, in <module>
    from .message import Message
  File "/home/Kraots/venv/lib/python3.10/site-packages/disnake/types/message.py", line 9, in <module>
    from .channel import ChannelType
ImportError: cannot import name 'ChannelType' from partially initialized module 'disnake.types.channel' (most likely due to a circular import) (/home/Kraots/venv/lib/python3.10/site-packages/disnake/types/channel.py)

Checklist

  • If code changes were made then they have been tested.
  • I have run task lint to format code and my changes.
  • I have run task pyright and fixed the relevant issues.

@ooliver1 ooliver1 added t: bug Type: bug - something isn't working p: high Priority: high - should be worked on as soon as reasonable labels Feb 15, 2023
@ooliver1 ooliver1 enabled auto-merge (squash) February 15, 2023 20:41
@ooliver1 ooliver1 merged commit b44a16b into master Feb 15, 2023
@ooliver1 ooliver1 deleted the fix/import-loop branch February 15, 2023 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: high Priority: high - should be worked on as soon as reasonable t: bug Type: bug - something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant