Bug 2322709 - pycairo fails to build with Python 3.14: ImportError: cannot import name 'ByteString' from 'typing'
Summary: pycairo fails to build with Python 3.14: ImportError: cannot import name 'Byt...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: pycairo
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2024-10-30 11:29 UTC by Karolina Surma
Modified: 2025-03-19 03:44 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pygobject pycairo issues 388 0 None open test_typing fails with Python 3.14: ImportError: cannot import name 'ByteString' from 'typing' 2024-11-13 09:46:53 UTC

Description Karolina Surma 2024-10-30 11:29:24 UTC
pycairo fails to build with Python 3.14.0a1.

_________________________________ test_typing __________________________________

    def test_typing():
        mod = types.ModuleType("cairo")
        stub = os.path.join(cairo.__path__[0], "__init__.pyi")
        with open(stub, encoding="utf-8") as h:
            code = compile(h.read(), stub, "exec")
>           exec(code, mod.__dict__)

tests/test_typing.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    from __future__ import annotations
    
>   from typing import (Any, BinaryIO, ByteString, Callable, Generic, List, Optional,
                        Sequence, Text, Tuple, TypeVar, Union)
E   ImportError: cannot import name 'ByteString' from 'typing' (/usr/lib64/python3.14/typing.py)

cairo/__init__.pyi:3: ImportError
=========================== short test summary info ============================
FAILED tests/test_typing.py::test_typing - ImportError: cannot import name 'B...
=================== 1 failed, 270 passed, 3 skipped in 0.67s ===================

According to https://docs.python.org/dev/whatsnew/3.14.html#typing

ByteString has been removed from both typing and collections.abc modules.
It had previously raised a DeprecationWarning since Python 3.12.


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/08189191-pycairo/

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

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 Aoife Moloney 2025-02-26 13:14:02 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 2 Fedora Admin user for bugzilla script actions 2025-03-19 03:44:25 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.


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