mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-20 00:10:03 +02:00
Updating Readme
This commit is contained in:
parent
f1ab0acb05
commit
d47d467061
39
README.md
39
README.md
@ -12,21 +12,30 @@
|
||||
|
||||
## Installation
|
||||
|
||||
Install pydase using [`poetry`](python-poetry.org/):
|
||||
Install pydase using [`poetry`](https://python-poetry.org/):
|
||||
|
||||
```bash
|
||||
poetry add git+https://github.com/tiqi-group/pydase.git
|
||||
```
|
||||
|
||||
or `pip`:
|
||||
|
||||
```bash
|
||||
pip install git+https://github.com/tiqi-group/pydase.git
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
To use pydase, you will need to create a class that inherits from `DataService`. This class will be exposed via RPC (using rpyc) and a web server. The class can implement class / instance attributes and synchronous and asynchronous tasks.
|
||||
Using `pydase` involves two main steps: defining a `DataService` subclass and then running the server.
|
||||
|
||||
### Defining a DataService
|
||||
|
||||
To use pydase, you'll first need to create a class that inherits from `DataService`. This class represents your custom data service, which will be exposed via RPC (using rpyc) and a web server. Your class can implement class / instance attributes and synchronous and asynchronous tasks.
|
||||
|
||||
Here's an example:
|
||||
|
||||
```python
|
||||
from pydase import DataService, Server
|
||||
from pydase.components import NumberSlider
|
||||
from pydase import DataService
|
||||
|
||||
class Device(DataService):
|
||||
|
||||
@ -67,13 +76,33 @@ class Device(DataService):
|
||||
def reset(self):
|
||||
self.current = 0.0
|
||||
self.voltage = 0.0
|
||||
```
|
||||
In the above example, we define a Device class that extends DataService. We define a few properties (current, voltage, power) and their getter and setter methods.
|
||||
|
||||
### Running the Server
|
||||
|
||||
Once your DataService is defined, you can create an instance of it and run the server:
|
||||
|
||||
```python
|
||||
from pydase import Server
|
||||
|
||||
# ... defining the Device class ...
|
||||
|
||||
if __name__ == "__main__":
|
||||
service = ServiceClass()
|
||||
service = Device()
|
||||
Server(service).run()
|
||||
```
|
||||
|
||||
This will start the server, making your Device service accessible via RPC and a web server at http://localhost:8001.
|
||||
|
||||
### Accessing the Web Interface
|
||||
|
||||
Once the server is running, you can access the web interface in a browser:
|
||||
|
||||

|
||||
|
||||
In this interface, you can interact with the properties of your `Device` service. For more details about using this interface, see the [full documentation](URL_TO_YOUR_DOCUMENTATION).
|
||||
|
||||
## Documentation
|
||||
|
||||
For more details about usage and features, see the [full documentation](URL_TO_YOUR_DOCUMENTATION).
|
||||
|
Loading…
x
Reference in New Issue
Block a user