Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Python2 support dropped but installation works #1502

@jonasdlindner

Description

@jonasdlindner

What happened (please include outputs or screenshots):
I have accidentally installed the git-Master-Branch with Python2 with these commands:

git clone --recursive https://github.com/kubernetes-client/python.git
cd python
python setup.py install

Everything works fine, but Python2 support is dropped (#1468)

What you expected to happen:
I expect an error Message like:

  File "setup.py", line 30, in <module>
    raise RuntimeError("kubernetes-client " + CLIENT_VERSION + " requires Python 3.6+")
RuntimeError: kubernetes-client 18.0.0-snapshot requires Python 3.6+

How to reproduce it (as minimally and precisely as possible):
See in "What happened".
You may have to use python2 setup.py install if python --v is not 2

Anything else we need to know?:
A possible fix in setup.py would be

import sys

from setuptools import setup

# Do not edit these constants. They will be updated automatically
# by scripts/update-client.sh.
CLIENT_VERSION = "18.0.0-snapshot"
PACKAGE_NAME = "kubernetes"
DEVELOPMENT_STATUS = "3 - Alpha"

# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

if sys.version_info < (3, 6):
    raise RuntimeError("kubernetesclient " + CLIENT_VERSION + " requires Python 3.6+")

There is also some Python2 compatibility code in the python/ and python-base repo
For example:

Environment:

  • Kubernetes version (kubectl version):
    v1.19.0
  • OS (e.g., MacOS 10.13.6):
    Fedora 29 (Workstation Edition)
  • Python version (python --version)
    Python 2.7.17
  • Python client version (pip list | grep kubernetes)
    18.0.0-snapshot

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions