Closed Bug 1923371 Opened 2 years ago Closed 1 year ago

add Python 3.13 support to CI

Categories

(Conduit :: moz-phab, task)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sheehan, Assigned: shtrom)

Details

Attachments

(5 files)

Python 3.13 has been released. We should add support for testing against this Python version to CI.

Assignee: nobody → omehani

Signed-off-by: Olivier Mehani <omehani@mozilla.com>

Signed-off-by: Olivier Mehani <omehani@mozilla.com>

--job is no longer needed for execute on 0.1.30995+77b1f51 (release)

Signed-off-by: Olivier Mehani <omehani@mozilla.com>

CircleCI hasn't released a cimg/python:3.13 image yet.

Building one locally to test...

Ok, I got this to run against a local image build by adding support for 3.13 in https://github.com/CircleCI-Public/cimg-python (https://github.com/shtrom/cimg-python/tree/py3.13, but CircleCI seems to have a bot doing that, and it just hasn't run yet) and tagged as test-python:3.13 (anything with a / in the tag seems to trigger an unconditional refresh from docker hub with the message image is cached as test/python:3.13, but refreshing...).

Ok, there are a few failures with those changes that weren't present on 3.8 or 3.12

$ circleci local execute test_3_13
[...]
tests/test_helpers.py::test_hg_find_repo ERROR                           [ 18%]

Looks like it's in the monkeypatching of subprocess to call out to external binaries.

_____________________ ERROR at setup of test_hg_find_repo ______________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7060c1e06150>
tmp_path = PosixPath('/tmp/pytest-of-circleci/pytest-7/test_hg_find_repo0')

    @pytest.fixture
    def hg_repo_path(monkeypatch, tmp_path):
        """Build a usable HG repository. Return the pathlib.Path to the repo."""
        phabricator_uri = "http://example.test"
        repo_path = tmp_path / "hg-repo"
        repo_path.mkdir()
        monkeypatch.chdir(str(repo_path))
        arcconfig = repo_path / ".arcconfig"
        arcconfig.write_text(json.dumps({"phabricator.uri": phabricator_uri}))
>       hg_out("init")

/home/circleci/repo/tests/conftest.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/circleci/repo/tests/conftest.py:208: in hg_out
    return subprocess.check_output(args, universal_newlines=True, encoding="utf-8")
/home/circleci/.pyenv/versions/3.13.0/lib/python3.13/subprocess.py:472: in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

input = None, capture_output = False, timeout = None, check = True
popenargs = (['hg', 'init'],)
kwargs = {'encoding': 'utf-8', 'stdout': -1, 'universal_newlines': True}
process = <Popen: returncode: 1 args: ['hg', 'init']>, stdout = ''
stderr = None, retcode = 1
[...]
            retcode = process.poll()                                                                                                                                                                                                           
            if check and retcode:                                                                                                                                                                                                              
>               raise CalledProcessError(retcode, process.args,                                                                                                                                                                                
                                         output=stdout, stderr=stderr)                                                                                                                                                                         
E               subprocess.CalledProcessError: Command '['hg', 'init']' returned non-zero exit status 1.                                                                                                                                       
                                                                                            

There's also a couple of errors captured to stderr, not sure if causing the above, or just happening at the same time:

---------------------------- Captured stderr setup -----------------------------                                                                                                                                                               
Traceback (most recent call last):                                                                                                                                                                                                             
  File "/home/circleci/venv/bin/hg", line 59, in <module>                                                                                                                                                                                      
    dispatch.run()                                                                                                                                                                                                                             
    ^^^^^^^^^^^^                                                                                                                                                                                                                               
  File "<frozen importlib.util>", line 209, in __getattribute__                                                                                                                                                                                
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/circleci/venv/lib/python3.13/site-packages/mercurial/dispatch.py", line 20, in <module>
    from .i18n import _                                    
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "/home/circleci/venv/lib/python3.13/site-packages/mercurial/i18n.py", line 14, in <module>
    from typing import (                                   
        List,                                              
    )                                                      
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "/home/circleci/.pyenv/versions/3.13.0/lib/python3.13/typing.py", line 2807, in <module>
    Hashable = _alias(collections.abc.Hashable, 0)  # Not generic.
                      ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 214, in __getattribute__
ValueError: module object for 'collections.abc' substituted in sys.modules during a lazy load
Traceback (most recent call last):
  File "/home/circleci/venv/bin/hg", line 59, in <module>
    dispatch.run()                                         
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/circleci/venv/lib/python3.13/site-packages/mercurial/dispatch.py", line 20, in <module>
    from .i18n import _                                    
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "/home/circleci/venv/lib/python3.13/site-packages/mercurial/i18n.py", line 14, in <module>
    from typing import (                                   
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "/home/circleci/.pyenv/versions/3.13.0/lib/python3.13/typing.py", line 2807, in <module>
    Hashable = _alias(collections.abc.Hashable, 0)  # Not generic.
  File "<frozen importlib.util>", line 214, in __getattribute__
ValueError: module object for 'collections.abc' substituted in sys.modules during a lazy load

There's also a deprecation warning, but it's already present for 3.12, so probably not immediately worrisome

mozphab/sentry.py:13                                                                                                                                                                                                                           
  /home/circleci/repo/mozphab/sentry.py:13: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html                                                                             
    from pkg_resources import get_distribution                                                                                                                                                                                                 
                                                                                                                                                                                                                                               
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED

Ok, this is an issue with Mercurial, which doesn't support Python 3.13 yet.

root@bb079ddfe5ab:/# python -V
Python 3.13.0
root@bb079ddfe5ab:/# hg
Traceback (most recent call last):
  File "/usr/local/bin/hg", line 59, in <module>
    dispatch.run()
    ^^^^^^^^^^^^
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/local/lib/python3.13/site-packages/mercurial/dispatch.py", line 20, in <module>
    from .i18n import _
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "/usr/local/lib/python3.13/site-packages/mercurial/i18n.py", line 14, in <module>
    from typing import (
        List,
    )
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "/usr/local/lib/python3.13/typing.py", line 2807, in <module>
    Hashable = _alias(collections.abc.Hashable, 0)  # Not generic.
                      ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 214, in __getattribute__
ValueError: module object for 'collections.abc' substituted in sys.modules during a lazy load
Traceback (most recent call last):
  File "/usr/local/bin/hg", line 59, in <module>
    dispatch.run()
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/local/lib/python3.13/site-packages/mercurial/dispatch.py", line 20, in <module>
    from .i18n import _
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "/usr/local/lib/python3.13/site-packages/mercurial/i18n.py", line 14, in <module>
    from typing import (
  File "<frozen importlib.util>", line 209, in __getattribute__
  File "/usr/local/lib/python3.13/typing.py", line 2807, in <module>
    Hashable = _alias(collections.abc.Hashable, 0)  # Not generic.
  File "<frozen importlib.util>", line 214, in __getattribute__
ValueError: module object for 'collections.abc' substituted in sys.modules during a lazy load

We also need a CircleCI cimg/python:3.13 image to be available https://github.com/CircleCI-Public/cimg-python/issues/244

Keeping an eye on https://wiki.mercurial-scm.org/ for the next HG release.

Mercurial 6.8.2 has been released with Python 3.13 support https://wiki.mercurial-scm.org/Release6.8

Status: ASSIGNED → RESOLVED
Closed: 2 years ago → 1 year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: