Skip to content

Commit bf0c581

Browse files
authored
Update requirements to latest versions, change tflite-runtime to pypi install, add tags to setup.py (#33)
1 parent ef812da commit bf0c581

5 files changed

Lines changed: 44 additions & 69 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ venv.bak/
116116
.v37
117117
.v38
118118
.v39
119+
.v310
119120

120121
# Spyder project settings
121122
.spyderproject

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Lobe Python API
22
Code to run exported Lobe models in Python using the TensorFlow, TensorFlow Lite, or ONNX options.
33

4-
Works with Python 3.6, 3.7, 3.8, and 3.9 untested for other versions.
4+
Works with Python 3.7, 3.8, 3.9, and 3.10 untested for other versions. [Note: 3.10 only works with the TensorFlow backend]
55

66
## Install
77
### Backend options with pip
@@ -13,9 +13,8 @@ pip install lobe[all]
1313
# For TensorFlow only
1414
pip install lobe[tf]
1515

16-
# For TensorFlow Lite only -- this requires two steps for the runtime and for lobe (note for Raspberry Pi see our setup script in scripts/lobe-rpi-install.sh)
17-
pip install --index-url https://google-coral.github.io/py-repo/ tflite_runtime
18-
pip install lobe
16+
# For TensorFlow Lite only (note for Raspberry Pi see our setup script in scripts/lobe-rpi-install.sh)
17+
pip install lobe[tflite]
1918

2019
# For ONNX only
2120
pip install lobe[onnx]

RELEASE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Release 0.6.2
2+
___
3+
## Bug Fixes and Other Improvements
4+
* Add support for Python 3.10, drop support for Python 3.6.
5+
* Bump requirements to latest versions.
6+
* Update Raspberry Pi and setup install to latest tensorflow-lite guidance.
7+
8+
19
# Release 0.6.1
210
___
311
## Bug Fixes and Other Improvements

scripts/lobe-rpi-install.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ sudo apt install -y \
1313
libjpeg62-turbo
1414
sudo apt-get install -y git
1515
sudo pip3 install setuptools
16-
# Install TensorFlow Lite Runtime
17-
sudo apt install -y python3-tflite-runtime
18-
# Install lobe-python which can use the tflite backend
19-
sudo pip3 install lobe
16+
# Install lobe-python to use the tflite backend
17+
sudo pip3 install lobe[tflite]

setup.py

Lines changed: 30 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,55 @@
11
from setuptools import setup, find_packages
2-
import sys
32
import pathlib
4-
import platform
53

64
parent = pathlib.Path(__file__).parent
75
# get the readme for use in our long description
86
readme = (parent / "README.md").read_text()
97

10-
python_version = platform.python_version().rsplit('.', maxsplit=1)[0]
11-
12-
mac_v, _, _ = platform.mac_ver()
13-
if mac_v != '':
14-
mac_v_split = mac_v.split('.')
15-
mac_major_version = mac_v_split[0]
16-
mac_minor_version = mac_v_split[1]
17-
mac_version = '.'.join([mac_major_version, mac_minor_version])
18-
else:
19-
mac_major_version = None
20-
mac_version = None
21-
228
requirements = [
23-
"pillow~=8.4.0",
9+
"pillow~=9.0.1",
2410
"requests",
25-
"matplotlib~=3.4.3",
11+
"matplotlib~=3.5.1",
2612
]
27-
tf_req = "tensorflow~=2.5.0;platform_machine!='armv7l'"
28-
onnx_req = "onnxruntime~=1.8.1;platform_machine!='armv7l'"
29-
tflite_req = None
30-
31-
# get the right TF Lite runtime packages based on OS and python version: https://www.tensorflow.org/lite/guide/python#install_just_the_tensorflow_lite_interpreter
32-
tflite_python = None
33-
tflite_platform = None
34-
tflite_machine = None
35-
36-
# get the right python string for the version
37-
if python_version == '3.6':
38-
tflite_python = 'cp36-cp36m'
39-
elif python_version == '3.7':
40-
tflite_python = 'cp37-cp37m'
41-
elif python_version == '3.8':
42-
tflite_python = 'cp38-cp38'
43-
elif python_version == '3.9':
44-
tflite_python = 'cp39-cp39'
45-
46-
# get the right platform and machine strings for the tflite_runtime wheel URL
47-
sys_platform = sys.platform.lower()
48-
machine = platform.machine().lower()
49-
if sys_platform == 'linux':
50-
tflite_platform = sys_platform
51-
tflite_machine = machine
52-
elif sys_platform == 'win32':
53-
tflite_platform = 'win'
54-
tflite_machine = machine
55-
elif sys_platform == 'darwin' and machine == 'x86_64':
56-
if mac_version == '10.15':
57-
tflite_platform = 'macosx_10_15'
58-
elif mac_major_version == '11':
59-
tflite_platform = 'macosx_11_0'
60-
tflite_machine = machine
61-
62-
# add it to the requirements, or print the location to find the version to install
63-
if tflite_python and tflite_platform and tflite_machine:
64-
tflite_req = f"tflite_runtime @ https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-{tflite_python}-{tflite_platform}_{tflite_machine}.whl"
65-
else:
66-
print(
67-
f"Couldn't find tflite_runtime for your platform {sys.platform}, machine {platform.machine()}, python version {python_version}, and mac version {mac_version}. If you are trying to use TensorFlow Lite, please see the install guide for the right version: https://www.tensorflow.org/lite/guide/python#install_just_the_tensorflow_lite_interpreter"
68-
)
13+
tf_req = "tensorflow~=2.8.0 ; platform_machine != 'armv7l'"
14+
onnx_req = "onnxruntime~=1.10.0 ; platform_machine != 'armv7l' and python_version <= '3.9'" # onnxruntime not to 3.10 yet
15+
tflite_req = "tflite-runtime~=2.7.0 ; platform_system == 'Linux' and python_version <= '3.9'" # tflite not to 3.10 yet
6916

7017
setup(
7118
name="lobe",
72-
version="0.6.1",
19+
version="0.6.2",
7320
description="Lobe Python SDK",
7421
long_description=readme,
7522
long_description_content_type="text/markdown",
23+
keywords='lobe ai machine learning',
7624
url="https://github.com/lobe/lobe-python",
7725
license="MIT",
7826
packages=find_packages("src"),
7927
package_dir={"": "src"},
8028
install_requires=requirements,
8129
extras_require={
82-
'all': [tf_req, onnx_req],
30+
'all': [tf_req, onnx_req, tflite_req],
8331
'tf': [tf_req],
8432
'onnx': [onnx_req],
85-
}
33+
'tflite': [tflite_req],
34+
},
35+
python_requires='>=3.7',
36+
classifiers=sorted([
37+
'Development Status :: 4 - Beta',
38+
'Intended Audience :: Developers',
39+
'Intended Audience :: Education',
40+
'Intended Audience :: Science/Research',
41+
'License :: OSI Approved :: MIT License',
42+
'Programming Language :: Python :: 3',
43+
'Programming Language :: Python :: 3.7',
44+
'Programming Language :: Python :: 3.8',
45+
'Programming Language :: Python :: 3.9',
46+
'Programming Language :: Python :: 3.10',
47+
'Programming Language :: Python :: 3 :: Only',
48+
'Topic :: Scientific/Engineering',
49+
'Topic :: Scientific/Engineering :: Mathematics',
50+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
51+
'Topic :: Software Development',
52+
'Topic :: Software Development :: Libraries',
53+
'Topic :: Software Development :: Libraries :: Python Modules',
54+
]),
8655
)

0 commit comments

Comments
 (0)