benchling-sdk 1.9.0a5__py3-none-any.whl → 1.10.0__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.
- benchling_sdk/apps/canvas/__init__.py +0 -0
- benchling_sdk/apps/canvas/errors.py +14 -0
- benchling_sdk/apps/{helpers/canvas_helpers.py → canvas/framework.py} +129 -188
- benchling_sdk/apps/canvas/types.py +125 -0
- benchling_sdk/apps/config/__init__.py +0 -3
- benchling_sdk/apps/config/decryption_provider.py +1 -1
- benchling_sdk/apps/config/errors.py +38 -0
- benchling_sdk/apps/config/framework.py +343 -0
- benchling_sdk/apps/config/helpers.py +157 -0
- benchling_sdk/apps/config/{mock_dependencies.py → mock_config.py} +78 -99
- benchling_sdk/apps/config/types.py +36 -0
- benchling_sdk/apps/framework.py +49 -338
- benchling_sdk/apps/helpers/webhook_helpers.py +2 -2
- benchling_sdk/apps/status/__init__.py +0 -0
- benchling_sdk/apps/status/errors.py +85 -0
- benchling_sdk/apps/{helpers/session_helpers.py → status/framework.py} +58 -167
- benchling_sdk/apps/status/helpers.py +20 -0
- benchling_sdk/apps/status/types.py +45 -0
- benchling_sdk/apps/types.py +3 -0
- benchling_sdk/errors.py +4 -4
- benchling_sdk/models/__init__.py +44 -0
- benchling_sdk/services/v2/beta/{v2_beta_dataset_service.py → v2_beta_data_frame_service.py} +126 -116
- benchling_sdk/services/v2/stable/assay_result_service.py +18 -0
- benchling_sdk/services/v2/v2_beta_service.py +11 -11
- {benchling_sdk-1.9.0a5.dist-info → benchling_sdk-1.10.0.dist-info}/METADATA +4 -4
- {benchling_sdk-1.9.0a5.dist-info → benchling_sdk-1.10.0.dist-info}/RECORD +29 -20
- benchling_sdk/apps/config/dependencies.py +0 -1085
- benchling_sdk/apps/config/scalars.py +0 -226
- benchling_sdk/apps/helpers/config_helpers.py +0 -409
- /benchling_sdk/apps/{helpers → config}/cryptography_helpers.py +0 -0
- {benchling_sdk-1.9.0a5.dist-info → benchling_sdk-1.10.0.dist-info}/LICENSE +0 -0
- {benchling_sdk-1.9.0a5.dist-info → benchling_sdk-1.10.0.dist-info}/WHEEL +0 -0
@@ -3,15 +3,20 @@ from __future__ import annotations
|
|
3
3
|
from abc import ABC, abstractmethod
|
4
4
|
from contextlib import AbstractContextManager
|
5
5
|
from types import TracebackType
|
6
|
-
from typing import cast,
|
6
|
+
from typing import cast, Iterable, List, Optional, Protocol, Type, TYPE_CHECKING, Union
|
7
7
|
|
8
8
|
from benchling_api_client.v2.stable.types import Unset, UNSET
|
9
9
|
|
10
|
-
from benchling_sdk.apps.
|
10
|
+
from benchling_sdk.apps.status.errors import (
|
11
|
+
AppUserFacingError,
|
12
|
+
InvalidSessionTimeoutError,
|
13
|
+
MissingAttachedCanvasError,
|
14
|
+
SessionClosedError,
|
15
|
+
SessionContextClosedError,
|
16
|
+
)
|
11
17
|
from benchling_sdk.errors import BenchlingError
|
12
|
-
from benchling_sdk.helpers.logging_helpers import
|
18
|
+
from benchling_sdk.helpers.logging_helpers import sdk_logger
|
13
19
|
from benchling_sdk.models import (
|
14
|
-
AaSequence,
|
15
20
|
AppCanvasUpdate,
|
16
21
|
AppSession,
|
17
22
|
AppSessionCreate,
|
@@ -22,131 +27,13 @@ from benchling_sdk.models import (
|
|
22
27
|
AppSessionUpdateStatus,
|
23
28
|
BadRequestError,
|
24
29
|
BadRequestErrorBulkError,
|
25
|
-
Blob,
|
26
|
-
Box,
|
27
|
-
Container,
|
28
|
-
CustomEntity,
|
29
|
-
DnaOligo,
|
30
|
-
DnaSequence,
|
31
|
-
Entry,
|
32
|
-
Folder,
|
33
|
-
Location,
|
34
|
-
Mixture,
|
35
|
-
Molecule,
|
36
|
-
Plate,
|
37
|
-
Request,
|
38
|
-
RnaOligo,
|
39
|
-
RnaSequence,
|
40
|
-
WorkflowOutput,
|
41
|
-
WorkflowTask,
|
42
30
|
)
|
43
31
|
|
44
|
-
|
45
|
-
|
46
|
-
_ReferencedSessionLinkType = Union[
|
47
|
-
AaSequence,
|
48
|
-
Blob,
|
49
|
-
Box,
|
50
|
-
Container,
|
51
|
-
CustomEntity,
|
52
|
-
DnaSequence,
|
53
|
-
DnaOligo,
|
54
|
-
Entry,
|
55
|
-
Folder,
|
56
|
-
Location,
|
57
|
-
Mixture,
|
58
|
-
Plate,
|
59
|
-
RnaOligo,
|
60
|
-
Molecule,
|
61
|
-
RnaSequence,
|
62
|
-
Request,
|
63
|
-
WorkflowOutput,
|
64
|
-
WorkflowTask,
|
65
|
-
]
|
32
|
+
if TYPE_CHECKING:
|
33
|
+
from benchling_sdk.apps.framework import App
|
66
34
|
|
67
35
|
_DEFAULT_APP_ERROR_MESSAGE = "An unexpected error occurred in the app"
|
68
36
|
|
69
|
-
log_stability_warning(StabilityLevel.BETA)
|
70
|
-
|
71
|
-
|
72
|
-
class SessionClosedError(Exception):
|
73
|
-
"""
|
74
|
-
Session Closed Error.
|
75
|
-
|
76
|
-
A session was inoperable because its status in Benchling was terminal.
|
77
|
-
"""
|
78
|
-
|
79
|
-
pass
|
80
|
-
|
81
|
-
|
82
|
-
class SessionContextClosedError(Exception):
|
83
|
-
"""
|
84
|
-
Session Context Closed Error.
|
85
|
-
|
86
|
-
An operation was attempted using the session context manager after it was closed.
|
87
|
-
"""
|
88
|
-
|
89
|
-
pass
|
90
|
-
|
91
|
-
|
92
|
-
class InvalidSessionTimeoutError(Exception):
|
93
|
-
"""
|
94
|
-
Invalid Session Timeout Error.
|
95
|
-
|
96
|
-
A session's timeout value was set to an invalid value.
|
97
|
-
"""
|
98
|
-
|
99
|
-
pass
|
100
|
-
|
101
|
-
|
102
|
-
class MissingAttachedCanvasError(Exception):
|
103
|
-
"""
|
104
|
-
Missing Attached Canvas Error.
|
105
|
-
|
106
|
-
A canvas operation was requested, but a session context has no attached canvas.
|
107
|
-
"""
|
108
|
-
|
109
|
-
pass
|
110
|
-
|
111
|
-
|
112
|
-
class AppUserFacingError(Exception):
|
113
|
-
"""
|
114
|
-
App User Facing Error.
|
115
|
-
|
116
|
-
Extend this class with custom exceptions you want to be written back to the user as a SessionMessage.
|
117
|
-
|
118
|
-
SessionClosingContextExitHandler will invoke messages() and write them to a user. Callers choosing to
|
119
|
-
write their own SessionContextExitHandler may need to replicate this behavior themselves.
|
120
|
-
|
121
|
-
This is useful for control flow where an app wants to terminate with an error state that is resolvable
|
122
|
-
by the user.
|
123
|
-
|
124
|
-
For example:
|
125
|
-
|
126
|
-
class InvalidUserInputError(AppUserFacingError):
|
127
|
-
pass
|
128
|
-
|
129
|
-
raise InvalidUserInputError("Please enter a number between 1 and 10")
|
130
|
-
|
131
|
-
This would create a message shown to the user like:
|
132
|
-
|
133
|
-
AppSessionMessageCreate("Please enter a number between 1 and 10", style=AppSessionMessageStyle.ERROR)
|
134
|
-
"""
|
135
|
-
|
136
|
-
_messages: List[str]
|
137
|
-
|
138
|
-
def __init__(self, messages: Union[str, List[str]], *args) -> None:
|
139
|
-
"""Initialize an AppUserFacingError with one message or a list."""
|
140
|
-
self._messages = [messages] if isinstance(messages, str) else messages
|
141
|
-
super().__init__(args)
|
142
|
-
|
143
|
-
def messages(self) -> List[AppSessionMessageCreate]:
|
144
|
-
"""Create a series of AppSessionMessageCreate to write to a Session and displayed to the user."""
|
145
|
-
return [
|
146
|
-
AppSessionMessageCreate(content=message, style=AppSessionMessageStyle.ERROR)
|
147
|
-
for message in self._messages
|
148
|
-
]
|
149
|
-
|
150
37
|
|
151
38
|
class SessionProvider(Protocol):
|
152
39
|
"""Provide a Benchling App Session to convey app status."""
|
@@ -166,7 +53,7 @@ class SessionContextErrorProcessor(ABC):
|
|
166
53
|
process_error() does not assume a context's session is active. If using the session with process_error(),
|
167
54
|
this should be checked.
|
168
55
|
|
169
|
-
For
|
56
|
+
For use with SessionClosingContextExitHandler or its subclasses.
|
170
57
|
"""
|
171
58
|
|
172
59
|
@classmethod
|
@@ -181,7 +68,7 @@ class SessionContextErrorProcessor(ABC):
|
|
181
68
|
@abstractmethod
|
182
69
|
def process_error(
|
183
70
|
cls,
|
184
|
-
context: SessionContextManager
|
71
|
+
context: SessionContextManager,
|
185
72
|
exc_type: Type[BaseException],
|
186
73
|
exc_value: BaseException,
|
187
74
|
exc_traceback: TracebackType,
|
@@ -220,7 +107,7 @@ class AppUserFacingErrorProcessor(SessionContextErrorProcessor):
|
|
220
107
|
@classmethod
|
221
108
|
def process_error(
|
222
109
|
cls,
|
223
|
-
context: SessionContextManager
|
110
|
+
context: SessionContextManager,
|
224
111
|
exc_type: Type[BaseException],
|
225
112
|
exc_value: BaseException,
|
226
113
|
exc_traceback: TracebackType,
|
@@ -269,7 +156,7 @@ class BenchlingBadRequestErrorProcessor(AppUserFacingErrorProcessor):
|
|
269
156
|
@classmethod
|
270
157
|
def process_error(
|
271
158
|
cls,
|
272
|
-
context: SessionContextManager
|
159
|
+
context: SessionContextManager,
|
273
160
|
exc_type: Type[BaseException],
|
274
161
|
exc_value: BaseException,
|
275
162
|
exc_traceback: TracebackType,
|
@@ -318,7 +205,7 @@ class BenchlingBadRequestErrorProcessor(AppUserFacingErrorProcessor):
|
|
318
205
|
return messages
|
319
206
|
|
320
207
|
|
321
|
-
class SessionContextEnterHandler(ABC
|
208
|
+
class SessionContextEnterHandler(ABC):
|
322
209
|
"""
|
323
210
|
Session Context Enter Handler.
|
324
211
|
|
@@ -326,12 +213,12 @@ class SessionContextEnterHandler(ABC, Generic[AppType]):
|
|
326
213
|
"""
|
327
214
|
|
328
215
|
@abstractmethod
|
329
|
-
def on_enter(self, context: SessionContextManager
|
216
|
+
def on_enter(self, context: SessionContextManager) -> None:
|
330
217
|
"""Perform on session context enter after a Session has been started with Benchling."""
|
331
218
|
pass
|
332
219
|
|
333
220
|
|
334
|
-
class SessionContextExitHandler(ABC
|
221
|
+
class SessionContextExitHandler(ABC):
|
335
222
|
"""
|
336
223
|
Session Context Exit Handler.
|
337
224
|
|
@@ -339,7 +226,7 @@ class SessionContextExitHandler(ABC, Generic[AppType]):
|
|
339
226
|
"""
|
340
227
|
|
341
228
|
@abstractmethod
|
342
|
-
def on_success(self, context: SessionContextManager
|
229
|
+
def on_success(self, context: SessionContextManager) -> bool:
|
343
230
|
"""
|
344
231
|
Perform on session context exit when no errors are present.
|
345
232
|
|
@@ -354,7 +241,7 @@ class SessionContextExitHandler(ABC, Generic[AppType]):
|
|
354
241
|
@abstractmethod
|
355
242
|
def on_error(
|
356
243
|
self,
|
357
|
-
context: SessionContextManager
|
244
|
+
context: SessionContextManager,
|
358
245
|
exc_type: Type[BaseException],
|
359
246
|
exc_value: BaseException,
|
360
247
|
exc_traceback: TracebackType,
|
@@ -382,6 +269,7 @@ class SessionClosingContextExitHandler(SessionContextExitHandler):
|
|
382
269
|
|
383
270
|
On error: close the Session with Benchling with SessionStatusUpdate.FAILED.
|
384
271
|
If error_messages were specified, those will also be written to the Session when setting the status.
|
272
|
+
If the session has a Canvas attached and enable_attached_canvas_on_error is True, re-enable the AppCanvas.
|
385
273
|
|
386
274
|
As a best practice, error messages are not written to the session to avoid leaking
|
387
275
|
potentially sensitive information.
|
@@ -390,6 +278,7 @@ class SessionClosingContextExitHandler(SessionContextExitHandler):
|
|
390
278
|
_success_messages: Optional[Iterable[AppSessionMessageCreate]]
|
391
279
|
_error_messages: Optional[Iterable[AppSessionMessageCreate]]
|
392
280
|
_error_processors: List[Type[SessionContextErrorProcessor]]
|
281
|
+
_enable_attached_canvas_on_error: bool
|
393
282
|
|
394
283
|
def __init__(
|
395
284
|
self,
|
@@ -401,6 +290,7 @@ class SessionClosingContextExitHandler(SessionContextExitHandler):
|
|
401
290
|
AppUserFacingErrorProcessor,
|
402
291
|
BenchlingBadRequestErrorProcessor,
|
403
292
|
],
|
293
|
+
enable_attached_canvas_on_error: bool = True,
|
404
294
|
):
|
405
295
|
"""
|
406
296
|
Init Session Closing Context Exit Handler.
|
@@ -411,8 +301,9 @@ class SessionClosingContextExitHandler(SessionContextExitHandler):
|
|
411
301
|
self._success_messages = success_messages
|
412
302
|
self._error_messages = error_messages
|
413
303
|
self._error_processors = error_processors
|
304
|
+
self._enable_attached_canvas_on_error = enable_attached_canvas_on_error
|
414
305
|
|
415
|
-
def on_success(self, context: SessionContextManager
|
306
|
+
def on_success(self, context: SessionContextManager) -> bool:
|
416
307
|
"""
|
417
308
|
Close Active Session on Success.
|
418
309
|
|
@@ -443,7 +334,7 @@ class SessionClosingContextExitHandler(SessionContextExitHandler):
|
|
443
334
|
|
444
335
|
def on_error(
|
445
336
|
self,
|
446
|
-
context: SessionContextManager
|
337
|
+
context: SessionContextManager,
|
447
338
|
exc_type: Type[BaseException],
|
448
339
|
exc_value: BaseException,
|
449
340
|
exc_traceback: TracebackType,
|
@@ -467,7 +358,9 @@ class SessionClosingContextExitHandler(SessionContextExitHandler):
|
|
467
358
|
# Pluggable specific error handling
|
468
359
|
if optional_error_processor:
|
469
360
|
sdk_logger.debug("Exiting session context with error, matched handler for %s", str(exc_type))
|
470
|
-
|
361
|
+
result = optional_error_processor.process_error(context, exc_type, exc_value, exc_traceback)
|
362
|
+
self._check_and_enable_canvas(context)
|
363
|
+
return result
|
471
364
|
# Fallback to general error handling
|
472
365
|
sdk_logger.debug(
|
473
366
|
"Exiting session context with error, automatically closing session ID %s as %s",
|
@@ -481,10 +374,17 @@ class SessionClosingContextExitHandler(SessionContextExitHandler):
|
|
481
374
|
context.close_session(AppSessionUpdateStatus.FAILED, messages=message_creates)
|
482
375
|
else:
|
483
376
|
context.close_session(AppSessionUpdateStatus.FAILED)
|
377
|
+
self._check_and_enable_canvas(context)
|
484
378
|
else:
|
485
379
|
sdk_logger.debug("Exiting session context, no active session present")
|
486
380
|
return False
|
487
381
|
|
382
|
+
def _check_and_enable_canvas(self, context: SessionContextManager) -> None:
|
383
|
+
canvas_id = context.attached_canvas_id()
|
384
|
+
if self._enable_attached_canvas_on_error and canvas_id:
|
385
|
+
context.app.benchling.apps.update_canvas(canvas_id, AppCanvasUpdate(enabled=True))
|
386
|
+
sdk_logger.debug("Re-enabled canvas with ID %s", context.attached_canvas_id())
|
387
|
+
|
488
388
|
def _error_processor_type(
|
489
389
|
self,
|
490
390
|
exc_type: Type[BaseException],
|
@@ -497,7 +397,7 @@ class SessionClosingContextExitHandler(SessionContextExitHandler):
|
|
497
397
|
return None
|
498
398
|
|
499
399
|
|
500
|
-
def create_session_provider(app:
|
400
|
+
def create_session_provider(app: App, name: str, timeout_seconds: int) -> SessionProvider:
|
501
401
|
"""
|
502
402
|
Create Session Provider.
|
503
403
|
|
@@ -512,7 +412,7 @@ def create_session_provider(app: AppType, name: str, timeout_seconds: int) -> Se
|
|
512
412
|
return _new_session
|
513
413
|
|
514
414
|
|
515
|
-
def existing_session_provider(app:
|
415
|
+
def existing_session_provider(app: App, session_id: str) -> SessionProvider:
|
516
416
|
"""
|
517
417
|
Existing Session Provider.
|
518
418
|
|
@@ -537,7 +437,7 @@ def _ordered_messages(messages: Iterable[AppSessionMessageCreate]) -> List[AppSe
|
|
537
437
|
return list(messages)
|
538
438
|
|
539
439
|
|
540
|
-
class SessionContextManager(AbstractContextManager
|
440
|
+
class SessionContextManager(AbstractContextManager):
|
541
441
|
"""
|
542
442
|
Manage Benchling App Session.
|
543
443
|
|
@@ -546,19 +446,19 @@ class SessionContextManager(AbstractContextManager, Generic[AppType]):
|
|
546
446
|
success_exit_handler.
|
547
447
|
"""
|
548
448
|
|
549
|
-
_app:
|
449
|
+
_app: App
|
550
450
|
_session_provider: SessionProvider
|
551
|
-
_context_enter_handler: Optional[SessionContextEnterHandler
|
552
|
-
_context_exit_handler: SessionContextExitHandler
|
451
|
+
_context_enter_handler: Optional[SessionContextEnterHandler]
|
452
|
+
_context_exit_handler: SessionContextExitHandler
|
553
453
|
_session: Optional[AppSession]
|
554
454
|
_attached_canvas_id: Optional[str]
|
555
455
|
|
556
456
|
def __init__(
|
557
457
|
self,
|
558
|
-
app:
|
458
|
+
app: App,
|
559
459
|
session_provider: SessionProvider,
|
560
|
-
context_enter_handler: Optional[SessionContextEnterHandler
|
561
|
-
context_exit_handler: Optional[SessionContextExitHandler
|
460
|
+
context_enter_handler: Optional[SessionContextEnterHandler] = None,
|
461
|
+
context_exit_handler: Optional[SessionContextExitHandler] = None,
|
562
462
|
):
|
563
463
|
"""
|
564
464
|
Initialize SessionContextManager.
|
@@ -595,7 +495,7 @@ class SessionContextManager(AbstractContextManager, Generic[AppType]):
|
|
595
495
|
return self._context_exit_handler.on_success(self)
|
596
496
|
|
597
497
|
@property
|
598
|
-
def app(self) ->
|
498
|
+
def app(self) -> App:
|
599
499
|
"""Return the app for the session."""
|
600
500
|
return self._app
|
601
501
|
|
@@ -711,6 +611,14 @@ class SessionContextManager(AbstractContextManager, Generic[AppType]):
|
|
711
611
|
"""
|
712
612
|
return self._session is not None
|
713
613
|
|
614
|
+
def attached_canvas_id(self) -> Optional[str]:
|
615
|
+
"""
|
616
|
+
Attached Canvas Id.
|
617
|
+
|
618
|
+
Returns a canvas_id associated with the active session, if one has been attached via `attach_canvas`.
|
619
|
+
"""
|
620
|
+
return self._attached_canvas_id
|
621
|
+
|
714
622
|
def attach_canvas(self, canvas_id: str) -> None:
|
715
623
|
"""
|
716
624
|
Attach Canvas.
|
@@ -759,12 +667,12 @@ class SessionContextManager(AbstractContextManager, Generic[AppType]):
|
|
759
667
|
|
760
668
|
|
761
669
|
def new_session_context(
|
762
|
-
app:
|
670
|
+
app: App,
|
763
671
|
name: str,
|
764
672
|
timeout_seconds: int,
|
765
673
|
context_enter_handler: Optional[SessionContextEnterHandler] = None,
|
766
674
|
context_exit_handler: Optional[SessionContextExitHandler] = None,
|
767
|
-
) -> SessionContextManager
|
675
|
+
) -> SessionContextManager:
|
768
676
|
"""
|
769
677
|
Create New Session Context.
|
770
678
|
|
@@ -779,11 +687,11 @@ def new_session_context(
|
|
779
687
|
|
780
688
|
|
781
689
|
def continue_session_context(
|
782
|
-
app:
|
690
|
+
app: App,
|
783
691
|
session_id: str,
|
784
692
|
context_enter_handler: Optional[SessionContextEnterHandler] = None,
|
785
693
|
context_exit_handler: Optional[SessionContextExitHandler] = None,
|
786
|
-
) -> SessionContextManager
|
694
|
+
) -> SessionContextManager:
|
787
695
|
"""
|
788
696
|
Continue Session Context.
|
789
697
|
|
@@ -795,20 +703,3 @@ def continue_session_context(
|
|
795
703
|
context_enter_handler,
|
796
704
|
context_exit_handler,
|
797
705
|
)
|
798
|
-
|
799
|
-
|
800
|
-
def ref(reference: _ReferencedSessionLinkType) -> str:
|
801
|
-
"""
|
802
|
-
Ref.
|
803
|
-
|
804
|
-
Helper method for easily serializing a referenced object into a string embeddable in AppSessionMessageCreate
|
805
|
-
content.
|
806
|
-
|
807
|
-
Example:
|
808
|
-
dna_sequence = benchling.dna_sequences.get_by_id("seq_1234")
|
809
|
-
AppSessionMessageCreate(f"This is my DNA sequence {ref(dna_sequence)} for analysis"
|
810
|
-
"""
|
811
|
-
# Not sure {} are possible in Benchling IDs, but the spec says we're escaping
|
812
|
-
unescape_id = reference.id
|
813
|
-
escaped_id = unescape_id.replace("{", "\\{").replace("}", "\\}")
|
814
|
-
return f"{{id:{escaped_id}}}"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from benchling_sdk.apps.status.types import ReferencedSessionLinkType
|
4
|
+
|
5
|
+
|
6
|
+
def ref(reference: ReferencedSessionLinkType) -> str:
|
7
|
+
"""
|
8
|
+
Ref.
|
9
|
+
|
10
|
+
Helper method for easily serializing a referenced object into a string embeddable in AppSessionMessageCreate
|
11
|
+
content.
|
12
|
+
|
13
|
+
Example:
|
14
|
+
dna_sequence = benchling.dna_sequences.get_by_id("seq_1234")
|
15
|
+
AppSessionMessageCreate(f"This is my DNA sequence {ref(dna_sequence)} for analysis"
|
16
|
+
"""
|
17
|
+
# Not sure {} are possible in Benchling IDs, but the spec says we're escaping
|
18
|
+
unescape_id = reference.id
|
19
|
+
escaped_id = unescape_id.replace("{", "\\{").replace("}", "\\}")
|
20
|
+
return f"{{id:{escaped_id}}}"
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from typing import Union
|
2
|
+
|
3
|
+
from benchling_sdk.models import (
|
4
|
+
AaSequence,
|
5
|
+
Blob,
|
6
|
+
Box,
|
7
|
+
Container,
|
8
|
+
CustomEntity,
|
9
|
+
DnaOligo,
|
10
|
+
DnaSequence,
|
11
|
+
Entry,
|
12
|
+
Folder,
|
13
|
+
Location,
|
14
|
+
Mixture,
|
15
|
+
Molecule,
|
16
|
+
Plate,
|
17
|
+
Request,
|
18
|
+
RnaOligo,
|
19
|
+
RnaSequence,
|
20
|
+
WorkflowOutput,
|
21
|
+
WorkflowTask,
|
22
|
+
)
|
23
|
+
|
24
|
+
# Taken from CHIP_SUPPORTED_COLUMN_TYPES in Benchling server
|
25
|
+
# Anything we miss, they can still embed the ID themselves in a message
|
26
|
+
ReferencedSessionLinkType = Union[
|
27
|
+
AaSequence,
|
28
|
+
Blob,
|
29
|
+
Box,
|
30
|
+
Container,
|
31
|
+
CustomEntity,
|
32
|
+
DnaSequence,
|
33
|
+
DnaOligo,
|
34
|
+
Entry,
|
35
|
+
Folder,
|
36
|
+
Location,
|
37
|
+
Mixture,
|
38
|
+
Plate,
|
39
|
+
RnaOligo,
|
40
|
+
Molecule,
|
41
|
+
RnaSequence,
|
42
|
+
Request,
|
43
|
+
WorkflowOutput,
|
44
|
+
WorkflowTask,
|
45
|
+
]
|
benchling_sdk/errors.py
CHANGED
@@ -183,8 +183,8 @@ class AppSessionClosedError(ExtendedBenchlingErrorBase):
|
|
183
183
|
|
184
184
|
|
185
185
|
@dataclass
|
186
|
-
class
|
187
|
-
"""A general error related to Benchling
|
186
|
+
class InvalidDataFrameError(Exception):
|
187
|
+
"""A general error related to Benchling DataFrames."""
|
188
188
|
|
189
189
|
message: str
|
190
190
|
|
@@ -193,8 +193,8 @@ class InvalidDatasetError(Exception):
|
|
193
193
|
|
194
194
|
|
195
195
|
@dataclass
|
196
|
-
class
|
197
|
-
"""An error for Benchling
|
196
|
+
class DataFrameInProgressError(Exception):
|
197
|
+
"""An error for Benchling data frames for unavailable data operations on a DataFrame in progress."""
|
198
198
|
|
199
199
|
message: str
|
200
200
|
|
benchling_sdk/models/__init__.py
CHANGED
@@ -632,6 +632,9 @@ __all__ = [
|
|
632
632
|
"MarkdownUiBlockCreate",
|
633
633
|
"MarkdownUiBlockType",
|
634
634
|
"MarkdownUiBlockUpdate",
|
635
|
+
"MatchBasesRequest",
|
636
|
+
"MatchBasesRequestArchiveReason",
|
637
|
+
"MatchBasesRequestSort",
|
635
638
|
"Measurement",
|
636
639
|
"Mixture",
|
637
640
|
"MixtureBulkUpdate",
|
@@ -845,6 +848,9 @@ __all__ = [
|
|
845
848
|
"SchemaLinkFieldDefinition",
|
846
849
|
"SchemaLinkFieldDefinitionType",
|
847
850
|
"SchemaSummary",
|
851
|
+
"SearchBasesRequest",
|
852
|
+
"SearchBasesRequestArchiveReason",
|
853
|
+
"SearchBasesRequestSort",
|
848
854
|
"SearchInputMultiValueUiBlock",
|
849
855
|
"SearchInputMultiValueUiBlockCreate",
|
850
856
|
"SearchInputMultiValueUiBlockType",
|
@@ -888,6 +894,8 @@ __all__ = [
|
|
888
894
|
"TableNotePartType",
|
889
895
|
"TableUiBlock",
|
890
896
|
"TableUiBlockCreate",
|
897
|
+
"TableUiBlockDataFrameSource",
|
898
|
+
"TableUiBlockDataFrameSourceType",
|
891
899
|
"TableUiBlockDatasetSource",
|
892
900
|
"TableUiBlockDatasetSourceType",
|
893
901
|
"TableUiBlockSource",
|
@@ -1641,6 +1649,9 @@ if TYPE_CHECKING:
|
|
1641
1649
|
import benchling_api_client.v2.stable.models.markdown_ui_block_create
|
1642
1650
|
import benchling_api_client.v2.stable.models.markdown_ui_block_type
|
1643
1651
|
import benchling_api_client.v2.stable.models.markdown_ui_block_update
|
1652
|
+
import benchling_api_client.v2.stable.models.match_bases_request
|
1653
|
+
import benchling_api_client.v2.stable.models.match_bases_request_archive_reason
|
1654
|
+
import benchling_api_client.v2.stable.models.match_bases_request_sort
|
1644
1655
|
import benchling_api_client.v2.stable.models.measurement
|
1645
1656
|
import benchling_api_client.v2.stable.models.mixture
|
1646
1657
|
import benchling_api_client.v2.stable.models.mixture_bulk_update
|
@@ -1854,6 +1865,9 @@ if TYPE_CHECKING:
|
|
1854
1865
|
import benchling_api_client.v2.stable.models.schema_link_field_definition
|
1855
1866
|
import benchling_api_client.v2.stable.models.schema_link_field_definition_type
|
1856
1867
|
import benchling_api_client.v2.stable.models.schema_summary
|
1868
|
+
import benchling_api_client.v2.stable.models.search_bases_request
|
1869
|
+
import benchling_api_client.v2.stable.models.search_bases_request_archive_reason
|
1870
|
+
import benchling_api_client.v2.stable.models.search_bases_request_sort
|
1857
1871
|
import benchling_api_client.v2.stable.models.search_input_multi_value_ui_block
|
1858
1872
|
import benchling_api_client.v2.stable.models.search_input_multi_value_ui_block_create
|
1859
1873
|
import benchling_api_client.v2.stable.models.search_input_multi_value_ui_block_type
|
@@ -1897,6 +1911,8 @@ if TYPE_CHECKING:
|
|
1897
1911
|
import benchling_api_client.v2.stable.models.table_note_part_type
|
1898
1912
|
import benchling_api_client.v2.stable.models.table_ui_block
|
1899
1913
|
import benchling_api_client.v2.stable.models.table_ui_block_create
|
1914
|
+
import benchling_api_client.v2.stable.models.table_ui_block_data_frame_source
|
1915
|
+
import benchling_api_client.v2.stable.models.table_ui_block_data_frame_source_type
|
1900
1916
|
import benchling_api_client.v2.stable.models.table_ui_block_dataset_source
|
1901
1917
|
import benchling_api_client.v2.stable.models.table_ui_block_dataset_source_type
|
1902
1918
|
import benchling_api_client.v2.stable.models.table_ui_block_source
|
@@ -3324,6 +3340,13 @@ if TYPE_CHECKING:
|
|
3324
3340
|
MarkdownUiBlockUpdate = (
|
3325
3341
|
benchling_api_client.v2.stable.models.markdown_ui_block_update.MarkdownUiBlockUpdate
|
3326
3342
|
)
|
3343
|
+
MatchBasesRequest = benchling_api_client.v2.stable.models.match_bases_request.MatchBasesRequest
|
3344
|
+
MatchBasesRequestArchiveReason = (
|
3345
|
+
benchling_api_client.v2.stable.models.match_bases_request_archive_reason.MatchBasesRequestArchiveReason
|
3346
|
+
)
|
3347
|
+
MatchBasesRequestSort = (
|
3348
|
+
benchling_api_client.v2.stable.models.match_bases_request_sort.MatchBasesRequestSort
|
3349
|
+
)
|
3327
3350
|
Measurement = benchling_api_client.v2.stable.models.measurement.Measurement
|
3328
3351
|
Mixture = benchling_api_client.v2.stable.models.mixture.Mixture
|
3329
3352
|
MixtureBulkUpdate = benchling_api_client.v2.stable.models.mixture_bulk_update.MixtureBulkUpdate
|
@@ -3743,6 +3766,13 @@ if TYPE_CHECKING:
|
|
3743
3766
|
benchling_api_client.v2.stable.models.schema_link_field_definition_type.SchemaLinkFieldDefinitionType
|
3744
3767
|
)
|
3745
3768
|
SchemaSummary = benchling_api_client.v2.stable.models.schema_summary.SchemaSummary
|
3769
|
+
SearchBasesRequest = benchling_api_client.v2.stable.models.search_bases_request.SearchBasesRequest
|
3770
|
+
SearchBasesRequestArchiveReason = (
|
3771
|
+
benchling_api_client.v2.stable.models.search_bases_request_archive_reason.SearchBasesRequestArchiveReason
|
3772
|
+
)
|
3773
|
+
SearchBasesRequestSort = (
|
3774
|
+
benchling_api_client.v2.stable.models.search_bases_request_sort.SearchBasesRequestSort
|
3775
|
+
)
|
3746
3776
|
SearchInputMultiValueUiBlock = (
|
3747
3777
|
benchling_api_client.v2.stable.models.search_input_multi_value_ui_block.SearchInputMultiValueUiBlock
|
3748
3778
|
)
|
@@ -3844,6 +3874,12 @@ if TYPE_CHECKING:
|
|
3844
3874
|
TableNotePartType = benchling_api_client.v2.stable.models.table_note_part_type.TableNotePartType
|
3845
3875
|
TableUiBlock = benchling_api_client.v2.stable.models.table_ui_block.TableUiBlock
|
3846
3876
|
TableUiBlockCreate = benchling_api_client.v2.stable.models.table_ui_block_create.TableUiBlockCreate
|
3877
|
+
TableUiBlockDataFrameSource = (
|
3878
|
+
benchling_api_client.v2.stable.models.table_ui_block_data_frame_source.TableUiBlockDataFrameSource
|
3879
|
+
)
|
3880
|
+
TableUiBlockDataFrameSourceType = (
|
3881
|
+
benchling_api_client.v2.stable.models.table_ui_block_data_frame_source_type.TableUiBlockDataFrameSourceType
|
3882
|
+
)
|
3847
3883
|
TableUiBlockDatasetSource = (
|
3848
3884
|
benchling_api_client.v2.stable.models.table_ui_block_dataset_source.TableUiBlockDatasetSource
|
3849
3885
|
)
|
@@ -4749,6 +4785,9 @@ else:
|
|
4749
4785
|
"MarkdownUiBlockCreate": "benchling_api_client.v2.stable.models.markdown_ui_block_create",
|
4750
4786
|
"MarkdownUiBlockType": "benchling_api_client.v2.stable.models.markdown_ui_block_type",
|
4751
4787
|
"MarkdownUiBlockUpdate": "benchling_api_client.v2.stable.models.markdown_ui_block_update",
|
4788
|
+
"MatchBasesRequest": "benchling_api_client.v2.stable.models.match_bases_request",
|
4789
|
+
"MatchBasesRequestArchiveReason": "benchling_api_client.v2.stable.models.match_bases_request_archive_reason",
|
4790
|
+
"MatchBasesRequestSort": "benchling_api_client.v2.stable.models.match_bases_request_sort",
|
4752
4791
|
"Measurement": "benchling_api_client.v2.stable.models.measurement",
|
4753
4792
|
"Mixture": "benchling_api_client.v2.stable.models.mixture",
|
4754
4793
|
"MixtureBulkUpdate": "benchling_api_client.v2.stable.models.mixture_bulk_update",
|
@@ -4962,6 +5001,9 @@ else:
|
|
4962
5001
|
"SchemaLinkFieldDefinition": "benchling_api_client.v2.stable.models.schema_link_field_definition",
|
4963
5002
|
"SchemaLinkFieldDefinitionType": "benchling_api_client.v2.stable.models.schema_link_field_definition_type",
|
4964
5003
|
"SchemaSummary": "benchling_api_client.v2.stable.models.schema_summary",
|
5004
|
+
"SearchBasesRequest": "benchling_api_client.v2.stable.models.search_bases_request",
|
5005
|
+
"SearchBasesRequestArchiveReason": "benchling_api_client.v2.stable.models.search_bases_request_archive_reason",
|
5006
|
+
"SearchBasesRequestSort": "benchling_api_client.v2.stable.models.search_bases_request_sort",
|
4965
5007
|
"SearchInputMultiValueUiBlock": "benchling_api_client.v2.stable.models.search_input_multi_value_ui_block",
|
4966
5008
|
"SearchInputMultiValueUiBlockCreate": "benchling_api_client.v2.stable.models.search_input_multi_value_ui_block_create",
|
4967
5009
|
"SearchInputMultiValueUiBlockType": "benchling_api_client.v2.stable.models.search_input_multi_value_ui_block_type",
|
@@ -5005,6 +5047,8 @@ else:
|
|
5005
5047
|
"TableNotePartType": "benchling_api_client.v2.stable.models.table_note_part_type",
|
5006
5048
|
"TableUiBlock": "benchling_api_client.v2.stable.models.table_ui_block",
|
5007
5049
|
"TableUiBlockCreate": "benchling_api_client.v2.stable.models.table_ui_block_create",
|
5050
|
+
"TableUiBlockDataFrameSource": "benchling_api_client.v2.stable.models.table_ui_block_data_frame_source",
|
5051
|
+
"TableUiBlockDataFrameSourceType": "benchling_api_client.v2.stable.models.table_ui_block_data_frame_source_type",
|
5008
5052
|
"TableUiBlockDatasetSource": "benchling_api_client.v2.stable.models.table_ui_block_dataset_source",
|
5009
5053
|
"TableUiBlockDatasetSourceType": "benchling_api_client.v2.stable.models.table_ui_block_dataset_source_type",
|
5010
5054
|
"TableUiBlockSource": "benchling_api_client.v2.stable.models.table_ui_block_source",
|