kr8s-org / kr8s

A batteries-included Python client library for Kubernetes that feels familiar for folks who already know how to use kubectl
https://kr8s.org
BSD 3-Clause "New" or "Revised" License
799 stars 43 forks source link

Python version requirement is undocumented and 3.8 support is broken #459

Closed matthiasvegh closed 1 month ago

matthiasvegh commented 1 month ago

Which project are you reporting a bug for?

kr8s

What happened?

#!/usr/bin/env python3
import kr8s.asyncio

def main():
    pass

if __name__ == '__main__':
    main()

Fails on my machine with the following backtrace:

Traceback (most recent call last):                                                                                                                                                                                                                                                
  File "./test.py", line 3, in <module>                                                                                                                                                                                                                                 
    import kr8s.asyncio                                                                                                                                                                                                                                                           
  File "/usr/local/lib/python3.8/dist-packages/kr8s/__init__.py", line 6, in <module>                                                                                                                                                                                             
    from . import asyncio, objects, portforward                                                                                                                                                                                                                                   
  File "/usr/local/lib/python3.8/dist-packages/kr8s/asyncio/__init__.py", line 3, in <module>                                                                                                                                                                                     
    from kr8s._api import Api                                                                                                                                                                                                                                                     
  File "/usr/local/lib/python3.8/dist-packages/kr8s/_api.py", line 30, in <module>                                                                                                                                                                                                
    from ._auth import KubeAuth                                                                                                                                                                                                                                                   
  File "/usr/local/lib/python3.8/dist-packages/kr8s/_auth.py", line 14, in <module>                                                                                                                                                                                               
    from ._config import KubeConfigSet                                                                                                                                                                                                                                            
  File "/usr/local/lib/python3.8/dist-packages/kr8s/_config.py", line 12, in <module>                                                                                                                                                                                             
    from kr8s._types import PathType                                                                                                                                                                                                                                              
  File "/usr/local/lib/python3.8/dist-packages/kr8s/_types.py", line 6, in <module>
    PathType = Union[str, PathLike[str]]
TypeError: 'ABCMeta' object is not subscriptable

I assume that a newer Python version would do the trick, but I'm not seeing a minimum required python other than python3 of course. Reverting to 0.15.0 resolves this issue.

Anything else?

Python version: Python 3.8.10 kr8s versions where problem noticed: 0.17.0, 0.16.2 kr8s source: pip3 install kr8s

jacobtomlinson commented 1 month ago

Really appreciate the minimal reproducer.

The Python minimum version is set in the pyproject.toml. This is a relatively common place to configure this, but perhaps we want to update the README badges with more specific information.

https://github.com/kr8s-org/kr8s/blob/ffe499102bf4309930bc9ba6a7b5bcb682481b82/pyproject.toml#L9

We also run CI against Python 3.8 and it is passing, so I'm surprised to see this. Perhaps we have a gap in our test coverage somewhere that isn't highlighting this?

jacobtomlinson commented 1 month ago

I just release v0.17.1 which should restore support for Python 3.8.