iris-pex-embedded-python 4.0.1b8__py3-none-any.whl → 4.0.2b1__py3-none-any.whl

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.
iop/migration/utils.py CHANGED
@@ -186,6 +186,69 @@ def _get_python_path() -> str:
186
186
  return ""
187
187
 
188
188
 
189
+ def _migration_namespace_hint() -> str:
190
+ namespace = os.environ.get("IRISNAMESPACE") or os.environ.get("IOP_NAMESPACE")
191
+ if namespace:
192
+ return f"namespace {namespace!r}"
193
+ return "the target namespace"
194
+
195
+
196
+ def _looks_like_missing_iris_class_error(exc: RuntimeError) -> bool:
197
+ message = str(exc).lower()
198
+ return "error finding class" in message or "iop.utils" in message
199
+
200
+
201
+ def _format_register_component_error(
202
+ exc: RuntimeError,
203
+ *,
204
+ module: str,
205
+ classname: str,
206
+ path: str,
207
+ iris_classname: str,
208
+ ) -> str:
209
+ namespace_hint = _migration_namespace_hint()
210
+ lines = [
211
+ (
212
+ f"Could not register IRIS proxy class {iris_classname!r} "
213
+ f"for Python component {module}.{classname}."
214
+ )
215
+ ]
216
+
217
+ if _looks_like_missing_iris_class_error(exc):
218
+ lines.extend(
219
+ [
220
+ "",
221
+ "IRIS could not find a class required during component registration.",
222
+ (
223
+ "Most often this means the IoP support classes "
224
+ f"(`IOP.Utils`, `IOP.BusinessService`, etc.) are not loaded in "
225
+ f"{namespace_hint} yet, or migration ran before `iop --init` "
226
+ "completed."
227
+ ),
228
+ "",
229
+ "Fix:",
230
+ f" 1. Run `iop --init` in {namespace_hint}.",
231
+ " 2. Re-run `iop --migrate <settings.py>`.",
232
+ (
233
+ " 3. In containers, wait for IRIS with "
234
+ "`/usr/irissys/dev/Container/waitReady.sh` before `iop --init`."
235
+ ),
236
+ ]
237
+ )
238
+
239
+ lines.extend(
240
+ [
241
+ "",
242
+ "Registration details:",
243
+ f" IRIS proxy class: {iris_classname}",
244
+ f" Python component: {module}.{classname}",
245
+ f" Python class path: {path}",
246
+ f" Original IRIS error: {exc}",
247
+ ]
248
+ )
249
+ return "\n".join(lines)
250
+
251
+
189
252
  def register_component(
190
253
  module: str,
191
254
  classname: str,
@@ -228,10 +291,13 @@ def register_component(
228
291
  )
229
292
  except RuntimeError as e:
230
293
  raise RuntimeError(
231
- "Could not register component "
232
- f"{iris_classname} from {module}.{classname}. "
233
- "If IRIS reports that IOP.Utils is missing, initialize the IRIS "
234
- f"support classes with `iop --init`. Original IRIS error: {e}"
294
+ _format_register_component_error(
295
+ e,
296
+ module=module,
297
+ classname=classname,
298
+ path=path,
299
+ iris_classname=iris_classname,
300
+ )
235
301
  ) from e
236
302
 
237
303
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iris_pex_embedded_python
3
- Version: 4.0.1b8
3
+ Version: 4.0.2b1
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -62,7 +62,7 @@ iop/migration/__init__.py,sha256=wp-RvjLKYW_Pi2AJLfiWe1bACxENzEgjXtP9UMNiSVY,36
62
62
  iop/migration/io.py,sha256=hAehtApFZFgGzjzgwBmDMxdA1xoRhE-okOcEzvgFdQ4,1822
63
63
  iop/migration/manifest.py,sha256=Bs4eC1_i-ZnovlgSW9FKu5WBwy_6Zwy5ZAcsi5A1szU,19351
64
64
  iop/migration/plans.py,sha256=5kx3aqQiPDJ3F8hU9pp9_mOO1_N6GA0Ps7--G1Iv6z8,2549
65
- iop/migration/utils.py,sha256=pOojLPMZes05KXrGN2ap45ffppP5Z4tS4bjJ0gSD5Oc,38183
65
+ iop/migration/utils.py,sha256=2lcM3w2cpgw4ijYRprKVBY8zhsp_ySmnPdhuo7WCmXM,40116
66
66
  iop/production/__init__.py,sha256=95VmJgC3lWtHpUJijLqyKKxFZa65OcRni8803kb4aHE,2148
67
67
  iop/production/actions.py,sha256=TLVAjPTPq21oLj9c-IG10qMNJ2hvPzueviMy_c1a0ZU,17199
68
68
  iop/production/common.py,sha256=L2QyvE2nC1J333sbebYx_6dyoaFL-89ouMO3Kfe4-D8,3465
@@ -92,9 +92,9 @@ iop/runtime/remote/director.py,sha256=bkie751GrYLgGs7ApRCowHpSnJA8KupxCOrFDQmjyO
92
92
  iop/runtime/remote/migration.py,sha256=Iboz-Ye7i9xif9bn433GazCF-gtD-HJW3wiUwWS5P6w,1831
93
93
  iop/runtime/remote/settings.py,sha256=P1Hsgld5o57HpSZgPVZzobyjlUmxJj6bstiWvR0JXnc,2144
94
94
  iop/runtime/remote/setup.py,sha256=Tr80F3JJTy7oSUso2jyx0iA_KZayd4MYt9vL0BvPpMA,2600
95
- iris_pex_embedded_python-4.0.1b8.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
96
- iris_pex_embedded_python-4.0.1b8.dist-info/METADATA,sha256=2xgGbmP5t_sp-SvMGjzJp1wkpiU9p32fQ22gWUjG7GE,5854
97
- iris_pex_embedded_python-4.0.1b8.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
98
- iris_pex_embedded_python-4.0.1b8.dist-info/entry_points.txt,sha256=fzS8ZFsPe8cnpEx208X60DNugCPQmuSloPeg4pyyJDY,42
99
- iris_pex_embedded_python-4.0.1b8.dist-info/top_level.txt,sha256=BM54-OXQ6l2BDtmesWNXckh033s9gcjoO7bfjbwZbxU,4
100
- iris_pex_embedded_python-4.0.1b8.dist-info/RECORD,,
95
+ iris_pex_embedded_python-4.0.2b1.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
96
+ iris_pex_embedded_python-4.0.2b1.dist-info/METADATA,sha256=KH7KNTmCAgq7NDqjtGVeJUxN9SkQxu07iFkNkYWRsa4,5854
97
+ iris_pex_embedded_python-4.0.2b1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
98
+ iris_pex_embedded_python-4.0.2b1.dist-info/entry_points.txt,sha256=fzS8ZFsPe8cnpEx208X60DNugCPQmuSloPeg4pyyJDY,42
99
+ iris_pex_embedded_python-4.0.2b1.dist-info/top_level.txt,sha256=BM54-OXQ6l2BDtmesWNXckh033s9gcjoO7bfjbwZbxU,4
100
+ iris_pex_embedded_python-4.0.2b1.dist-info/RECORD,,