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

added python 3.12 to CI #9157

Merged
merged 6 commits into from
Feb 20, 2024
Merged

added python 3.12 to CI #9157

merged 6 commits into from
Feb 20, 2024

Conversation

auvipy
Copy link
Member

@auvipy auvipy commented Nov 5, 2023

related #9181

@MarkoM-dot
Copy link
Contributor

MarkoM-dot commented Nov 26, 2023

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'

@MarkoM-dot
Copy link
Contributor

I have submitted a pr here: #9167

Hope this helps!

tox.ini Show resolved Hide resolved
@auvipy
Copy link
Member Author

auvipy commented Dec 6, 2023

=========================== short test summary info ============================
ERROR tests/test_fields.py - ValueError: not enough values to unpack (expecte...
ERROR tests/schemas/test_coreapi.py - ValueError: not enough values to unpack...
ERROR tests/schemas/test_openapi.py - ValueError: not enough values to unpack...
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!
======================== 2 warnings, 3 errors in 9.72s =========================

@kiendang
Copy link
Contributor

=========================== short test summary info ============================ ERROR tests/test_fields.py - ValueError: not enough values to unpack (expecte... ERROR tests/schemas/test_coreapi.py - ValueError: not enough values to unpack... ERROR tests/schemas/test_openapi.py - ValueError: not enough values to unpack... !!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!! ======================== 2 warnings, 3 errors in 9.72s =========================

@auvipy #9180 should fix this.

@auvipy
Copy link
Member Author

auvipy commented Dec 14, 2023

OK let me check

@kiendang
Copy link
Contributor

This part in #9180 needs to be changed though. The issue is with djangomain, not 5.0.

if django.VERSION >= (5, 0):

@kiendang
Copy link
Contributor

This part in #9180 needs to be changed though. The issue is with djangomain, not 5.0.

if django.VERSION >= (5, 0):

This is now rectified in the PR (if django.VERSION >= (5, 1)...).

@tomchristie
Copy link
Member

ready for review?

tox.ini Outdated
Comment on lines 59 to 62
[testenv:py311-djangomain]
ignore_outcome = true
[testenv:py312-djangomain]
ignore_outcome = true
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[testenv:py311-djangomain]
ignore_outcome = true
[testenv:py312-djangomain]
ignore_outcome = true
[testenv:py311-djangomain]
ignore_outcome = true
[testenv:py312-djangomain]
ignore_outcome = true

@tomchristie tomchristie mentioned this pull request Jan 4, 2024
@kiendang
Copy link
Contributor

@auvipy Tests for 3.12 should pass now if you merge with master.

tox.ini Show resolved Hide resolved
@math-a3k
Copy link
Contributor

@auvipy you can cherry-pick the last two commits in #9230 which fixes the pre-commit error and enables coreapi tests for python 3.12 - after rebasing with master it should all be working as expected (not considering djangomain)

@auvipy auvipy marked this pull request as ready for review February 20, 2024 13:06
@auvipy auvipy merged commit 336e7ad into encode:master Feb 20, 2024
9 checks passed
@auvipy auvipy deleted the py312 branch February 20, 2024 13:12
@auvipy
Copy link
Member Author

auvipy commented Feb 20, 2024

thanks Rodrigo

@auvipy auvipy added this to the 3.15 milestone Feb 20, 2024
@math-a3k
Copy link
Contributor

🙏

@auvipy
Copy link
Member Author

auvipy commented Feb 22, 2024

🙏

just wanted to make sure you also get some credit

@tomchristie tomchristie mentioned this pull request Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants