From 968c25a08cf6685dc3fd1222a549b82c460db709 Mon Sep 17 00:00:00 2001 From: topher Date: Wed, 18 Sep 2024 17:26:49 -0400 Subject: [PATCH 1/3] it is time to deprecate python 3.8 --- eta/constants.py | 7 +------ eta/core/utils.py | 22 +++------------------- requirements/common.txt | 1 - setup.py | 12 +++--------- 4 files changed, 7 insertions(+), 35 deletions(-) diff --git a/eta/constants.py b/eta/constants.py index 67b2c2c5..5872eb70 100644 --- a/eta/constants.py +++ b/eta/constants.py @@ -17,14 +17,9 @@ # pragma pylint: enable=unused-wildcard-import # pragma pylint: enable=wildcard-import +import importlib.metadata as metadata import os -try: - import importlib.metadata as metadata # Python 3.8 -except ImportError: - import importlib_metadata as metadata # Python < 3.8 - - try: _META = metadata.metadata("voxel51-eta") except metadata.PackageNotFoundError as e: diff --git a/eta/core/utils.py b/eta/core/utils.py index aa15c99d..b13c7e42 100644 --- a/eta/core/utils.py +++ b/eta/core/utils.py @@ -28,25 +28,8 @@ import hashlib import importlib import inspect - -try: - # Although StringIO.StringIO's handling of unicode vs bytes is imperfect, - # we import it here for use when a text-buffer replacement for `print` in - # Python 2.X is required - from StringIO import StringIO as _StringIO # Python 2 -except ImportError: - from io import StringIO as _StringIO # Python 3 - -try: - import urllib.parse as urlparse # Python 3 -except ImportError: - import urlparse # Python 2 - -try: - from importlib import metadata -except ImportError: - import importlib_metadata as metadata - +from importlib import metadata +from io import StringIO as _StringIO # Python 3 import itertools as it import logging import math @@ -68,6 +51,7 @@ import tempfile import timeit import types +import urllib.parse as urlparse import zipfile as zf import eta diff --git a/requirements/common.txt b/requirements/common.txt index ba87eb08..1cc1103d 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -4,7 +4,6 @@ Cython>=0.28.5 # 0.29.28 dill==0.2.7.1 future==0.16.0 glob2==0.6 -importlib-metadata==1.4.0; python_version<"3.8" jsonlines==3.1.0 lxml==4.9.1 numpy>=1.16.3 diff --git a/setup.py b/setup.py index 201fa531..bc6dc436 100644 --- a/setup.py +++ b/setup.py @@ -5,11 +5,8 @@ Copyright 2017-2024, Voxel51, Inc. voxel51.com """ -try: - from importlib import metadata -except ImportError: - import importlib_metadata as metadata +from importlib import metadata import os import re from setuptools import setup, find_packages @@ -31,7 +28,6 @@ def finalize_options(self): "dill", "future", "glob2", - "importlib-metadata; python_version<'3.8'", "jsonlines", "numpy", "packaging", @@ -142,13 +138,11 @@ def get_version(): "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11" ], entry_points={"console_scripts": ["eta=eta.core.cli:main"]}, - python_requires=">=3.6", + python_requires=">=3.9", cmdclass={"bdist_wheel": BdistWheelCustom}, ) From 0da105740e2fd6c14ae16352371612b689950a75 Mon Sep 17 00:00:00 2001 From: topher Date: Thu, 19 Sep 2024 10:48:34 -0400 Subject: [PATCH 2/3] searched for 3.7, failed to search for 3.6 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e863d54..5d15e93e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ infrastructure.** ETA is very portable: - Installable on Mac or Linux -- Supports Python 3.6 or later +- Supports Python 3.9 or later - Supports TensorFlow 1.X and 2.X - Supports OpenCV 2.4+ and OpenCV 3.0+ - Supports CPU-only and GPU-enabled installations From 002074570d6883209f75acb3dd46351b671f3c23 Mon Sep 17 00:00:00 2001 From: topher Date: Thu, 19 Sep 2024 10:53:32 -0400 Subject: [PATCH 3/3] some other 3.6 documentation --- Dockerfile | 12 +++--------- docs/virtualenv_guide.md | 20 +++++--------------- install.bash | 4 ++-- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index f0ec8bec..6be02a89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,13 +29,7 @@ FROM $BASE_IMAGE # Install ETA # # Notes: -# ETA supports Python 2.7.X or Python 3.6.X -# -# `ppa:deadsnakes/ppa` is used in order to install Python 3.6 on Ubuntu 16.04 -# https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get -# -# `https://bootstrap.pypa.io/get-pip.py` is used to install pip on Python 3.6 -# https://askubuntu.com/questions/889535/how-to-install-pip-for-python-3-6-on-ubuntu-16-10 +# ETA supports Python 3.9+ # # numpy==1.16.0 is enforced as a last step because tensorflow requires this # version to function properly, and some commands here seem to mess with the @@ -58,8 +52,8 @@ RUN apt-get update \ git \ curl \ wget \ - python3.6 \ - python3.6-dev \ + python3.9 \ + python3.9-dev \ libcupti-dev \ ffmpeg \ imagemagick \ diff --git a/docs/virtualenv_guide.md b/docs/virtualenv_guide.md index 7a24f64c..f5601b97 100644 --- a/docs/virtualenv_guide.md +++ b/docs/virtualenv_guide.md @@ -6,9 +6,6 @@ environment is highly recommended because it allows you to maintain a separate Python working environment for ETA that operates independently of other packages and Python applications on your machine. -> Note that ETA does not currently support Python 3.7, so you must instead -> have a Python 3.6 distribution installed on your machine - > Note also that it is highly recommended that you do NOT use an Anaconda > Python distribution; if you do, the steps described here may fail... Fear > not, however, as ETA will install all necessary pacakges for you! @@ -16,11 +13,7 @@ packages and Python applications on your machine. ## Creating a virtual environment -* If you want to create a Python 2.7 virtual environment and need a fresh -Python installtion, download and install it from -https://www.python.org/downloads - -* If you want to create a Python 3.6 virtual environment and need a fresh +* If you want to create a Python 3.9 virtual environment and need a fresh Python installation, follow the steps below: ```shell @@ -29,8 +22,8 @@ sudo apt-get update sudo apt-get -y --no-install-recommends install software-properties-common sudo add-apt-repository -y ppa:deadsnakes/ppa sudo apt-get update -sudo apt-get -y --no-install-recommends install python3.6 python3.6-dev -sudo ln -s /usr/bin/python3.6 /usr/local/bin/python +sudo apt-get -y --no-install-recommends install python3.9 python3.9-dev +sudo ln -s /usr/bin/python3.9 /usr/local/bin/python curl https://bootstrap.pypa.io/get-pip.py | sudo python sudo pip install --upgrade pip setuptools sudo pip install virtualenv @@ -61,10 +54,7 @@ cd "${ENV_DIR}" * Make a virtual environment, modifying the python executable path as needed: ```shell -# Example for Python 2.7 -virtualenv -p /usr/local/bin/python eta2 - -# Example for Python 3.6 +# Example for Python 3.9 virtualenv -p /usr/local/bin/python3 eta3 ``` @@ -90,7 +80,7 @@ exit() { To install ETA in a virtual environment, simply activate the environment: ```shell -# Example of activating a Python 3.6 environment created above +# Example of activating a Python 3.9 environment created above eta3 ``` diff --git a/install.bash b/install.bash index 1a4e594b..dfdba0fb 100644 --- a/install.bash +++ b/install.bash @@ -124,10 +124,10 @@ fi # Check Python version MSG "Checking version of 'python' binary" PYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') -if [[ $PYTHON_VERSION == "3.6."* ]] || [[ $PYTHON_VERSION == "2.7."* ]]; then +if [[ $PYTHON_VERSION == "3.9."* ]]; then MSG "Found compatible version: Python ${PYTHON_VERSION}" else - WARN "Python 3.6.X or 2.7.X are recommended, but Python $PYTHON_VERSION was found" + WARN "Python 3.9.X is recommended, but Python $PYTHON_VERSION was found" read -p "Are you sure you want to continue? [y/N] " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then