Skip to content

Commit e7f4d57

Browse files
committed
simplified init
1 parent fa2f0c0 commit e7f4d57

File tree

2 files changed

+27
-114
lines changed

2 files changed

+27
-114
lines changed
Lines changed: 1 addition & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,4 @@
1-
import warnings
2-
from platform import python_version
3-
from typing import List, Tuple
4-
51
import nest_asyncio
6-
from osparc_client import (
7-
ApiException,
8-
ApiKeyError,
9-
ApiTypeError,
10-
ApiValueError,
11-
BodyUploadFileV0FilesContentPut,
12-
Configuration,
13-
CreditsApi,
14-
ErrorGet,
15-
File,
16-
Groups,
17-
HTTPValidationError,
18-
Job,
19-
JobInputs,
20-
JobOutputs,
21-
JobStatus,
22-
Meta,
23-
MetaApi,
24-
OnePageSolverPort,
25-
OpenApiException,
26-
Profile,
27-
ProfileUpdate,
28-
Solver,
29-
SolverPort,
30-
UserRoleEnum,
31-
UsersApi,
32-
UsersGroup,
33-
ValidationError,
34-
__version__,
35-
)
36-
from osparc_client import RunningState as TaskStates
37-
from packaging.version import Version
38-
39-
from ._api_client import ApiClient
40-
from ._exceptions import RequestError, VisibleDeprecationWarning
41-
from ._files_api import FilesApi
42-
from ._info import openapi
43-
from ._solvers_api import SolversApi
44-
from ._studies_api import StudiesApi
45-
from ._utils import dev_features_enabled
46-
47-
_PYTHON_VERSION_RETIRED = Version("3.8.0")
48-
_PYTHON_VERSION_DEPRECATED = Version("3.8.0")
49-
assert _PYTHON_VERSION_RETIRED <= _PYTHON_VERSION_DEPRECATED # nosec
50-
51-
if Version(python_version()) < _PYTHON_VERSION_RETIRED:
52-
error_msg: str = (
53-
f"Python version {python_version()} is retired for this version of osparc. "
54-
f"Please use Python version {_PYTHON_VERSION_DEPRECATED}."
55-
)
56-
raise RuntimeError(error_msg)
57-
58-
if Version(python_version()) < _PYTHON_VERSION_DEPRECATED:
59-
warning_msg: str = (
60-
f"Python {python_version()} is deprecated. "
61-
"Please upgrade to "
62-
f"Python version >= {_PYTHON_VERSION_DEPRECATED}."
63-
)
64-
warnings.warn(warning_msg, VisibleDeprecationWarning)
65-
2+
from ._version import __version__ as __version__
663

674
nest_asyncio.apply() # allow to run coroutines via asyncio.run(coro)
68-
69-
dev_features: List[str] = []
70-
if dev_features_enabled():
71-
dev_features = [
72-
"JobMetadata",
73-
"JobMetadataUpdate",
74-
"Links",
75-
"OnePageStudyPort",
76-
"PaginationGenerator",
77-
"Study",
78-
"StudyPort",
79-
]
80-
81-
__all__: Tuple[str, ...] = tuple(dev_features) + (
82-
"__version__",
83-
"ApiClient",
84-
"ApiException",
85-
"ApiKeyError",
86-
"ApiTypeError",
87-
"ApiValueError",
88-
"BodyUploadFileV0FilesContentPut",
89-
"Configuration",
90-
"CreditsApi",
91-
"ErrorGet",
92-
"File",
93-
"FilesApi",
94-
"Groups",
95-
"HTTPValidationError",
96-
"Job",
97-
"JobInputs",
98-
"JobOutputs",
99-
"JobStatus",
100-
"Meta",
101-
"MetaApi",
102-
"OnePageSolverPort",
103-
"openapi",
104-
"OpenApiException",
105-
"Profile",
106-
"ProfileUpdate",
107-
"RequestError",
108-
"Solver",
109-
"SolverPort",
110-
"SolversApi",
111-
"StudiesApi",
112-
"TaskStates",
113-
"UserRoleEnum",
114-
"UsersApi",
115-
"UsersGroup",
116-
"ValidationError",
117-
) # type: ignore
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import warnings
2+
from platform import python_version
3+
from packaging.version import Version
4+
from ._exceptions import VisibleDeprecationWarning
5+
6+
from osparc_client import __version__ as __version__
7+
8+
9+
_PYTHON_VERSION_RETIRED = Version("3.8.0")
10+
_PYTHON_VERSION_DEPRECATED = Version("3.8.0")
11+
assert _PYTHON_VERSION_RETIRED <= _PYTHON_VERSION_DEPRECATED # nosec
12+
13+
if Version(python_version()) < _PYTHON_VERSION_RETIRED:
14+
error_msg: str = (
15+
f"Python version {python_version()} is retired for this version of osparc. "
16+
f"Please use Python version {_PYTHON_VERSION_DEPRECATED}."
17+
)
18+
raise RuntimeError(error_msg)
19+
20+
if Version(python_version()) < _PYTHON_VERSION_DEPRECATED:
21+
warning_msg: str = (
22+
f"Python {python_version()} is deprecated. "
23+
"Please upgrade to "
24+
f"Python version >= {_PYTHON_VERSION_DEPRECATED}."
25+
)
26+
warnings.warn(warning_msg, VisibleDeprecationWarning)

0 commit comments

Comments
 (0)