qctrl-workflow-client 2.2.2__tar.gz → 2.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/PKG-INFO +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/pyproject.toml +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/__init__.py +2 -2
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/defaults.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/functions.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/globals.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/products.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/router/__init__.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/router/api.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/router/base.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/router/local.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/settings.py +1 -1
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/qctrlworkflowclient/utils.py +67 -30
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/LICENSE +0 -0
- {qctrl_workflow_client-2.2.2 → qctrl_workflow_client-2.3.0}/README.md +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2024 Q-CTRL. All rights reserved.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Q-CTRL Terms of service (the "License"). Unauthorized
|
|
4
4
|
# copying or use of this file, via any medium, is strictly prohibited.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS. See the
|
|
12
12
|
# License for the specific language.
|
|
13
13
|
|
|
14
|
-
__version__ = "2.
|
|
14
|
+
__version__ = "2.3.0"
|
|
15
15
|
|
|
16
16
|
from .defaults import (
|
|
17
17
|
get_authenticated_client_for_product,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2024 Q-CTRL. All rights reserved.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Q-CTRL Terms of service (the "License"). Unauthorized
|
|
4
4
|
# copying or use of this file, via any medium, is strictly prohibited.
|
|
@@ -19,6 +19,7 @@ from importlib.metadata import (
|
|
|
19
19
|
version,
|
|
20
20
|
)
|
|
21
21
|
from pathlib import Path
|
|
22
|
+
from types import ModuleType
|
|
22
23
|
from typing import Optional
|
|
23
24
|
|
|
24
25
|
import requests
|
|
@@ -96,35 +97,8 @@ def package_versions_table(package_names: list[str]) -> str:
|
|
|
96
97
|
A string containing the Markdown-formatted table.
|
|
97
98
|
"""
|
|
98
99
|
|
|
99
|
-
# packages_distributions returns a map between the top-level module names and package names.
|
|
100
|
-
# However, it doesn't understand packages installed in editable mode,
|
|
101
|
-
# which are handled in _get_package_name.
|
|
102
|
-
_package_names_mapping = packages_distributions()
|
|
103
|
-
|
|
104
|
-
def _get_package_name(module):
|
|
105
|
-
if module.__name__ in _package_names_mapping:
|
|
106
|
-
return _package_names_mapping[module.__name__][0]
|
|
107
|
-
|
|
108
|
-
# The package is in editable mode: look in pyproject.toml to get the package name.
|
|
109
|
-
with open(
|
|
110
|
-
Path.joinpath(Path(module.__path__[0]).parent, "pyproject.toml"), "rb"
|
|
111
|
-
) as file:
|
|
112
|
-
config = tomli.load(file)
|
|
113
|
-
return config["tool"]["poetry"]["name"]
|
|
114
|
-
|
|
115
|
-
python_version = (
|
|
116
|
-
f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
|
|
117
|
-
)
|
|
118
|
-
|
|
119
100
|
# List containing the items in the different rows.
|
|
120
|
-
table_items =
|
|
121
|
-
(
|
|
122
|
-
_get_package_name(sys.modules[module_name]),
|
|
123
|
-
sys.modules[module_name].__version__,
|
|
124
|
-
)
|
|
125
|
-
for module_name in package_names
|
|
126
|
-
if module_name in sys.modules
|
|
127
|
-
]
|
|
101
|
+
table_items = get_package_versions(package_names=package_names)
|
|
128
102
|
|
|
129
103
|
# Widths of the table columns.
|
|
130
104
|
package_width = max(max(len(item[0]) for item in table_items), 7)
|
|
@@ -134,7 +108,6 @@ def package_versions_table(package_names: list[str]) -> str:
|
|
|
134
108
|
table_items = [
|
|
135
109
|
("Package", "Version"),
|
|
136
110
|
("-" * package_width, "-" * version_width),
|
|
137
|
-
("Python", python_version),
|
|
138
111
|
] + table_items
|
|
139
112
|
|
|
140
113
|
# Build table.
|
|
@@ -144,3 +117,67 @@ def package_versions_table(package_names: list[str]) -> str:
|
|
|
144
117
|
for name, version_ in table_items
|
|
145
118
|
]
|
|
146
119
|
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _get_package_name(module: ModuleType) -> str:
|
|
123
|
+
"""
|
|
124
|
+
Get package names from top level module names.
|
|
125
|
+
|
|
126
|
+
Parameters
|
|
127
|
+
----------
|
|
128
|
+
module : ModuleType
|
|
129
|
+
The module name to get package names from.
|
|
130
|
+
|
|
131
|
+
Returns
|
|
132
|
+
-------
|
|
133
|
+
str
|
|
134
|
+
The package name.
|
|
135
|
+
|
|
136
|
+
Notes
|
|
137
|
+
-----
|
|
138
|
+
packages_distributions returns a map between the top-level module names and package names.
|
|
139
|
+
However, it doesn't understand packages installed in editable mode,
|
|
140
|
+
which are handled in get_package_name.
|
|
141
|
+
"""
|
|
142
|
+
_package_names_mapping = packages_distributions()
|
|
143
|
+
if module.__name__ in _package_names_mapping:
|
|
144
|
+
return _package_names_mapping[module.__name__][0]
|
|
145
|
+
|
|
146
|
+
# The package is in editable mode: look in pyproject.toml to get the package name.
|
|
147
|
+
with open(
|
|
148
|
+
Path.joinpath(Path(module.__path__[0]).parent, "pyproject.toml"), "rb"
|
|
149
|
+
) as file:
|
|
150
|
+
config = tomli.load(file)
|
|
151
|
+
return config["tool"]["poetry"]["name"]
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def get_package_versions(package_names: list[str]) -> list[tuple[str, str]]:
|
|
155
|
+
"""
|
|
156
|
+
Get the package versions for the list of packages provided.
|
|
157
|
+
|
|
158
|
+
Parameters
|
|
159
|
+
----------
|
|
160
|
+
package_names : list[str]
|
|
161
|
+
The list of package names
|
|
162
|
+
|
|
163
|
+
Returns
|
|
164
|
+
-------
|
|
165
|
+
list[tuple[str, str]]
|
|
166
|
+
The package name and package version.
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
package_versions = [
|
|
170
|
+
(
|
|
171
|
+
_get_package_name(sys.modules[module_name]),
|
|
172
|
+
sys.modules[module_name].__version__,
|
|
173
|
+
)
|
|
174
|
+
for module_name in package_names
|
|
175
|
+
if module_name in sys.modules
|
|
176
|
+
]
|
|
177
|
+
package_versions = [
|
|
178
|
+
(
|
|
179
|
+
"Python",
|
|
180
|
+
f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
|
|
181
|
+
)
|
|
182
|
+
] + package_versions
|
|
183
|
+
return package_versions
|
|
File without changes
|
|
File without changes
|