Bug 1898081

Summary: python-jedi fails to build with Python 3.10: three tests fail [built without tests first]
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-jediAssignee: Lumír Balhar <lbalhar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 35CC: carl, mhroncok, phracek, pviktori, 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: 2021-12-01 13:42:40 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:    
Bug Blocks: 1890881    

Description Miro Hrončok 2020-11-16 10:38:41 UTC
python-jedi fails to build with Python 3.10.0a2.

________________________ test_find_system_environments _________________________

    def test_find_system_environments():
        envs = list(find_system_environments())
>       assert len(envs)
E       assert 0
E        +  where 0 = len([])

test/test_api/test_environment.py:19: AssertionError
______________________ test_completion_param_annotations _______________________

    def test_completion_param_annotations():
        # Need to define this function not directly in Python. Otherwise Jedi is too
        # clever and uses the Python code instead of the signature object.
        code = 'def foo(a: 1, b: str, c: int = 1.0) -> bytes: pass'
        exec(code, locals())
        script = jedi.Interpreter('foo', [locals()])
        c, = script.complete()
        sig, = c.get_signatures()
        a, b, c = sig.params
        assert a.infer() == []
>       assert [d.name for d in b.infer()] == ['str']
E       AssertionError: assert [] == ['str']
E         Right contains one more item: 'str'
E         Use -v to get the full diff

test/test_api/test_interpreter.py:316: AssertionError
__________________ test_compiled_signature_annotation_string ___________________

    def test_compiled_signature_annotation_string():
        import typing
    
        def func(x: typing.Type, y: typing.Union[typing.Type, int]):
            pass
        func.__name__ = 'not_func'
    
        s, = jedi.Interpreter('func()', [locals()]).get_signatures(1, 5)
>       assert s.params[0].description == 'param x: Type'
E       assert "param x: 'typing.Type'" == 'param x: Type'
E         - param x: Type
E         + param x: 'typing.Type'

test/test_inference/test_mixed.py:113: AssertionError
===== 3 failed, 1451 passed, 20 skipped, 2 deselected, 5 xfailed in 42.38s =====





I understand the third failure: typing names/repor have been changed in Python 3.10.

For the first two failures, I have no clue.



For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01756883-python-jedi/

For all our attempts to build python-jedi with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-jedi/

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

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
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 Miro Hrončok 2020-11-18 11:14:55 UTC
Latest upstream commit behaves the same. Bumping the severity here, an entire stack ipython stack depends on it.

Comment 2 Miro Hrončok 2020-12-11 14:45:27 UTC
Petr, could you please take this upstream?

Comment 3 Lumír Balhar 2021-01-12 09:45:05 UTC
Upstream issue created: https://github.com/davidhalter/jedi/issues/1732

Unfortunately, it seems that the fix will be much more complex than just adapting tests to new outputs.

Comment 4 Ben Cotton 2021-02-09 16:11:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 5 Lumír Balhar 2021-04-06 06:31:05 UTC
This is getting complex because there aren't just compatibilities with Python 3.10 but also a need to implement support for the new pattern-matching syntax.

I took this bug in a good faith that I'll be able to move it further or fix the problem entirely but I'm not able to do so.

Comment 6 Lumír Balhar 2021-04-06 06:32:47 UTC
Ha, I forget that I'm the main admin of this package, lol

Comment 7 Miro Hrončok 2021-06-04 20:12:43 UTC
This is a mass-posted update. Sorry if it is not 100% accurate to this bugzilla.


The Python 3.10 rebuild is in progress in a Koji side tag. If you manage to fix the problem, please commit the fix in the rawhide branch, but don't build the package in regular rawhide.

You can either build the package in the side tag, with:

    $ fedpkg build --target=f35-python

Or you can the build and we will eventually build it for you.

Note that the rebuild is still in progress, so not all (build) dependencies of this package might be available right away.

Thanks.

See also https://fedoraproject.org/wiki/Changes/Python3.10

If you have general questions about the rebuild, please use this mailing list thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G47SGOYIQLRDTWGOSLSWERZSSHXDEDH5/

Comment 8 Miro Hrončok 2021-06-07 22:57:43 UTC
The f35-python side tag has been merged to Rawhide. From now on, build as you would normally build.

Comment 9 Lumír Balhar 2021-06-17 06:55:43 UTC
FTR the actual blocker is in the parso project: https://github.com/davidhalter/parso/issues/138

Honestly, it seems that I won't be able to dive into it and come up with some solution. But the discussions upstream are kinda active so hopefully, I won't have to.

Comment 10 Lumír Balhar 2021-06-24 10:20:28 UTC
I've tested ipython with Python 3.10 and there is no real issue caused by incompatible jedi. The only thing is that the new syntax Python 3.10 brings is not highlighted at all.

Comment 11 Lumír Balhar 2021-08-01 08:19:12 UTC
I've just skipped the failing tests so the package builds again in rawhide.

Comment 12 Ben Cotton 2021-08-10 13:47:35 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.