added python 3.12 to CI by auvipy · Pull Request #9157 · encode/django-rest-framework (original) (raw)
I am running python3.12 and get the same error as your 3.12 ci see sample.
/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/coreapi/utils.py:5: DeprecationWarning: pkg_
resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/coreapi/codecs/download.py:5: DeprecationWar
ning: 'cgi' is deprecated and slated for removal in Python 3.13
import cgi
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/_pytest/main.py", lin
e 267, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/_pytest/config/__init
__.py", line 1053, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/pluggy/_hooks.py", li
ne 514, in call_historic
INTERNALERROR> res = self._hookexec(self.name, self._hookimpls, kwargs, False)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/pluggy/_manager.py",
line 115, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/pluggy/_callers.py",
line 113, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.__traceback__)
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/pluggy/_callers.py",
line 77, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/tests/conftest.py", line 95, in pytest_configure
INTERNALERROR> django.setup()
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/django/__init__.py",
line 24, in setup
INTERNALERROR> apps.populate(settings.INSTALLED_APPS)
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/django/apps/registry.
py", line 91, in populate
INTERNALERROR> app_config = AppConfig.create(entry)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/django/apps/config.py
", line 193, in create
INTERNALERROR> import_module(entry)
INTERNALERROR> File "/usr/lib64/python3.12/importlib/__init__.py", line 90, in import_module
INTERNALERROR> return _bootstrap._gcd_import(name[level:], package, level)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
INTERNALERROR> File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
INTERNALERROR> File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
INTERNALERROR> File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
INTERNALERROR> File "<frozen importlib._bootstrap_external>", line 994, in exec_module
INTERNALERROR> File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/tests/importable/__init__.py", line 6, in <module>
INTERNALERROR> from rest_framework import compat, serializers # noqa
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/rest_framework/compat.py", line 64, in <module>
INTERNALERROR> import markdown
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/markdown/__init__.py"
, line 29, in <module>
INTERNALERROR> from .core import Markdown, markdown, markdownFromFile # noqa: E402
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/markdown/core.py", li
ne 26, in <module>
INTERNALERROR> from . import util
INTERNALERROR> File "/home/markom-dot/research/django-rest-framework/.venv/lib64/python3.12/site-packages/markdown/util.py", li
ne 86, in <module>
INTERNALERROR> INSTALLED_EXTENSIONS = metadata.entry_points().get('markdown.extensions', ())
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> AttributeError: 'EntryPoints' object has no attribute 'get'
Inside compat.py
I've the following workaround. I just catch the AttributeError since Markdown is optional and not needed. I can successfully run tests by executing ./runtests.py
.
except (ImportError, AttributeError): apply_markdown = None markdown = None
However, flake8 fails and I cannot commit this code of course. Here is the traceback:
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
Traceback (most recent call last):
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/bin/flake8", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
app.run(argv)
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 363, in run
self._run(argv)
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 350, in _run
self.initialize(argv)
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 330, in initialize
self.find_plugins(config_finder)
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 153, in find_plugins
self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 356, in __init__
self.manager = PluginManager(
^^^^^^^^^^^^^^
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 238, in __init__
self._load_entrypoint_plugins()
File "/home/markom-dot/.cache/pre-commit/repoyalztujj/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 254, in _load_entrypoint_plugins
eps = importlib_metadata.entry_points().get(self.namespace, ())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'