Voxel-Fox-Ltd/Novus

Library doesnt work on Python 3.11.0

Closed this issue · 6 comments

Summary

Libary fails on Python 3.11.0

Reproduction Steps

  1. Setup Python 3.11.0 & Novus
  2. import discord.ext.commands OR run python -m discord -v

Minimal Reproducible Code

import discord.ext.commands

Expected Results

Bot starts

Actual Results

Error:

  File "/home/bbs/bbsbot/test.py", line 1, in <module>
    import discord.ext.commands
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/site-packages/discord/ext/commands/__init__.py", line 20, in <module>
    from .flags import *
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/site-packages/discord/ext/commands/flags.py", line 72, in <module>
    @dataclass
     ^^^^^^^^^
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/dataclasses.py", line 1221, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/dataclasses.py", line 1211, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/dataclasses.py", line 959, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/dataclasses.py", line 816, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'discord.utils._MissingSentinel'> for field name is not allowed: use default_factory


### Intents

members, presences, guild_messages

### System Information

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/site-packages/discord/__main__.py", line 117, in <module>
    import voxelbotutils
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/site-packages/voxelbotutils/__init__.py", line 1, in <module>
    from discord.ext.vbu import *
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/site-packages/discord/ext/vbu/__init__.py", line 1, in <module>
    from . import runner
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/site-packages/discord/ext/vbu/runner.py", line 12, in <module>
    from discord.ext import commands
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/site-packages/discord/ext/commands/__init__.py", line 20, in <module>
    from .flags import *
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/site-packages/discord/ext/commands/flags.py", line 72, in <module>
    @dataclass
     ^^^^^^^^^
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/dataclasses.py", line 1221, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/dataclasses.py", line 1211, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/dataclasses.py", line 959, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bbs/.pyenv/versions/3.11.0/lib/python3.11/dataclasses.py", line 816, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'discord.utils._MissingSentinel'> for field name is not allowed: use default_factory

Python: 3.11.0
Arch: aarch64
Novus: 0.2.0
OS: Raspberry Pi OS 64bit (based on Debian 11)

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.

### Additional Context

_No response_

its rapberrypios, i know that it should still work, but maybe you can try it on linux?

it has nothing to do with raspberrypios its from changes in python 3.11.0
https://docs.python.org/3.11/whatsnew/3.11.html#dataclasses

its rapberrypios, i know that it should still work, but maybe you can try it on linux?

Raspberry Pi OS is based on debian linux, therefore it is Linux
But which os novus is being run on has no bearing on python 3.11's breaking changes as previously said.

its rapberrypios, i know that it should still work, but maybe you can try it on linux?

Raspberry Pi OS is based on debian linux, therefore it is Linux But which os novus is being run on has no bearing on python 3.11's breaking changes as previously said.

i meant a different linux distro, i should have written "on a different OS/version"

makes sense, but that was something that came to mind, because i had enough issues with outdated stuff on raspi os

sn8to commented

likely related to this issue on another library's repo: Pycord-Development/pycord#1752

the fix can likely be taken from this pull request: Pycord-Development/pycord#1680