benchling_sdk.apps.config.dependencies module¶

class ApiDependency¶

Bases: abc.ABC, Generic[benchling_sdk.apps.config.dependencies.ApiConfigType]

Api Dependency.

A dependency that is API identifiable in Benchling, such as a schema.

__init__(link: benchling_sdk.apps.config.dependencies.ApiConfigType) → None¶
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[benchling_api_client.v2.beta.models.scalar_config_types.ScalarConfigTypes, 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.

invalidate_cache() → None¶

Invalidate the cache of dependency links and force an update.

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() → benchling_api_client.v2.beta.models.benchling_app_configuration.BenchlingAppConfiguration¶

Provide a Benchling app configuration from Benchling’s APIs.

class ConfigProvider¶

Bases: typing_extensions.Protocol

Config provider.

Provides a BenchlingAppConfiguration.

__init__(*args, **kwargs)¶
config() → benchling_api_client.v2.beta.models.benchling_app_configuration.BenchlingAppConfiguration¶

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_name(name: str, config_type: Type[benchling_sdk.apps.config.dependencies.AnyConfigType]) → benchling_sdk.apps.config.dependencies.AnyConfigType¶

Config by name.

Look up a configuration reference by its name. Only applies to named configuration at the top level, not subdependencies.

Config links.

Return a map of configuration item names to their corresponding API link or dependency value.

property configuration: benchling_api_client.v2.beta.models.benchling_app_configuration.BenchlingAppConfiguration¶

Get the underlying configuration.

Return the raw, stored configuration. Can be used if the provided accessors are inadequate to find particular 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.

invalidate_cache() → None¶

Invalidate Cache.

Will force retrieval of configuration from the ConfigProvider the next time the link store is accessed.

map_from_configuration(config: benchling_api_client.v2.beta.models.benchling_app_configuration.BenchlingAppConfiguration) → Dict[str, Union[benchling_api_client.v2.beta.models.dropdown_dependency_link.DropdownDependencyLink, benchling_api_client.v2.beta.models.entity_schema_dependency_link.EntitySchemaDependencyLink, benchling_api_client.v2.beta.models.resource_dependency_link.ResourceDependencyLink, benchling_api_client.v2.beta.models.schema_dependency_link.SchemaDependencyLink, benchling_api_client.v2.beta.models.subdependency_link.SubdependencyLink, benchling_api_client.v2.beta.models.workflow_task_schema_dependency_link.WorkflowTaskSchemaDependencyLink, benchling_api_client.v2.beta.models.scalar_config.ScalarConfig, benchling_api_client.v2.beta.models.secure_text_config.SecureTextConfig]]¶

Map from configuration.

Produce a map of Benchling configuration references where the name is the key for easy lookup.

to_map_value(configuration_item: Union[benchling_api_client.v2.beta.models.dropdown_dependency_link.DropdownDependencyLink, benchling_api_client.v2.beta.models.entity_schema_dependency_link.EntitySchemaDependencyLink, benchling_api_client.v2.beta.models.resource_dependency_link.ResourceDependencyLink, benchling_api_client.v2.beta.models.schema_dependency_link.SchemaDependencyLink, benchling_api_client.v2.beta.models.subdependency_link.SubdependencyLink, benchling_api_client.v2.beta.models.workflow_task_schema_dependency_link.WorkflowTaskSchemaDependencyLink, benchling_api_client.v2.beta.models.scalar_config.ScalarConfig, benchling_api_client.v2.beta.models.secure_text_config.SecureTextConfig, benchling_api_client.v2.extensions.UnknownType]) → Union[benchling_api_client.v2.beta.models.dropdown_dependency_link.DropdownDependencyLink, benchling_api_client.v2.beta.models.entity_schema_dependency_link.EntitySchemaDependencyLink, benchling_api_client.v2.beta.models.resource_dependency_link.ResourceDependencyLink, benchling_api_client.v2.beta.models.schema_dependency_link.SchemaDependencyLink, benchling_api_client.v2.beta.models.subdependency_link.SubdependencyLink, benchling_api_client.v2.beta.models.workflow_task_schema_dependency_link.WorkflowTaskSchemaDependencyLink, benchling_api_client.v2.beta.models.scalar_config.ScalarConfig, benchling_api_client.v2.beta.models.secure_text_config.SecureTextConfig]¶

Transform configuration item to a map.

This method can be overridden to change handling of UnknownType and type safety for ConfigurationReference.

class DropdownDependency¶

Bases: benchling_sdk.apps.config.dependencies.ApiDependency[benchling_api_client.v2.beta.models.dropdown_dependency_link.DropdownDependencyLink], benchling_sdk.apps.config.dependencies.Subdependencies

Dropdown Dependency.

Links a Benchling dropdown.

__init__(link: benchling_api_client.v2.beta.models.dropdown_dependency_link.DropdownDependencyLink) → None¶

Get options dependency links from a dropdown dependency.

subdependency_type_display_name() → str¶

Get the user-friendly name for this subdependency type.

class DropdownOptionsDependency¶

Bases: object

Dropdown Options Dependency.

Links a Benchling dropdown with options to the parent that owns those options.

__init__(parent: DropdownDependency) → None¶
parent: DropdownDependency¶
class EntitySchemaDependency¶

Bases: benchling_sdk.apps.config.dependencies.ApiDependency[benchling_api_client.v2.beta.models.entity_schema_dependency_link.EntitySchemaDependencyLink], benchling_sdk.apps.config.dependencies.SchemaFieldsMixin

Entity Schema Dependency.

Links a Benchling entity schema.

__init__(link: benchling_api_client.v2.beta.models.entity_schema_dependency_link.EntitySchemaDependencyLink) → None¶
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: benchling_api_client.v2.beta.models.scalar_config.ScalarConfig¶

Return the underlying scalar config.

property decryption_provider: Optional[BaseDecryptionProvider]¶

Return the decryption provider.

Bases: typing_extensions.Protocol

Has Entity Link.

A mixin for typing to assert that a particular class has a link to an entity schema.

__init__(*args, **kwargs)¶

Return the underlying schema dependency link.

Bases: typing_extensions.Protocol

Has Link.

A mixin for typing to assert that a particular class has any link.

__init__(*args, **kwargs)¶

Return the underlying dependency link.

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: benchling_api_client.v2.beta.models.scalar_config.ScalarConfig¶

Return the underlying scalar config.

property definition: Optional[ScalarDefinition]¶

Return the scalar definition, allowing for conversion to Python types.

Bases: typing_extensions.Protocol

Has Workflow Task Schema Link.

A mixin for typing to assert that a particular class has a link to a workflow task schema.

__init__(*args, **kwargs)¶

Return the underlying workflow task schema dependency link.

Bases: typing_extensions.Protocol

Has Workflow Task Schema Parent Link.

A mixin for typing to assert that a particular class has a link to a parent workflow task schema.

__init__(*args, **kwargs)¶
property parent: HasWorkflowTaskSchemaLink¶

Return the parent workflow task schema dependency link.

exception MissingAppConfigError¶

Bases: Exception

Missing app config error.

The app did not return any configuration. It may not have a manifest installed, or may not have been configured.

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 RequiredApiDependencyMixin¶

Bases: object

Require Api Link.

A mixin for accessing an API link which is required and should always be present. Should only be mixed in with ApiDependency or another class that provides the self.link attribute.

property id: str¶

Return the API ID of the linked configuration.

property name: str¶

Return the name of the linked configuration.

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 ScalarConfig.

property value: benchling_sdk.apps.config.scalars.ScalarType¶

Return the value of the scalar.

property value_str: str¶

Return the value of the scalar as a string.

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.

decrypted_value() → str¶

Decrypted value.

Decrypts a secure_text dependency’s encrypted value into plain text.

class ResourceDependency¶

Bases: benchling_sdk.apps.config.dependencies.ApiDependency[benchling_api_client.v2.beta.models.resource_dependency_link.ResourceDependencyLink]

Resource Dependency.

Holds a reference to an API identified Benchling resource. Typically a singleton, such as a registry, or particular entity.

__init__(link: benchling_api_client.v2.beta.models.resource_dependency_link.ResourceDependencyLink) → None¶
class ScalarDependency¶

Bases: object

Scalar Dependency.

Scalars are values that can be represented outside the Benchling domain.

__init__(config: Union[benchling_api_client.v2.beta.models.scalar_config.ScalarConfig, benchling_api_client.v2.beta.models.secure_text_config.SecureTextConfig], definition: Optional[ScalarDefinition]) → None¶
config: Union[benchling_api_client.v2.beta.models.scalar_config.ScalarConfig, benchling_api_client.v2.beta.models.secure_text_config.SecureTextConfig]¶
definition: Optional[ScalarDefinition]¶
class SchemaDependency¶

Bases: benchling_sdk.apps.config.dependencies.ApiDependency[benchling_api_client.v2.beta.models.schema_dependency_link.SchemaDependencyLink], benchling_sdk.apps.config.dependencies.SchemaFieldsMixin

Schema Dependency.

Links a Benchling schema for types other than bio entities.

__init__(link: benchling_api_client.v2.beta.models.schema_dependency_link.SchemaDependencyLink) → None¶
class SchemaFieldsDependency¶

Bases: object

Schema Fields Dependency.

Links a Benchling object with schema fields to the parent that owns those fields.

__init__(parent: Union[EntitySchemaDependency, SchemaDependency, WorkflowTaskSchemaDependency, WorkflowTaskSchemaOutputDependency]) → None¶
parent: Union[EntitySchemaDependency, SchemaDependency, WorkflowTaskSchemaDependency, WorkflowTaskSchemaOutputDependency]¶
class SchemaFieldsMixin¶

Bases: benchling_sdk.apps.config.dependencies.Subdependencies

Implements Subdependencies for schema fields.

Get field definition dependency links from a dependency with schema fields.

subdependency_type_display_name() → str¶

Get the user-friendly name for this subdependency type.

class SecureTextDependency¶

Bases: benchling_sdk.apps.config.dependencies.ScalarDependency

SecureText Config.

A dependency for accessing a secure_text config.

__init__(config: Union[benchling_api_client.v2.beta.models.scalar_config.ScalarConfig, benchling_api_client.v2.beta.models.secure_text_config.SecureTextConfig], 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: benchling_api_client.v2.beta.models.benchling_app_configuration.BenchlingAppConfiguration)¶

Initialize Static Config Provider.

Parameters

configuration – The configuration object to return.

config() → benchling_api_client.v2.beta.models.benchling_app_configuration.BenchlingAppConfiguration¶

Provide a Benchling app configuration from a static object.

class Subdependencies¶

Bases: abc.ABC

Subdependencies.

Assigns behavior to a class that can have a list of dependencies, such as schema fields or dropdown options.

subdependency_by_name(name: str) → benchling_api_client.v2.beta.models.subdependency_link.SubdependencyLink¶

Get a subdependency link by its name.

Implement to fetch the list of subdependency links.

property subdependency_mapping: Dict[str, benchling_api_client.v2.beta.models.subdependency_link.SubdependencyLink]¶

Access subdependencies as a map with names as the key and subdependency links as the values.

abstract subdependency_type_display_name() → str¶

Implement for user messaging, for example when surfacing errors.

class Subdependency¶

Bases: benchling_sdk.apps.config.dependencies.ApiDependency[benchling_api_client.v2.beta.models.subdependency_link.SubdependencyLink]

Subdependency.

Holds a reference to an API identified Benchling subdependency that belongs to a parent. Examples are fields on a schema or options on a dropdown.

__init__(link: benchling_api_client.v2.beta.models.subdependency_link.SubdependencyLink) → None¶
exception UnsupportedDependencyError¶

Bases: Exception

Unsupported dependency error.

The manifest and configuration specified a dependency which the SDK is incapable of handling yet.

class WorkflowTaskSchemaDependency¶

Bases: benchling_sdk.apps.config.dependencies.ApiDependency[benchling_api_client.v2.beta.models.workflow_task_schema_dependency_link.WorkflowTaskSchemaDependencyLink], benchling_sdk.apps.config.dependencies.SchemaFieldsMixin

Workflow Task Schema Dependency.

Links a Benchling workflow task schema.

__init__(link: benchling_api_client.v2.beta.models.workflow_task_schema_dependency_link.WorkflowTaskSchemaDependencyLink) → None¶
class WorkflowTaskSchemaOutputDependency¶

Bases: benchling_sdk.apps.config.dependencies.WorkflowTaskSchemaOutputFieldsMixin

Workflow Task Schema Output Dependency.

Links a Benchling workflow task schema output to its parent workflow task schema.

__init__(parent: WorkflowTaskSchemaDependency) → None¶
parent: WorkflowTaskSchemaDependency¶
class WorkflowTaskSchemaOutputFieldsMixin¶

Bases: benchling_sdk.apps.config.dependencies.Subdependencies

Implements Subdependencies for workflow task schema output schema fields.

Get field definition dependency links from a workflow task schema output with schema fields.

subdependency_type_display_name() → str¶

Get the user-friendly name for this subdependency type.