ds_resource_plugin_py_lib.common.resource.client ================================================ .. py:module:: ds_resource_plugin_py_lib.common.resource.client .. autoapi-nested-parse:: **File:** ``client.py`` **Region:** ``ds_resource_plugin_py_lib/common/resource`` Description ----------- Resource client for discovering and managing datasets and linked services using entry points. .. rubric:: Example .. code-block:: python from ds_resource_plugin_py_lib.common.resource.client import ResourceClient client = ResourceClient() # Inspect discovered resources (populated via Python entry points). print(client.resources.keys()) print(client.linked_services.keys()) print(client.datasets.keys()) dataset = client.dataset(config={"type": "dataset.example", "version": "1.0.0"}) linked_service = client.linked_service(config={"type": "linked_service.example", "version": "1.0.0"}) linked_service.connect() print(linked_service.connection) print(dataset.read()) Attributes ---------- .. autoapisummary:: ds_resource_plugin_py_lib.common.resource.client.logger Classes ------- .. autoapisummary:: ds_resource_plugin_py_lib.common.resource.client.ResourceClient Module Contents --------------- .. py:data:: logger .. py:class:: ResourceClient .. py:attribute:: PROTOCOL_GROUP :value: 'ds.protocols' .. py:attribute:: PROVIDER_GROUP :value: 'ds.providers' .. py:attribute:: _resource_dict :type: dict[str, dict[str, Any]] .. py:attribute:: _linked_services :type: dict[tuple[str, str], ds_resource_plugin_py_lib.common.resource.linked_service.base.LinkedServiceInfo] .. py:attribute:: _datasets :type: dict[tuple[str, str], ds_resource_plugin_py_lib.common.resource.dataset.base.DatasetInfo] .. py:method:: get_instance() -> ResourceClient :classmethod: Get the singleton instance of ResourceClient. .. py:property:: resources :type: dict[str, dict[str, Any]] .. py:property:: linked_services :type: dict[tuple[str, str], ds_resource_plugin_py_lib.common.resource.linked_service.base.LinkedServiceInfo] .. py:property:: datasets :type: dict[tuple[str, str], ds_resource_plugin_py_lib.common.resource.dataset.base.DatasetInfo] .. py:method:: _discover_resources(group: str) -> None Discover protocol/provider packages via entry points. Each entry point must target a Python package that contains resource.yaml in its root. .. py:method:: _scan_resource_directory(resource_dir: str) -> None Scan a resource directory for resource.yaml. Checks root first (new behavior), then subdirectories (old behavior). :param resource_dir: Path to the resource directory. .. py:method:: _load_resource_from_path(path: str) -> None Load resource configuration from a directory path. :param path: Path to the resource directory. .. py:method:: _parse_linked_services(config: dict[str, Any]) -> None Parse linked services from resource configuration. :param config: Resource configuration dictionary. .. py:method:: _parse_datasets(config: dict[str, Any]) -> None Parse datasets from resource configuration. :param config: Resource configuration dictionary. .. py:method:: _get_dataset_model_cls(_type: str, version: str) -> type[ds_resource_plugin_py_lib.common.resource.dataset.base.Dataset[Any, Any, Any, Any]] Get a dataset model class by type and optionally version. :param _type: str :param version: str :returns: Type[Dataset] .. py:method:: _get_linked_service_model_cls(_type: str, version: str) -> type[ds_resource_plugin_py_lib.common.resource.linked_service.base.LinkedService[Any]] Get a linked service model class by type and version. :param _type: The type of the linked service. :param version: str version of the linked service. :returns: Type[LinkedService] .. py:method:: linked_service(config: dict[str, Any]) -> ds_resource_plugin_py_lib.common.resource.linked_service.base.LinkedService[Any] Get a linked service instance by configuration. :param config: dict containing at least 'type' and 'version' :returns: LinkedService :raises DeserializationError: If the linked service cannot be deserialized. .. py:method:: dataset(config: dict[str, Any]) -> ds_resource_plugin_py_lib.common.resource.dataset.base.Dataset[Any, Any, Any, Any] Get a dataset instance by configuration. :param config: dict containing at least 'type' and 'version' :returns: Dataset :raises DeserializationError: If the dataset cannot be deserialized.