Skip to content

Commit ba6ab51

Browse files
committed
fix(req): update reqs structure
1 parent a76569e commit ba6ab51

File tree

2 files changed

+69
-25
lines changed

2 files changed

+69
-25
lines changed

requirements.txt

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,45 @@ librosa==0.8.1
88
PyYAML==5.4.1
99
Pillow==8.3.2
1010
black==21.7b0
11-
flake8==3.9.2
11+
flake8==3.9.2
12+
sounddevice==0.4.3
13+
14+
# extra=tf2.3
15+
tensorflow~=2.3.0
16+
tensorflow-text~=2.3.0
17+
tensorflow-io~=0.16.0
18+
19+
# extra=tf2.3-gpu
20+
tensorflow-gpu~=2.3.0
21+
tensorflow-text~=2.3.0
22+
tensorflow-io~=0.16.0
23+
24+
# extra=tf2.4
25+
tensorflow~=2.4.0
26+
tensorflow-text~=2.4.0
27+
tensorflow-io~=0.17.0
28+
29+
# extra=tf2.4-gpu
30+
tensorflow-gpu~=2.4.0
31+
tensorflow-text~=2.4.0
32+
tensorflow-io~=0.17.0
33+
34+
# extra=tf2.5
35+
tensorflow~=2.5.0
36+
tensorflow-text~=2.5.0
37+
tensorflow-io~=0.18.0
38+
39+
# extra=tf2.5-gpu
40+
tensorflow-gpu~=2.5.0
41+
tensorflow-text~=2.5.0
42+
tensorflow-io~=0.18.0
43+
44+
# extra=tf2.6
45+
tensorflow~=2.6.0
46+
tensorflow-text~=2.6.0
47+
tensorflow-io~=0.20.0
48+
49+
# extra=tf2.6-gpu
50+
tensorflow-gpu~=2.6.0
51+
tensorflow-text~=2.6.0
52+
tensorflow-io~=0.20.0

setup.py

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,54 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
15+
from setuptools import find_packages, setup
16+
from typing import List
17+
from collections import defaultdict
1618

17-
import setuptools
1819

19-
readme_path = os.path.join(os.path.dirname(__file__), "README.md")
20+
def parse_requirements(lines: List[str]):
21+
extras_requires = defaultdict(list)
22+
extra = "requires"
23+
for line in lines:
24+
line = line.strip()
25+
if line.startswith("# extra="):
26+
extra = line.split("=")[1].strip()
27+
continue
28+
if line and line[0] != "#":
29+
lib_package = line.split("#")[0].strip() # split comments
30+
extras_requires[extra].append(lib_package)
31+
install_requires = extras_requires.pop("requires")
32+
return install_requires, extras_requires
2033

21-
with open(readme_path, "r", encoding="utf-8") as fh:
22-
long_description = fh.read()
2334

24-
requirements_path = os.path.join(os.path.dirname(__file__), "requirements.txt")
35+
with open("requirements.txt", "r", encoding="utf-8") as fr:
36+
install_requires, extras_requires = parse_requirements(fr.readlines())
2537

26-
with open(requirements_path, "r") as fr:
27-
requirements = fr.read().splitlines()
28-
print(requirements)
38+
with open("README.md", "r", encoding="utf-8") as fh:
39+
long_description = fh.read()
2940

3041

31-
setuptools.setup(
42+
setup(
3243
name="TensorFlowASR",
33-
version="1.0.2",
44+
version="1.0.3",
3445
author="Huy Le Nguyen",
3546
author_email="[email protected]",
3647
description="Almost State-of-the-art Automatic Speech Recognition using Tensorflow 2",
3748
long_description=long_description,
3849
long_description_content_type="text/markdown",
3950
url="https://github.com/TensorSpeech/TensorFlowASR",
40-
packages=setuptools.find_packages(include=["tensorflow_asr*"]),
41-
install_requires=requirements,
42-
extras_require={
43-
"tf2.3": ["tensorflow~=2.3.0", "tensorflow-text~=2.3.0", "tensorflow-io~=0.16.0"],
44-
"tf2.3-gpu": ["tensorflow-gpu~=2.3.0", "tensorflow-text~=2.3.0", "tensorflow-io~=0.16.0"],
45-
"tf2.4": ["tensorflow~=2.4.0", "tensorflow-text~=2.4.0", "tensorflow-io~=0.17.0"],
46-
"tf2.4-gpu": ["tensorflow-gpu~=2.4.0", "tensorflow-text~=2.4.0", "tensorflow-io~=0.17.0"],
47-
"tf2.5": ["tensorflow~=2.5.0", "tensorflow-text~=2.5.0", "tensorflow-io~=0.18.0"],
48-
"tf2.5-gpu": ["tensorflow-gpu~=2.5.0", "tensorflow-text~=2.5.0", "tensorflow-io~=0.18.0"],
49-
"tf2.6": ["tensorflow~=2.6.0", "tensorflow-text~=2.6.0rc0", "tensorflow-io~=0.20.0"],
50-
"tf2.6-gpu": ["tensorflow-gpu~=2.6.0", "tensorflow-text~=2.6.0rc0", "tensorflow-io~=0.20.0"],
51-
},
51+
packages=find_packages(include=("tensorflow_asr", "tensorflow_asr.*")),
52+
install_requires=install_requires,
53+
extras_require=extras_requires,
5254
classifiers=[
5355
"Programming Language :: Python :: 3.6",
5456
"Programming Language :: Python :: 3.7",
5557
"Programming Language :: Python :: 3.8",
58+
"Programming Language :: Python :: 3.9",
5659
"Intended Audience :: Science/Research",
5760
"Operating System :: POSIX :: Linux",
5861
"License :: OSI Approved :: Apache Software License",
5962
"Topic :: Software Development :: Libraries :: Python Modules",
6063
],
61-
python_requires=">=3.6",
64+
python_requires=">=3.6, <4",
6265
)

0 commit comments

Comments
 (0)