On 7. 8. 2024 15:34, Luca Vizzarro wrote:
Hi Juraj,
In the past, I have noticed this problem appear only on Python versions
prior to 3.10. Before PEP 604[1] – introduced in Python 3.10 – the pipe
operator was always used as an operator between objects instead of an
alias for Union in the annotations. A quick test verifies this:
Python 3.8.18 (default, Aug 25 2023, 13:20:30)
[GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections import Counter
>>> from typing import TypedDict
>>> class t(TypedDict):
... a: Counter | None
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in t
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
>>>
I have also attempted to build the docs removing this commit on my local
setup (outside of the Poetry shell) and it appears to be working with no
problems.
My local build also works fine, but the problem was found in CI:
https://github.com/ovsrobot/dpdk/actions/runs/10261380458/job/28389032405
I included a script that checks the python version, so the running
version should be at least 3.10. I can't find the actual version
anywhere in the logs, but the environment is Ubuntu22.04 which should
run 3.10.
The TypeError only happens with the Transport from paramiko. This is
likely related to the new feature that I've added in these last
versions: the Python dependencies don't need to be installed. If they're
not found, they're added to the autodoc_mock_imports config option and
basically ignored. CI likely doesn't have these dependencies so I'd say
this is the reason. My local testing (building docs without paramiko)
confirms this.
Best,
Luca
[1] https://peps.python.org/pep-0604/