benchling_sdk.apps.config.dependencies module¶
- class ApiConfigItem¶
Bases:
benchling_sdk.apps.config.dependencies.BaseConfigItem
API Config Item.
A reference to a config item for a Benchling object referencable by the API.
- __init__(parent: Union[BaseDependencies, BaseConfigNode], config_item: Optional[Union[EntitySchemaAppConfigItem, FieldAppConfigItem, GenericApiIdentifiedAppConfigItem]]) None ¶
- config_item: Optional[Union[EntitySchemaAppConfigItem, FieldAppConfigItem, GenericApiIdentifiedAppConfigItem]]¶
- class ArrayConfigItem¶
Bases:
benchling_sdk.apps.config.dependencies.BaseConfigItem
Array Config Item.
An array config item representing a row.
- __init__(parent: Union[BaseDependencies, BaseConfigNode], config_item: Optional[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]) None ¶
- config_item: Optional[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]¶
- class BaseConfigItem¶
Bases:
benchling_sdk.apps.config.dependencies.BaseConfigNode
Base Config Item.
A reference to any config item.
- __init__(parent: Union[BaseDependencies, BaseConfigNode], config_item: Optional[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]) None ¶
- config_item: Optional[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]¶
- class BaseConfigNode¶
Bases:
object
Base Config Node.
A node in a graph of related config items, referencing its parent.
All nodes should have a parent, which may be BaseDependencies, but not all nodes represent an AppConfigItem in Benchling.
- __init__(parent: Union[BaseDependencies, BaseConfigNode]) None ¶
- context() BaseDependencies ¶
Return the dependency class at the root of the dependency graph.
- parent: Union[BaseDependencies, BaseConfigNode]¶
- class BaseDependencies¶
Bases:
object
A base class for implementing dependencies.
Used as a facade for the underlying link store, which holds dependency links configured in Benchling.
- __init__(store: DependencyLinkStore, scalar_definitions: Dict[Union[BooleanAppConfigItemType, DateAppConfigItemType, DatetimeAppConfigItemType, FloatAppConfigItemType, IntegerAppConfigItemType, JsonAppConfigItemType, SecureTextAppConfigItemType, TextAppConfigItemType], ScalarDefinition] = DEFAULT_SCALAR_DEFINITIONS, unknown_scalar_definition: Optional[ScalarDefinition] = None, decryption_provider: Optional[BaseDecryptionProvider] = None)¶
Initialize Base Dependencies.
- Parameters
store â The dependency link store to source dependency links from.
scalar_definitions â A map of scalar types from the API definitions to ScalarDefinitions which
determines how we want map them to concrete Python types and values. Can be overridden to customize deserialization behavior or formatting. :param unknown_scalar_definition: A scalar definition for handling unknown scalar types from the API. Can be used to control behavior for forwards compatibility with new types the SDK does not yet support (e.g., by treating them as strings). :param decryption_provider: A decryption provider that can decrypt secrets from app config. If dependencies attempt to use a secure_textâs decrypted value, a decryption_provider must be specified.
- classmethod from_app(client: Benchling, app_id: str, decryption_provider: Optional[BaseDecryptionProvider] = None) benchling_sdk.apps.config.dependencies.D ¶
Initialize dependencies from an app_id.
- classmethod from_store(store: DependencyLinkStore, decryption_provider: Optional[BaseDecryptionProvider] = None) benchling_sdk.apps.config.dependencies.D ¶
Initialize dependencies from a store.
- class BaseField¶
Bases:
abc.ABC
,benchling_api_client.v2.stable.models.field.Field
,Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Base Field.
Provides additional accessors on top of the OpenAPI Field model.
- classmethod from_field(field: Optional[Field]) benchling_sdk.apps.config.dependencies.F ¶
From Field.
Create a new instance from an existing field.
- property scalar_definition: ScalarDefinition[benchling_sdk.apps.config.scalars.ScalarType]¶
Scalar Definition.
Returns a scalar definition for parsing a concrete type from a field. Override to implement custom deserialization.
- class BenchlingConfigProvider¶
Bases:
benchling_sdk.apps.config.dependencies.ConfigProvider
Benchling Config provider.
Provides a BenchlingAppConfiguration retrieved from Benchlingâs API.
- __init__(client: Benchling, app_id: str)¶
Initialize Benchling Config Provider.
- Parameters
client â A configured Benchling instance for making API calls.
app_id â The app_id from which to retrieve configuration.
- config() List[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]] ¶
Provide a Benchling app configuration from Benchlingâs APIs.
- class ConfigProvider¶
Bases:
typing_extensions.Protocol
Config provider.
Provides a BenchlingAppConfiguration.
- __init__(*args, **kwargs)¶
- config() List[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]] ¶
Implement to provide a Benchling app configuration.
- class DependencyLinkStore¶
Bases:
object
Dependency Link Store.
Marshalls an app configuration from the configuration provider into an indexable structure. Only retrieves app configuration once unless its cache is invalidated.
- __init__(configuration_provider: ConfigProvider)¶
Initialize Dependency Link Store.
- Parameters
configuration_provider â A ConfigProvider that will be invoked to provide the
underlying config from which to organize dependency links.
- config_by_path(path: List[str]) Optional[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]] ¶
Config by path.
Find an app config item by its exact path match, if it exists. Does not search partial paths.
- config_keys_by_path(path: List[str]) ordered_set.OrderedSet[str] ¶
Config keys by path.
Find a set of app config keys at the specified path, if any. Does not return keys that are nested beyond the current level.
For instance, given paths: [âOneâ, âTwoâ] [âOneâ, âTwoâ, âThreeâ] [âOneâ, âTwoâ, âFourâ] [âOneâ, âTwoâ, âThreeâ, âFiveâ] [âZeroâ, âOneâ, âTwoâ, âThreeâ]
The expected return from this method when path=[âOneâ, âTwoâ] is a set {âThreeâ, âFourâ}.
- property configuration: List[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]¶
Get the underlying configuration.
Return the raw, stored configuration. Can be used if the provided accessors are inadequate to find particular configuration items.
- property configuration_path_map: Dict[Tuple[str, ...], Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]¶
Config links.
Return a map of configuration item paths to their corresponding configuration items.
- classmethod from_app(client: Benchling, app_id: str) DependencyLinkStore ¶
From App.
Instantiate a DependencyLinkStore from an app_id and a configured Benchling instance. Preferred to using the classâs constructor.
- class HasApiIdentifiedAppConfigItem¶
Bases:
typing_extensions.Protocol
Has Api Identified App Config Item.
A mixin for typing to assert that a class has an optional app config item attribute. That app config item must have a linked_resource property.
- __init__(*args, **kwargs)¶
- property config_item: Optional[Union[EntitySchemaAppConfigItem, FieldAppConfigItem, GenericApiIdentifiedAppConfigItem]]¶
Return the underlying app config item, if present. App config item must have linked_resource.
- class HasAppConfigItem¶
Bases:
typing_extensions.Protocol
Has App Config Item.
A mixin for typing to assert that a class has an optional app config item attribute.
- __init__(*args, **kwargs)¶
- property config_item: Optional[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]¶
Return the underlying app config item, if present.
- class HasConfigWithDecryptionProvider¶
Bases:
typing_extensions.Protocol
Has Config With Decryption Provider.
A mixin for typing to assert that a particular class has a decryption provider and config.
- __init__(*args, **kwargs)¶
- property config_item: Optional[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]¶
Return the underlying app config item, if present.
- property decryption_provider: Optional[BaseDecryptionProvider]¶
Return the decryption provider.
- class HasScalarDefinition¶
Bases:
typing_extensions.Protocol
Has Scalar Definition.
A mixin for typing to assert that a particular class has scalar attributes.
- __init__(*args, **kwargs)¶
- property config_item: Optional[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]¶
Return the underlying app config item, if present.
- property definition: Optional[ScalarDefinition]¶
Return the scalar definition, allowing for conversion to Python types.
- exception InaccessibleAppConfigResourceError¶
Bases:
Exception
Inaccessible app config resource error.
A resource was linked in app config, but the permissions do not allow access to it. Most likely happens when an app lacks the necessary permissions.
- exception MissingDependencyError¶
Bases:
Exception
Missing dependency error.
Indicates a dependency was missing from app config. For instance, no dependency with that name was in the list.
- exception MissingScalarDefinitionError¶
Bases:
Exception
Missing scalar definition error.
The manifest and configuration specified a scalar type which the SDK does not know how to translate to Python values yet.
- class OptionalField¶
Bases:
benchling_sdk.apps.config.dependencies.BaseField
,Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Optional Field.
A decorator class providing typed accessors for an underlying Field. Use with optional, single valued fields.
- property typed: _OptionalFieldTyped¶
Typed.
Return a reference to a typed field with typesafe accessors.
- class OptionalLinkedResourceDependencyMixin¶
Bases:
object
Optional Linked Resource Dependency Mixin.
A mixin for easily accessing attributes from linked_resource for an app config item which is optional and may not be present. Should only be mixed in with HasApiIdentifiedAppConfigItem
- class OptionalMultiValueField¶
Bases:
benchling_sdk.apps.config.dependencies.BaseField
,Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Optional Multi Value Field.
A decorator class providing typed accessors for an underlying Field. Use with optional, multi-valued fields.
- property typed: _OptionalMultiValueFieldType¶
Typed.
Return a reference to a typed field with typesafe accessors.
- class OptionalScalarDependencyMixin¶
Bases:
Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Optional Scalar Config.
A mixin for accessing a scalar config which is optional and may not be present. Should only be mixed in with HasScalarDefinition.
- property value: Optional[benchling_sdk.apps.config.scalars.ScalarType]¶
Return the value of the scalar, if present.
- class OptionalSecureTextDependencyMixin¶
Bases:
benchling_sdk.apps.config.dependencies.OptionalScalarDependencyMixin
[str
]Optional Secure Text.
A mixin for accessing a secure text config which is optional and may not be present. Should only be mixed in with SecureTextConfig.
- class OptionalSingleOrMultiValueField¶
Bases:
benchling_sdk.apps.config.dependencies.BaseField
,Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Optional Single Or Multi Value Field.
A decorator class providing typed accessors for an underlying Field. Use with optional fields where isMulti is unset.
- property typed: _OptionalSingleOrMultiValueFieldTyped¶
Typed.
Return a reference to a typed field with typesafe accessors.
- class OptionalValueMixin¶
Bases:
object
Optional Value Mixin.
A mixin for accessing a value which is optional and may not be present. Should only be mixed in with HasAppConfigItem or another class that provides the self.config_item attribute.
- class RequiredField¶
Bases:
benchling_sdk.apps.config.dependencies.BaseField
,Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Required Field.
A decorator class providing typed accessors for an underlying Field. Use with required, single valued fields.
- property typed: _RequiredFieldTyped¶
Typed.
Return a reference to a typed field with typesafe accessors.
- class RequiredLinkedResourceDependencyMixin¶
Bases:
object
Required Linked Resource Dependency Mixin.
A mixin for easily accessing attributes from linked_resource for an app config item which is required and should always be present. Should only be mixed in with HasApiIdentifiedAppConfigItem
- class RequiredMultiValueField¶
Bases:
benchling_sdk.apps.config.dependencies.BaseField
,Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Required Multi Value Field.
A decorator class providing typed accessors for an underlying Field. Use with required, multi-valued fields.
- property typed: _RequiredMultiValueFieldType¶
Typed.
Return a reference to a typed field with typesafe accessors.
- class RequiredScalarDependencyMixin¶
Bases:
Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Require Scalar Config.
A mixin for accessing a scalar config which is required and should always be present. Should only be mixed in with HasScalarDefinition.
- property value: benchling_sdk.apps.config.scalars.ScalarType¶
Return the value of the scalar.
- class RequiredSecureTextDependencyMixin¶
Bases:
benchling_sdk.apps.config.dependencies.RequiredScalarDependencyMixin
[str
]Require Secure Text.
A mixin for accessing a secure text config which is required and should always be present. Should only be mixed in with SecureTextConfig.
- class RequiredSingleOrMultiValueField¶
Bases:
benchling_sdk.apps.config.dependencies.BaseField
,Generic
[benchling_sdk.apps.config.scalars.ScalarType
]Required Single Or Multi Value Field.
A decorator class providing typed accessors for an underlying Field. Use with required fields where isMulti is unset.
- property typed: _RequiredSingleOrMultiValueFieldTyped¶
Typed.
Return a reference to a typed field with typesafe accessors.
- class RequiredValueMixin¶
Bases:
object
Required Value Mixin.
A mixin for accessing a value which is required and should always be present. Should only be mixed in with HasAppConfigItem or another class that provides the self.config_item attribute.
- class ScalarConfigItem¶
Bases:
benchling_sdk.apps.config.dependencies.BaseConfigItem
Scalar Config Item.
Scalars are values that can be represented outside the Benchling domain.
- __init__(parent: Union[BaseDependencies, BaseConfigNode], config_item: Optional[Union[BooleanAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, FloatAppConfigItem, IntegerAppConfigItem, JsonAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]], definition: Optional[ScalarDefinition]) None ¶
- config_item: Optional[Union[BooleanAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, FloatAppConfigItem, IntegerAppConfigItem, JsonAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]]¶
- definition: Optional[ScalarDefinition]¶
- class SecureTextDependency¶
Bases:
benchling_sdk.apps.config.dependencies.ScalarConfigItem
SecureText Config.
A dependency for accessing a secure_text config.
- __init__(parent: Union[BaseDependencies, BaseConfigNode], config_item: Optional[Union[BooleanAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, FloatAppConfigItem, IntegerAppConfigItem, JsonAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]], definition: Optional[ScalarDefinition], decryption_provider: Optional[BaseDecryptionProvider]) None ¶
- decryption_provider: Optional[BaseDecryptionProvider]¶
- class StaticConfigProvider¶
Bases:
benchling_sdk.apps.config.dependencies.ConfigProvider
Static Config provider.
Provides a BenchlingAppConfiguration from a static declaration. Useful for mocking or testing.
- __init__(configuration_items: List[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]])¶
Initialize Static Config Provider.
- Parameters
configuration_items â The configuration items to return.
- config() List[Union[ArrayElementAppConfigItem, DateAppConfigItem, DatetimeAppConfigItem, JsonAppConfigItem, EntitySchemaAppConfigItem, FieldAppConfigItem, BooleanAppConfigItem, IntegerAppConfigItem, FloatAppConfigItem, GenericApiIdentifiedAppConfigItem, SecureTextAppConfigItem, TextAppConfigItem]] ¶
Provide Benchling app configuration items from a static reference.