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

Add preliminary support for Python 3.12rc1. #1129

Merged
merged 15 commits into from
Sep 6, 2023

Conversation

icemac
Copy link
Member

@icemac icemac commented Jun 2, 2023

Let's try out the latest release.

Locally it crashes with with a core-dump when running the tests before printing something useful.

@icemac icemac requested a review from dataflake June 2, 2023 14:44
@icemac icemac self-assigned this Jun 2, 2023
@icemac
Copy link
Member Author

icemac commented Jun 2, 2023

My local failure looks like the GHA one: https://github.com/zopefoundation/Zope/actions/runs/5156707238/jobs/9288068396

@icemac icemac added do not merge RELEASE BLOCK Issue blocking the release/milestone it is in labels Jun 2, 2023
@dataflake
Copy link
Member

Locally, also on Python 3.12b0, I am seeing this:

$ bin/tox -epy312
py312: install_deps> python -I -m pip install cffi 'wheel>0.37' 'zc.buildout>=3.0.1'
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/commands/install.py", line 326, in run
    session = self.get_default_session(options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 98, in get_default_session
    self._session = self.enter_context(self._build_session(options))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/metadata/base.py", line 612, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 176, in _iter_distributions
    for dist in finder.find_eggs(location):
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 144, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 111, in _find_eggs_in_dir
    from pip._vendor.pkg_resources import find_distributions
  File "/Users/jens/src/zope/Zope/.tox/py312/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2164, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

@icemac icemac mentioned this pull request Jun 6, 2023
8 tasks
@icemac icemac changed the title Add preliminary support for Python 3.12b1. Add preliminary support for Python 3.12b2. Jun 12, 2023
@icemac
Copy link
Member Author

icemac commented Jun 12, 2023

Let's see what 3.12b2 has to offer.

@icemac
Copy link
Member Author

icemac commented Jun 12, 2023

The result for ubuntu in GHA is:

Tests with errors:
   test_DT_Try__Try__02 (DocumentTemplate.tests.test_DT_Try.DT_Try_Tests.test_DT_Try__Try__02)
   test_DT_Try__Try__06 (DocumentTemplate.tests.test_DT_Try.DT_Try_Tests.test_DT_Try__Try__06)
   test_DT_Try__Try__07 (DocumentTemplate.tests.test_DT_Try.DT_Try_Tests.test_DT_Try__Try__07)
   test_menu_dtml__2 (App.tests.test_ApplicationManager.MenuDtmlTests.test_menu_dtml__2)
   test_Image__manage_main__3 (OFS.tests.testFileAndImage.FileEditTests.test_Image__manage_main__3)
Total: 3245 tests, 0 failures, 5 errors, 37 skipped in 23.223 seconds.

That's way better but also a bit surprising, that DTML tests fail.

@icemac
Copy link
Member Author

icemac commented Jun 12, 2023

Locally I seem to get the same 5 errors + lots of deprecation warnings. So clearly a step forward.

@dataflake
Copy link
Member

My "broken" Python 3.12 is the result of virtualenv (via tox) installing pip version 22.3.1 into the Python 3.12 virtual environment. Pip 22.3.1 is not compatible with Python 3.12. The solution is to use environment variables inside tox.ini testenv to force a newer pip:

[testenv]
+setenv =
+    py312: VIRTUALENV_PIP=23.1.2
+    py312: PIP_REQUIRE_VIRTUALENV=0

Question: I can simply add this in .meta.toml here, or I can add it to the template file in the meta repository itself. I am sure others will run into the same issue.

@icemac
Copy link
Member Author

icemac commented Jun 15, 2023

@dataflake Do you have a clue why tox uses an outdated pip version? Do you use a current tox version and is there a current pip installed in the venv where tox is installed?

I'd like to find out why this problem does not happen to me and I'd like to get around stuffing a hard coded version number into a config file.

If we do not find out the cause of the problem I think your changes should got into meta/config so they can be changed in one place instead of having it in several .meta.toml files.

@dataflake
Copy link
Member

What will happen is that regardless of the pip version at the top/repository level the virtual environment created by tox at .tox/py312 has the old version of pip installed.

This is not a tox issue but virtualenv. There's this whole nasty chain of one package vendoring other packages or prescribing a specific version. I found the workaround here: qutebrowser/qutebrowser@0b0401f

@icemac
Copy link
Member Author

icemac commented Jun 16, 2023

@dataflake Okay, let's move this fix into meta/config until there is new enough version of virtualenv released.

@icemac icemac force-pushed the config-with-zope-product-template-5128b943 branch from bcdd2ac to 87a01aa Compare June 16, 2023 05:52
@dataflake
Copy link
Member

The test failures under Python 3.12 are actually a zope.testrunner issue: zopefoundation/zope.testrunner#149

@dataflake
Copy link
Member

I just confirmed that these errors are fixed with zopefoundation/zope.testrunner#150 applied.

@dataflake
Copy link
Member

This PR will go green when zope.testrunner 6.1 is on PyPI and pinned here, I'm just waiting for the required privileges.

@dataflake
Copy link
Member

The last remaining failure looks like a tox issue to me

To fix Windows 3.12 build.
@icemac icemac changed the title Add preliminary support for Python 3.12b2. Add preliminary support for Python 3.12rc1. Sep 1, 2023
@icemac
Copy link
Member Author

icemac commented Sep 1, 2023

47d82b2 has to be ported to .meta.toml so it is not lost on the next meta/config run.

@dataflake
Copy link
Member

47d82b2 has to be ported to .meta.toml so it is not lost on the next meta/config run.

Done.

@dataflake dataflake removed do not merge RELEASE BLOCK Issue blocking the release/milestone it is in labels Sep 1, 2023
@dataflake
Copy link
Member

I have removed the tags, IMHO this is ready to be merged.

@icemac icemac enabled auto-merge (squash) September 6, 2023 06:25
@icemac
Copy link
Member Author

icemac commented Sep 6, 2023

Thank you for working on this PR. 😃
After it has been merged I'd like to cut a new Zope 5 release.

@dataflake
Copy link
Member

Fine by me. Do you want me to do it? I have time this morning.

@icemac icemac merged commit bc37809 into master Sep 6, 2023
23 checks passed
@icemac icemac deleted the config-with-zope-product-template-5128b943 branch September 6, 2023 06:31
@icemac
Copy link
Member Author

icemac commented Sep 6, 2023

Fine by me. Do you want me to do it? I have time this morning.

This would be very helpful as I'd would try to do it tomorrow. (Could you in the announcement please also mention the Zope 4.8.9 release fixing the same security issues?)

@dataflake
Copy link
Member

Yes, will do.

@icemac
Copy link
Member Author

icemac commented Sep 7, 2023

@dataflake Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants