Bug 2026771

Summary: python-jwcrypto fails to build with Python 3.11: ImportError: cannot import name 'formatargspec' from 'inspect'
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-jwcryptoAssignee: Simo Sorce <ssorce>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: cheimes, frenaud, mhroncok, puiterwijk, ssorce, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-03 08:57:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2022393    
Bug Blocks: 2016048    

Description Tomáš Hrnčiar 2021-11-25 19:02:41 UTC
python-jwcrypto fails to build with Python 3.11.0a2.

==================================== ERRORS ====================================
_________________ ERROR collecting jwcrypto/tests-cookbook.py __________________
ImportError while importing test module '/builddir/build/BUILD/jwcrypto-0.9.1/jwcrypto/tests-cookbook.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
jwcrypto/tests-cookbook.py:5: in <module>
    from jwcrypto import jwe
jwcrypto/jwe.py:10: in <module>
    from jwcrypto.jwa import JWA
jwcrypto/jwa.py:29: in <module>
    from jwcrypto.jwk import JWK
jwcrypto/jwk.py:14: in <module>
    from deprecated import deprecated
/usr/lib/python3.11/site-packages/deprecated/__init__.py:15: in <module>
    from deprecated.classic import deprecated
/usr/lib/python3.11/site-packages/deprecated/classic.py:15: in <module>
    import wrapt
/usr/lib64/python3.11/site-packages/wrapt/__init__.py:10: in <module>
    from .decorators import (adapter_factory, AdapterFactory, decorator,
/usr/lib64/python3.11/site-packages/wrapt/decorators.py:34: in <module>
    from inspect import ismethod, isclass, formatargspec
E   ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)
______________________ ERROR collecting jwcrypto/tests.py ______________________
ImportError while importing test module '/builddir/build/BUILD/jwcrypto-0.9.1/jwcrypto/tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
jwcrypto/tests.py:12: in <module>
    from jwcrypto import jwa
jwcrypto/jwa.py:29: in <module>
    from jwcrypto.jwk import JWK
jwcrypto/jwk.py:14: in <module>
    from deprecated import deprecated
/usr/lib/python3.11/site-packages/deprecated/__init__.py:15: in <module>
    from deprecated.classic import deprecated
/usr/lib/python3.11/site-packages/deprecated/classic.py:15: in <module>
    import wrapt
/usr/lib64/python3.11/site-packages/wrapt/__init__.py:10: in <module>
    from .decorators import (adapter_factory, AdapterFactory, decorator,
/usr/lib64/python3.11/site-packages/wrapt/decorators.py:34: in <module>
    from inspect import ismethod, isclass, formatargspec
E   ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)
=========================== short test summary info ============================
ERROR jwcrypto/tests-cookbook.py
ERROR jwcrypto/tests.py
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 2 errors in 0.27s ===============================

Removed from the inspect module:
    the getargspec function, deprecated since Python 3.0; use inspect.signature() or inspect.getfullargspec() instead.
    the formatargspec function, deprecated since Python 3.5; use the inspect.signature() function and Signature object directly.
    the undocumented Signature.from_callable and Signature.from_function functions, deprecated since Python 3.5; use the Signature.from_callable() method instead.

(Contributed by Hugo van Kemenade in bpo-45320.)

https://bugs.python.org/issue45320
https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/02988820-python-jwcrypto/

For all our attempts to build python-jwcrypto with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-jwcrypto/

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.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
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 Christian Heimes 2021-11-25 19:33:26 UTC
The issue will get fixed automatically once a new version of wrapt is available, see rhbz#2022393

Comment 2 Ben Cotton 2022-02-08 21:25:21 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 3 Florence Blanc-Renaud 2022-05-03 08:34:54 UTC
Tomáš,
according to https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-jwcrypto/ it seems that the issue has been fixed with the update of python-wrapt on rawhide. Can we close this BZ as a duplicate or is there any work needed on f36?

Comment 4 Tomáš Hrnčiar 2022-05-03 08:57:06 UTC
Yes, you are correct. Thank you, I am closing this.