mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-12-22 14:11:18 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77802da417 | ||
|
|
3e21858cb7 | ||
|
|
2003f28fd1 | ||
|
|
172b50bf77 | ||
|
|
ec5694fedf | ||
|
|
968f774092 | ||
|
|
757dc9aa3c | ||
|
|
3d938562a6 | ||
|
|
964a62d4b4 | ||
|
|
99aa38fcfe |
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pydase"
|
name = "pydase"
|
||||||
version = "0.10.3"
|
version = "0.10.5"
|
||||||
description = "A flexible and robust Python library for creating, managing, and interacting with data services, with built-in support for web and RPC servers, and customizable features for diverse use cases."
|
description = "A flexible and robust Python library for creating, managing, and interacting with data services, with built-in support for web and RPC servers, and customizable features for diverse use cases."
|
||||||
authors = ["Mose Mueller <mosmuell@ethz.ch>"]
|
authors = ["Mose Mueller <mosmuell@ethz.ch>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import socketio # type: ignore
|
|||||||
|
|
||||||
import pydase.components
|
import pydase.components
|
||||||
from pydase.client.proxy_loader import ProxyClassMixin, ProxyLoader
|
from pydase.client.proxy_loader import ProxyClassMixin, ProxyLoader
|
||||||
from pydase.utils.helpers import current_event_loop_exists
|
|
||||||
from pydase.utils.serialization.deserializer import loads
|
from pydase.utils.serialization.deserializer import loads
|
||||||
from pydase.utils.serialization.types import SerializedDataService, SerializedObject
|
from pydase.utils.serialization.types import SerializedDataService, SerializedObject
|
||||||
|
|
||||||
@@ -32,10 +31,7 @@ class NotifyDict(TypedDict):
|
|||||||
|
|
||||||
def asyncio_loop_thread(loop: asyncio.AbstractEventLoop) -> None:
|
def asyncio_loop_thread(loop: asyncio.AbstractEventLoop) -> None:
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
try:
|
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
except RuntimeError:
|
|
||||||
logger.debug("Tried starting even loop, but it is running already")
|
|
||||||
|
|
||||||
|
|
||||||
class ProxyClass(ProxyClassMixin, pydase.components.DeviceConnection):
|
class ProxyClass(ProxyClassMixin, pydase.components.DeviceConnection):
|
||||||
@@ -109,11 +105,7 @@ class Client:
|
|||||||
):
|
):
|
||||||
self._url = url
|
self._url = url
|
||||||
self._sio = socketio.AsyncClient()
|
self._sio = socketio.AsyncClient()
|
||||||
if not current_event_loop_exists():
|
|
||||||
self._loop = asyncio.new_event_loop()
|
self._loop = asyncio.new_event_loop()
|
||||||
asyncio.set_event_loop(self._loop)
|
|
||||||
else:
|
|
||||||
self._loop = asyncio.get_event_loop()
|
|
||||||
self.proxy = ProxyClass(sio_client=self._sio, loop=self._loop)
|
self.proxy = ProxyClass(sio_client=self._sio, loop=self._loop)
|
||||||
"""A proxy object representing the remote service, facilitating interaction as
|
"""A proxy object representing the remote service, facilitating interaction as
|
||||||
if it were local."""
|
if it were local."""
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from pydase.observer_pattern.observable.observable import (
|
|||||||
)
|
)
|
||||||
from pydase.utils.helpers import (
|
from pydase.utils.helpers import (
|
||||||
get_class_and_instance_attributes,
|
get_class_and_instance_attributes,
|
||||||
|
is_descriptor,
|
||||||
is_property_attribute,
|
is_property_attribute,
|
||||||
)
|
)
|
||||||
from pydase.utils.serialization.serializer import (
|
from pydase.utils.serialization.serializer import (
|
||||||
@@ -68,7 +69,7 @@ class DataService(AbstractDataService):
|
|||||||
if not issubclass(
|
if not issubclass(
|
||||||
value_class,
|
value_class,
|
||||||
(int | float | bool | str | list | dict | Enum | u.Quantity | Observable),
|
(int | float | bool | str | list | dict | Enum | u.Quantity | Observable),
|
||||||
):
|
) and not is_descriptor(__value):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Class '%s' does not inherit from DataService. This may lead to"
|
"Class '%s' does not inherit from DataService. This may lead to"
|
||||||
" unexpected behaviour!",
|
" unexpected behaviour!",
|
||||||
|
|||||||
@@ -1,24 +1,16 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
from collections.abc import Callable, Coroutine
|
from collections.abc import Callable, Coroutine
|
||||||
from typing import (
|
from typing import (
|
||||||
Generic,
|
Generic,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
)
|
)
|
||||||
|
|
||||||
from pydase.task.task_status import TaskStatus
|
|
||||||
|
|
||||||
if sys.version_info < (3, 11):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
import pydase.data_service.data_service
|
import pydase.data_service.data_service
|
||||||
|
from pydase.task.task_status import TaskStatus
|
||||||
from pydase.utils.helpers import current_event_loop_exists
|
from pydase.utils.helpers import current_event_loop_exists
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
R = TypeVar("R")
|
R = TypeVar("R")
|
||||||
|
|||||||
Reference in New Issue
Block a user