Bug 2336977 - python-dunamai fails to build with Python 3.14: abort: cannot import name 'ByteString' from 'typing' (/usr/lib64/python3.14/typing.py)
Summary: python-dunamai fails to build with Python 3.14: abort: cannot import name 'By...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: mercurial
Version: 42
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Mads Kiilerich
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-01-10 16:30 UTC by Karolina Surma
Modified: 2025-03-22 17:19 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-03-22 17:19:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-01-10 16:30:59 UTC
python-dunamai fails to build with Python 3.14.0a3.

________________________ test__version__from_mercurial _________________________
[gw3] linux -- Python 3.14.0 /usr/bin/python3

tmp_path = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test__version__from_mercurial0')

    @pytest.mark.skipif(shutil.which("hg") is None, reason="Requires Mercurial")
    def test__version__from_mercurial(tmp_path) -> None:
        vcs = tmp_path / "dunamai-hg"
        vcs.mkdir()
        run = make_run_callback(vcs)
        from_vcs = make_from_callback(Version.from_mercurial)
        b = "default"
    
        with chdir(vcs):
            run("hg init")
            assert from_vcs(fresh=True) == Version("0.0.0", distance=0, dirty=False, branch=b)
            assert from_vcs(fresh=True).vcs == Vcs.Mercurial
    
            (vcs / "foo.txt").write_text("hi")
            assert from_vcs(fresh=True) == Version("0.0.0", distance=0, dirty=True, branch=b)
    
            run("hg add .")
>           run('hg commit -m "Initial commit"')

tests/integration/test_dunamai.py:537: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_dunamai.py:56: in inner
    _, out = _run_cmd(command, where=where, codes=[expected_code], env=env)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = 'hg commit -m "Initial commit"'
where = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test__version__from_mercurial0/dunamai-hg')
codes = [0], shell = False, env = None

    def _run_cmd(
        command: str,
        where: Optional[Path],
        codes: Sequence[int] = (0,),
        shell: bool = False,
        env: Optional[dict] = None,
    ) -> Tuple[int, str]:
        result = subprocess.run(
            shlex.split(command),
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            cwd=str(where) if where is not None else None,
            shell=shell,
            env=env,
        )
        output = result.stdout.decode().strip()
        if codes and result.returncode not in codes:
>           raise RuntimeError("The command '{}' returned code {}. Output:\n{}".format(command, result.returncode, output))
E           RuntimeError: The command 'hg commit -m "Initial commit"' returned code 255. Output:
E           no username found, using 'mockbuild' instead
E           abort: cannot import name 'ByteString' from 'typing' (/usr/lib64/python3.14/typing.py)

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08480207-python-dunamai/

For all our attempts to build python-dunamai with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-dunamai/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Sandro 2025-01-11 09:54:09 UTC
The error originates from `mercurial`. There is no mention of `ByteString` in `dunamai` code anywhere. The failing test calls `run('hg commit -m "Initial commit"')`, which then fails with:

abort: cannot import name 'ByteString' from 'typing' (/usr/lib64/python3.14/typing.py)

This can be trivially reproduced in a Python 3.14 mock chroot.

Comment 3 Aoife Moloney 2025-02-26 13:22:31 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.


Note You need to log in before you can comment on or make changes to this bug.