Can't start bot when using Jishaku 2.5.0
See original GitHub issueSummary
After upgrading my Production and Development instances of the Jishaku library to the latest version (whether that be v2.5.0 itself or using the latest master branch version), I am no longer able to start my bots because of an error relating to typing violations. The error is given below in the actual results section.
My theory is that this latest version of Jishaku seems to be using features that might be requiring Python 3.10 and is no longer compatible with anything older than this version, but which is not mentioned anywhere or even specified in the requirements files, implying that Jishaku 2.5 is intended to be supported on Python 3.8 or newer.
Reproduction steps
- Install Python 3.8.5 or Python 3.9.6
- Install Jishaku 2.5.0 or latest master branch via appropriate pip commands.
- Load jishaku by calling
await bot.load_extension("jishaku")
in your code. - Start the bot.
Expected results
The extension gets loaded and it can be used by the bot.
Actual results
Bot won’t start, error trace is given below [account names are redacted]. This doesn’t occur on Jishaku 2.4.0, so I have had to keep myself rolled back on this version to allow my bots to start while keeping the library loaded:
May 15 17:06:02 [REDACTED] python3.9[31368]: An error has been found trying to load the extension jishaku:
May 15 17:06:02 [REDACTED] python3.9[31368]: Traceback (most recent call last):
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 916, in _load_from_module_spec
May 15 17:06:02 [REDACTED] python3.9[31368]: spec.loader.exec_module(lib) # type: ignore
May 15 17:06:02 [REDACTED] python3.9[31368]: File "<frozen importlib._bootstrap_external>", line 850, in exec_module
May 15 17:06:02 [REDACTED] python3.9[31368]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/site-packages/jishaku/__init__.py", line 15, in <module>
May 15 17:06:02 [REDACTED] python3.9[31368]: from jishaku.cog import * # noqa: F401
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/site-packages/jishaku/cog.py", line 19, in <module>
May 15 17:06:02 [REDACTED] python3.9[31368]: from jishaku.features.baseclass import Feature
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/site-packages/jishaku/features/baseclass.py", line 79, in <module>
May 15 17:06:02 [REDACTED] python3.9[31368]: class Feature(commands.Cog):
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/site-packages/jishaku/features/baseclass.py", line 84, in Feature
May 15 17:06:02 [REDACTED] python3.9[31368]: class Command(typing.Generic[GenericFeature, P, T]): # pylint: disable=too-few-public-methods
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/typing.py", line 275, in inner
May 15 17:06:02 [REDACTED] python3.9[31368]: return func(*args, **kwds)
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/typing.py", line 987, in __class_getitem__
May 15 17:06:02 [REDACTED] python3.9[31368]: raise TypeError(
May 15 17:06:02 [REDACTED] python3.9[31368]: TypeError: Parameters to Generic[...] must all be type variables
May 15 17:06:02 [REDACTED] python3.9[31368]: The above exception was the direct cause of the following exception:
May 15 17:06:02 [REDACTED] python3.9[31368]: Traceback (most recent call last):
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/home/[REDACTED]/bot/main.py", line 110, in setup_hook
May 15 17:06:02 [REDACTED] python3.9[31368]: await self.load_extension(module)
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 994, in load_extension
May 15 17:06:02 [REDACTED] python3.9[31368]: await self._load_from_module_spec(spec, name)
May 15 17:06:02 [REDACTED] python3.9[31368]: File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 919, in _load_from_module_spec
May 15 17:06:02 [REDACTED] python3.9[31368]: raise errors.ExtensionFailed(key, e) from e
May 15 17:06:02 [REDACTED] python3.9[31368]: discord.ext.commands.errors.ExtensionFailed: Extension 'jishaku' raised an error: TypeError: Parameters to Generic[...] must all be type variables
Checklist
- I have updated discord.py and jishaku to the latest available versions and have confirmed that this issue is still present
- I have searched the open issues for duplicates
- I have shown the entire traceback, if possible
- I have removed my token from display, if visible
System information
This was attempted on the latest version of Jishaku. In my development environment, I run 3.8.5, but in production, I run a source-built version of Python 3.9.6. The OS on each is different: development is a Windows 10 Pro machine, while production is CentOS 7.9.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
An unideal solution, but removing
P
fromtyping.Generic[GenericFeature, P, T]
in jishaku.features.baseclass.Feature.Command fixes this issue. This can be traced back to the typing_extensions module:Really sucks but this solution shouldn’t have any issues
Versions affected by this issue: Pre-3.10