From 2e159d87cd61b1416c21ebd86984f92b080e7fe2 Mon Sep 17 00:00:00 2001 From: Mose Mueller Date: Thu, 1 Feb 2024 13:42:58 +0100 Subject: [PATCH] renaming to pydase_service_base --- README.md | 22 +++++++++---------- .../ionizer_interface/__init__.py | 3 --- .../__init__.py | 0 .../database/__init__.py | 0 .../database/config.py | 0 .../database/create_config.py | 0 .../database/influxdb_session.py | 2 +- .../database/postgres_session.py | 2 +- .../ionizer_interface/README.md | 2 +- .../ionizer_interface/__init__.py | 3 +++ .../ionizer_interface/ionizer_server.py | 5 ++++- .../ionizer_interface/rpc_interface.py | 0 pyproject.toml | 8 +++---- 13 files changed, 25 insertions(+), 22 deletions(-) delete mode 100644 icon_service_base/ionizer_interface/__init__.py rename {icon_service_base => pydase_service_base}/__init__.py (100%) rename {icon_service_base => pydase_service_base}/database/__init__.py (100%) rename {icon_service_base => pydase_service_base}/database/config.py (100%) rename {icon_service_base => pydase_service_base}/database/create_config.py (100%) rename {icon_service_base => pydase_service_base}/database/influxdb_session.py (98%) rename {icon_service_base => pydase_service_base}/database/postgres_session.py (99%) rename {icon_service_base => pydase_service_base}/ionizer_interface/README.md (94%) create mode 100644 pydase_service_base/ionizer_interface/__init__.py rename {icon_service_base => pydase_service_base}/ionizer_interface/ionizer_server.py (92%) rename {icon_service_base => pydase_service_base}/ionizer_interface/rpc_interface.py (100%) diff --git a/README.md b/README.md index a95c70a..49361e6 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,34 @@ -# ICON Service Base +# `pydase` Service Base -ICON Service Base is a shared code repository for Icon services in a service-based architecture. Written in Python, it provides the essential functionality for interacting with PostgreSQL and InfluxDB v2 databases. In addition, it offers the `Ionizer Interface`, enabling seamless integration between `pydase` applications and the Ionizer system. +`pydase` Service Base is a shared code repository for `pydase` services in a service-based architecture. Written in Python, it provides the essential functionality for interacting with PostgreSQL and InfluxDB v2 databases. In addition, it offers the `Ionizer Interface`, enabling seamless integration between `pydase` applications and the Ionizer system. ## Installation -Ensure you have Python 3.10 or later installed on your system. Dependencies of this package are managed with [`poetry`](https://python-poetry.org/docs/#installation). Install the `icon_service_base` as follows: +Ensure you have Python 3.10 or later installed on your system. Dependencies of this package are managed with [`poetry`](https://python-poetry.org/docs/#installation). Install the `pydase_service_base` as follows: ```bash -poetry add git+ssh://git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/icon_service_base.git +poetry add git+ssh://git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/pydase_service_base.git ``` To utilize specific functionalities such as `IonizerServer`, `InfluxDBSession`, or `PostgresDatabaseSession`, you need to install the relevant optional dependencies: - For `IonizerServer`, include the `ionizer` extra: ```bash - poetry add "git+ssh://git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/icon_service_base.git#main[ionizer]" + poetry add "git+ssh://git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/pydase_service_base.git#main[ionizer]" ``` - For `InfluxDBSession`, include the `influxdbv2` extra: ```bash - poetry add "git+ssh://git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/icon_service_base.git#main[influxdbv2]" + poetry add "git+ssh://git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/pydase_service_base.git#main[influxdbv2]" ``` - For `PostgresDatabaseSession`, include the `postgresql` extra: ```bash - poetry add "git+ssh://git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/icon_service_base.git#main[postgresql]" + poetry add "git+ssh://git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/pydase_service_base.git#main[postgresql]" ``` or directly add the following line to the `pyproject.toml` file: ```toml -icon-service-base = {git = "git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/icon_service_base.git", rev = "main", extras = ["ionizer", "postgresql", "ionizer"]} +pydase-service-base = {git = "git@gitlab.phys.ethz.ch:tiqi-projects/qchub/icon-services/pydase_service_base.git", rev = "main", extras = ["ionizer", "postgresql", "ionizer"]} ``` ## Configuration @@ -69,7 +69,7 @@ user: ... Interact with an InfluxDB server using the `InfluxDBSession` class. **Note that this class only supports InfluxDB v2** and **requires the `influxdbv2` optional dependency**. ```python -from icon_service_base.database import InfluxDBSession +from pydase_service_base.database import InfluxDBSession with InfluxDBSession() as influx_client: # Creating a bucket @@ -98,7 +98,7 @@ with InfluxDBSession() as influx_client: The `PostgresDatabaseSession` class allows interactions with a PostgreSQL database. **This class requires the `postgresql` optional dependency**. ```python -from icon_service_base.database import PostgresDatabaseSession +from pydase_service_base.database import PostgresDatabaseSession from your_module.models import YourModel # replace with your model from sqlmodel import select @@ -122,7 +122,7 @@ The `IonizerServer` provides an interface to seamlessly integrate `pydase` appli To deploy `IonizerServer` with your service: ```python -from icon_service_base.ionizer_interface import IonizerServer +from pydase_service_base.ionizer_interface import IonizerServer class YourServiceClass: # your implementation... diff --git a/icon_service_base/ionizer_interface/__init__.py b/icon_service_base/ionizer_interface/__init__.py deleted file mode 100644 index 9ec946f..0000000 --- a/icon_service_base/ionizer_interface/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from icon_service_base.ionizer_interface.ionizer_server import IonizerServer - -__all__ = ["IonizerServer"] diff --git a/icon_service_base/__init__.py b/pydase_service_base/__init__.py similarity index 100% rename from icon_service_base/__init__.py rename to pydase_service_base/__init__.py diff --git a/icon_service_base/database/__init__.py b/pydase_service_base/database/__init__.py similarity index 100% rename from icon_service_base/database/__init__.py rename to pydase_service_base/database/__init__.py diff --git a/icon_service_base/database/config.py b/pydase_service_base/database/config.py similarity index 100% rename from icon_service_base/database/config.py rename to pydase_service_base/database/config.py diff --git a/icon_service_base/database/create_config.py b/pydase_service_base/database/create_config.py similarity index 100% rename from icon_service_base/database/create_config.py rename to pydase_service_base/database/create_config.py diff --git a/icon_service_base/database/influxdb_session.py b/pydase_service_base/database/influxdb_session.py similarity index 98% rename from icon_service_base/database/influxdb_session.py rename to pydase_service_base/database/influxdb_session.py index b311113..cf231c8 100644 --- a/icon_service_base/database/influxdb_session.py +++ b/pydase_service_base/database/influxdb_session.py @@ -17,7 +17,7 @@ from influxdb_client.client.write.point import DEFAULT_WRITE_PRECISION from influxdb_client.client.write_api import SYNCHRONOUS from influxdb_client.rest import ApiException -from icon_service_base.database.config import InfluxDBConfig, ServiceConfig +from pydase_service_base.database.config import InfluxDBConfig if TYPE_CHECKING: from collections.abc import Iterable diff --git a/icon_service_base/database/postgres_session.py b/pydase_service_base/database/postgres_session.py similarity index 99% rename from icon_service_base/database/postgres_session.py rename to pydase_service_base/database/postgres_session.py index 1ddd1af..42fc98d 100644 --- a/icon_service_base/database/postgres_session.py +++ b/pydase_service_base/database/postgres_session.py @@ -10,7 +10,7 @@ from confz import FileSource from dateutil.parser import ParserError, parse # type: ignore from sqlmodel import Session, SQLModel, create_engine -from icon_service_base.database.config import ( +from pydase_service_base.database.config import ( OperationMode, PostgreSQLConfig, ServiceConfig, diff --git a/icon_service_base/ionizer_interface/README.md b/pydase_service_base/ionizer_interface/README.md similarity index 94% rename from icon_service_base/ionizer_interface/README.md rename to pydase_service_base/ionizer_interface/README.md index 517e3f4..20dfe90 100644 --- a/icon_service_base/ionizer_interface/README.md +++ b/pydase_service_base/ionizer_interface/README.md @@ -7,7 +7,7 @@ To deploy `IonizerServer` alongside your service, follow these steps: ```python -from icon_service_base.ionizer_interface import IonizerServer +from pydase_service_base.ionizer_interface import IonizerServer class YourServiceClass: # your implementation... diff --git a/pydase_service_base/ionizer_interface/__init__.py b/pydase_service_base/ionizer_interface/__init__.py new file mode 100644 index 0000000..f286ebd --- /dev/null +++ b/pydase_service_base/ionizer_interface/__init__.py @@ -0,0 +1,3 @@ +from pydase_service_base.ionizer_interface.ionizer_server import IonizerServer + +__all__ = ["IonizerServer"] diff --git a/icon_service_base/ionizer_interface/ionizer_server.py b/pydase_service_base/ionizer_interface/ionizer_server.py similarity index 92% rename from icon_service_base/ionizer_interface/ionizer_server.py rename to pydase_service_base/ionizer_interface/ionizer_server.py index d094d5e..a71a5e7 100644 --- a/icon_service_base/ionizer_interface/ionizer_server.py +++ b/pydase_service_base/ionizer_interface/ionizer_server.py @@ -9,7 +9,7 @@ import tiqi_rpc from pydase.data_service.data_service_observer import DataServiceObserver from pydase.utils.helpers import get_object_attr_from_path_list -from icon_service_base.ionizer_interface.rpc_interface import RPCInterface +from pydase_service_base.ionizer_interface.rpc_interface import RPCInterface logger = logging.getLogger(__name__) @@ -60,6 +60,9 @@ class IonizerServer: # internals of NumberSlider full_access_path = ".".join(full_access_path.split(".")[:-1]) + logger.debug( + "Updating Ionizer with %s", {"name": full_access_path, "value": value} + ) return self.server._handler.notify( # type: ignore {"name": full_access_path, "value": value} ) diff --git a/icon_service_base/ionizer_interface/rpc_interface.py b/pydase_service_base/ionizer_interface/rpc_interface.py similarity index 100% rename from icon_service_base/ionizer_interface/rpc_interface.py rename to pydase_service_base/ionizer_interface/rpc_interface.py diff --git a/pyproject.toml b/pyproject.toml index 0c591a1..fc816dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,11 @@ [tool.poetry] -name = "icon-service-base" +name = "pydase-service-base" version = "0.1.0" -description = "Repository storing the code that is common to all icon services." +description = "Repository storing the code that is common to all pydase services." authors = ["Mose Mueller "] license = "MIT" readme = "README.md" -packages = [{ include = "icon_service_base" }] +packages = [{ include = "pydase_service_base" }] [build-system] requires = ["poetry-core"] @@ -80,7 +80,7 @@ max-complexity = 7 [tool.pyright] -include = ["icon_service_base"] +include = ["pydase_service_base"] typeCheckingMode = "basic"