-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path__init__.py
More file actions
70 lines (55 loc) · 2.1 KB
/
__init__.py
File metadata and controls
70 lines (55 loc) · 2.1 KB
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
import logging
import os
import sys
__version__ = "4.5.1"
os.environ.update({"sa_version": __version__})
sys.path.append(os.path.split(os.path.realpath(__file__))[0])
import requests
from lib.core import enums
from lib.core.utils import parse_version
from lib.core import PACKAGE_VERSION_UPGRADE
from lib.core import PACKAGE_VERSION_INFO_MESSAGE
from lib.core import PACKAGE_VERSION_MAJOR_UPGRADE
from lib.core.exceptions import AppException
from lib.core.exceptions import FileChangedError
from superannotate.lib.app.input_converters import convert_project_type
from superannotate.lib.app.input_converters import export_annotation
from superannotate.lib.app.input_converters import import_annotation
from superannotate.lib.app.interface.sdk_interface import SAClient
from superannotate.lib.app.interface.sdk_interface import ItemContext
SESSIONS = {}
__all__ = [
"__version__",
"SAClient",
"ItemContext",
# Utils
"enums",
"AppException",
"FileChangedError",
"import_annotation",
"export_annotation",
"convert_project_type",
]
__author__ = "Superannotate"
logging.getLogger("botocore").setLevel(logging.CRITICAL)
def log_version_info():
logging.StreamHandler(sys.stdout)
local_version = parse_version(__version__)
if local_version.is_prerelease:
logging.info(PACKAGE_VERSION_INFO_MESSAGE.format(__version__))
req = requests.get("https://pypi.org/pypi/superannotate/json")
if req.ok:
releases = req.json().get("releases", [])
pip_version = parse_version("0")
for release in releases:
ver = parse_version(release)
if not ver.is_prerelease or local_version.is_prerelease:
pip_version = max(pip_version, ver)
if pip_version.major > local_version.major:
logging.warning(
PACKAGE_VERSION_MAJOR_UPGRADE.format(local_version, pip_version)
)
elif pip_version > local_version:
logging.warning(PACKAGE_VERSION_UPGRADE.format(local_version, pip_version))
if os.environ.get("SA_VERSION_CHECK", "True").lower() != "false":
log_version_info()