renaming to pydase_service_base

This commit is contained in:
Mose Mueller 2024-02-01 13:42:58 +01:00
parent 6619895239
commit 2e159d87cd
13 changed files with 25 additions and 22 deletions

View File

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

View File

@ -1,3 +0,0 @@
from icon_service_base.ionizer_interface.ionizer_server import IonizerServer
__all__ = ["IonizerServer"]

View File

@ -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

View File

@ -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,

View File

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

View File

@ -0,0 +1,3 @@
from pydase_service_base.ionizer_interface.ionizer_server import IonizerServer
__all__ = ["IonizerServer"]

View File

@ -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}
)

View File

@ -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 <mosmuell@ethz.ch>"]
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"