mirror of
https://github.com/tiqi-group/pydase_service_base.git
synced 2025-04-20 08:20:03 +02:00
renaming to pydase_service_base
This commit is contained in:
parent
6619895239
commit
2e159d87cd
22
README.md
22
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
|
## 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
|
```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:
|
To utilize specific functionalities such as `IonizerServer`, `InfluxDBSession`, or `PostgresDatabaseSession`, you need to install the relevant optional dependencies:
|
||||||
|
|
||||||
- For `IonizerServer`, include the `ionizer` extra:
|
- For `IonizerServer`, include the `ionizer` extra:
|
||||||
```bash
|
```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:
|
- For `InfluxDBSession`, include the `influxdbv2` extra:
|
||||||
```bash
|
```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:
|
- For `PostgresDatabaseSession`, include the `postgresql` extra:
|
||||||
```bash
|
```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:
|
or directly add the following line to the `pyproject.toml` file:
|
||||||
|
|
||||||
```toml
|
```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
|
## 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**.
|
Interact with an InfluxDB server using the `InfluxDBSession` class. **Note that this class only supports InfluxDB v2** and **requires the `influxdbv2` optional dependency**.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from icon_service_base.database import InfluxDBSession
|
from pydase_service_base.database import InfluxDBSession
|
||||||
|
|
||||||
with InfluxDBSession() as influx_client:
|
with InfluxDBSession() as influx_client:
|
||||||
# Creating a bucket
|
# 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**.
|
The `PostgresDatabaseSession` class allows interactions with a PostgreSQL database. **This class requires the `postgresql` optional dependency**.
|
||||||
|
|
||||||
```python
|
```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 your_module.models import YourModel # replace with your model
|
||||||
from sqlmodel import select
|
from sqlmodel import select
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ The `IonizerServer` provides an interface to seamlessly integrate `pydase` appli
|
|||||||
To deploy `IonizerServer` with your service:
|
To deploy `IonizerServer` with your service:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from icon_service_base.ionizer_interface import IonizerServer
|
from pydase_service_base.ionizer_interface import IonizerServer
|
||||||
|
|
||||||
class YourServiceClass:
|
class YourServiceClass:
|
||||||
# your implementation...
|
# your implementation...
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
from icon_service_base.ionizer_interface.ionizer_server import IonizerServer
|
|
||||||
|
|
||||||
__all__ = ["IonizerServer"]
|
|
@ -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.client.write_api import SYNCHRONOUS
|
||||||
from influxdb_client.rest import ApiException
|
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:
|
if TYPE_CHECKING:
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
@ -10,7 +10,7 @@ from confz import FileSource
|
|||||||
from dateutil.parser import ParserError, parse # type: ignore
|
from dateutil.parser import ParserError, parse # type: ignore
|
||||||
from sqlmodel import Session, SQLModel, create_engine
|
from sqlmodel import Session, SQLModel, create_engine
|
||||||
|
|
||||||
from icon_service_base.database.config import (
|
from pydase_service_base.database.config import (
|
||||||
OperationMode,
|
OperationMode,
|
||||||
PostgreSQLConfig,
|
PostgreSQLConfig,
|
||||||
ServiceConfig,
|
ServiceConfig,
|
@ -7,7 +7,7 @@
|
|||||||
To deploy `IonizerServer` alongside your service, follow these steps:
|
To deploy `IonizerServer` alongside your service, follow these steps:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from icon_service_base.ionizer_interface import IonizerServer
|
from pydase_service_base.ionizer_interface import IonizerServer
|
||||||
|
|
||||||
class YourServiceClass:
|
class YourServiceClass:
|
||||||
# your implementation...
|
# your implementation...
|
3
pydase_service_base/ionizer_interface/__init__.py
Normal file
3
pydase_service_base/ionizer_interface/__init__.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from pydase_service_base.ionizer_interface.ionizer_server import IonizerServer
|
||||||
|
|
||||||
|
__all__ = ["IonizerServer"]
|
@ -9,7 +9,7 @@ import tiqi_rpc
|
|||||||
from pydase.data_service.data_service_observer import DataServiceObserver
|
from pydase.data_service.data_service_observer import DataServiceObserver
|
||||||
from pydase.utils.helpers import get_object_attr_from_path_list
|
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__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -60,6 +60,9 @@ class IonizerServer:
|
|||||||
# internals of NumberSlider
|
# internals of NumberSlider
|
||||||
full_access_path = ".".join(full_access_path.split(".")[:-1])
|
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
|
return self.server._handler.notify( # type: ignore
|
||||||
{"name": full_access_path, "value": value}
|
{"name": full_access_path, "value": value}
|
||||||
)
|
)
|
@ -1,11 +1,11 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "icon-service-base"
|
name = "pydase-service-base"
|
||||||
version = "0.1.0"
|
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>"]
|
authors = ["Mose Mueller <mosmuell@ethz.ch>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
packages = [{ include = "icon_service_base" }]
|
packages = [{ include = "pydase_service_base" }]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
@ -80,7 +80,7 @@ max-complexity = 7
|
|||||||
|
|
||||||
|
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
include = ["icon_service_base"]
|
include = ["pydase_service_base"]
|
||||||
typeCheckingMode = "basic"
|
typeCheckingMode = "basic"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user