Updating Readme

This commit is contained in:
Mose Müller 2023-08-02 14:56:23 +02:00
parent f1ab0acb05
commit d47d467061

View File

@ -12,21 +12,30 @@
## Installation ## Installation
Install pydase using [`poetry`](python-poetry.org/): Install pydase using [`poetry`](https://python-poetry.org/):
```bash ```bash
poetry add git+https://github.com/tiqi-group/pydase.git poetry add git+https://github.com/tiqi-group/pydase.git
``` ```
or `pip`:
```bash
pip install git+https://github.com/tiqi-group/pydase.git
```
## Usage ## 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: Here's an example:
```python ```python
from pydase import DataService, Server from pydase import DataService
from pydase.components import NumberSlider
class Device(DataService): class Device(DataService):
@ -67,13 +76,33 @@ class Device(DataService):
def reset(self): def reset(self):
self.current = 0.0 self.current = 0.0
self.voltage = 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__": if __name__ == "__main__":
service = ServiceClass() service = Device()
Server(service).run() 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:
![Web Interface](./docs/images/Example_App.png)
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 ## Documentation
For more details about usage and features, see the [full documentation](URL_TO_YOUR_DOCUMENTATION). For more details about usage and features, see the [full documentation](URL_TO_YOUR_DOCUMENTATION).