-
-
Notifications
You must be signed in to change notification settings - Fork 255
/
setup.py
200 lines (185 loc) · 6.52 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
"""
===============================================
vidgear library source-code is deployed under the Apache 2.0 License:
Copyright (c) 2019 Abhishek Thakur(@abhiTronix) <abhi.una12@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
===============================================
"""
# import the necessary packages
import json
import platform
import urllib.request
from pkg_resources import parse_version
from distutils.util import convert_path
from setuptools import setup
def test_opencv():
"""
This function is workaround to
test if correct OpenCV Library version has already been installed
on the machine or not. Returns True if previously not installed.
"""
try:
# import OpenCV Binaries
import cv2
# check whether OpenCV Binaries are 3.x+
if parse_version(cv2.__version__) < parse_version("3"):
raise ImportError(
"Incompatible (< 3.0) OpenCV version-{} Installation found on this machine!".format(
parse_version(cv2.__version__)
)
)
except ImportError:
return True
return False
def latest_version(package_name):
"""
Get latest package version from pypi (Hack)
"""
url = "https://pypi.python.org/pypi/%s/json" % (package_name,)
versions = []
try:
response = urllib.request.urlopen(
urllib.request.Request(url),
timeout=1,
)
data = json.load(response)
versions = list(data["releases"].keys())
versions.sort(key=parse_version)
return ">={}".format(versions[-1])
except Exception as e:
if versions:
return ">={}".format(versions[-1])
else:
print(str(e))
return ""
pkg_version = {}
ver_path = convert_path("vidgear/version.py")
with open(ver_path) as ver_file:
exec(ver_file.read(), pkg_version)
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
long_description = long_description.replace(
"(#", "(https://github.com/abhiTronix/vidgear#"
)
# patch for unicodes
long_description = long_description.replace("➶", ">>")
long_description = long_description.replace("©", "(c)")
setup(
name="vidgear",
packages=["vidgear", "vidgear.gears", "vidgear.gears.asyncio"],
version=pkg_version["__version__"],
description="High-performance cross-platform Video Processing Python framework powerpacked with unique trailblazing features.",
license="Apache License 2.0",
author="Abhishek Thakur",
install_requires=[
"cython", # helper for numpy install
"numpy",
"requests",
"colorlog",
"tqdm",
]
+ (["opencv-python"] if test_opencv() else []),
long_description=long_description,
long_description_content_type="text/markdown",
author_email="abhi.una12@gmail.com",
url="https://abhitronix.github.io/vidgear",
extras_require={
# API specific deps
"core": [
"yt_dlp{}".format(latest_version("yt_dlp")),
"pyzmq{}".format(latest_version("pyzmq")),
"Pillow",
"simplejpeg>=1.7.3", # Requires-Python >=3.9 for v1.7.4
"mss{}".format(latest_version("mss")),
"pyscreenshot{}".format(latest_version("pyscreenshot")),
]
+ (
["dxcam{}".format(latest_version("dxcam"))]
if (platform.system() == "Windows") # windows is only supported
else []
),
# API specific + Asyncio deps
"asyncio": [
"yt_dlp{}".format(latest_version("yt_dlp")),
"pyzmq{}".format(latest_version("pyzmq")),
"simplejpeg>=1.7.3", # Requires-Python >=3.9 for v1.7.4
"mss{}".format(latest_version("mss")),
"Pillow",
"pyscreenshot{}".format(latest_version("pyscreenshot")),
"starlette{}".format(latest_version("starlette")),
"jinja2",
"msgpack{}".format(latest_version("msgpack")),
"msgpack_numpy{}".format(latest_version("msgpack_numpy")),
"aiortc{}".format(latest_version("aiortc")),
"uvicorn{}".format(latest_version("uvicorn")),
]
+ (
["dxcam{}".format(latest_version("dxcam"))]
if (platform.system() == "Windows") # windows is only supported
else []
)
+ (
["uvloop{}".format(latest_version("uvloop"))]
if (platform.system() != "Windows") # windows not supported
else []
),
},
keywords=[
"OpenCV",
"multithreading",
"FFmpeg",
"picamera",
"starlette",
"mss",
"pyzmq",
"dxcam",
"aiortc",
"uvicorn",
"uvloop",
"yt-dlp",
"asyncio",
"dash",
"hls",
"Video Processing",
"Video Stabilization",
"Computer Vision",
"Video Streaming",
"raspberrypi",
"YouTube",
"Twitch",
"WebRTC",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Topic :: Multimedia :: Video",
"Topic :: Scientific/Engineering",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
python_requires=">=3.8",
scripts=[],
project_urls={
"Bug Reports": "https://github.com/abhiTronix/vidgear/issues",
"Funding": "https://ko-fi.com/W7W8WTYO",
"Source": "https://github.com/abhiTronix/vidgear",
"Documentation": "https://abhitronix.github.io/vidgear",
"Changelog": "https://abhitronix.github.io/vidgear/latest/changelog/",
},
)