Skip to content

Commit

Permalink
Merge pull request #637 from voxel51/topher/deprecate-python-8
Browse files Browse the repository at this point in the history
it is time to deprecate python 3.8
  • Loading branch information
findtopher authored Sep 24, 2024
2 parents 1036317 + 0020745 commit 6904041
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 62 deletions.
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 5 additions & 15 deletions docs/virtualenv_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@ 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!

## 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
Expand All @@ -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
Expand Down Expand Up @@ -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
```

Expand All @@ -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
```

Expand Down
7 changes: 1 addition & 6 deletions eta/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 3 additions & 19 deletions eta/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -68,6 +51,7 @@
import tempfile
import timeit
import types
import urllib.parse as urlparse
import zipfile as zf

import eta
Expand Down
4 changes: 2 additions & 2 deletions install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,7 +28,6 @@ def finalize_options(self):
"dill",
"future",
"glob2",
"importlib-metadata; python_version<'3.8'",
"jsonlines",
"numpy",
"packaging",
Expand Down Expand Up @@ -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},
)

0 comments on commit 6904041

Please sign in to comment.