nornir-automation / nornir

Pluggable multi-threaded framework with inventory management to help operate collections of devices
https://nornir.readthedocs.io/
Apache License 2.0
1.37k stars 233 forks source link

mypy_extensions is only declared as a dev dependency but it directly imported #861

Closed nemith closed 11 months ago

nemith commented 11 months ago

We are failing to run some CI tests as mypy_extensions is missing

/usr/local/lib/python3.8/site-packages/nornir/__init__.py:3: in <module>
    from nornir.init_nornir import InitNornir
/usr/local/lib/python3.8/site-packages/nornir/init_nornir.py:3: in <module>
    from nornir.core import Nornir
/usr/local/lib/python3.8/site-packages/nornir/core/__init__.py:6: in <module>
    from nornir.core.inventory import Inventory
/usr/local/lib/python3.8/site-packages/nornir/core/inventory.py:23: in <module>
    from mypy_extensions import Arg, KwArg
E   ModuleNotFoundError: No module named 'mypy_extensions'

Looking at https://github.com/nornir-automation/nornir/blob/main/pyproject.toml#L43 it is only declaring mypy_extentions as a dev dependency but in this case it is not a dev dependency but

My guess is something else changes in our dep tree that removed mypy_extension but it needs to be explicitly declared as a runtime dependency as it is being directly imported here https://github.com/nornir-automation/nornir/blob/main/nornir/core/inventory.py#L23

nemith commented 11 months ago

Seems like using these are deprecated anyway. https://mypy.readthedocs.io/en/stable/additional_features.html?highlight=mypy_extensions#extended-callable-types

ubaumann commented 11 months ago

Nornir was just released some hours ago but we missed this line: https://github.com/nornir-automation/nornir/blob/325c8ca479b08662a0f963a90d3328a34ef17f2a/nornir/core/inventory.py#L23

I will take a look when I am home. In the meantime you can pin the nornir version or add it to your dependencies

ktbyers commented 11 months ago

Fixed here:

https://github.com/nornir-automation/nornir/pull/867

New Nornir version 3.4.1 released to pypi.