semvec/pypi-packages huggingface dataset:
pyAttention 0.1.3
A library to monitor information sources
License: MIT
Requires Python: <4.0,>=3.9
Keywords: pyAttention, data, database, rss, sql, socketio, websocket, volumio, mpd, light, weight, message, broker

# pyAttention
A library to monitor information sources

![build](https://github.com/dhrone/pyAttention/actions/workflows/test.yml/badge.svg) [![codecov](https://codecov.io/gh/dhrone/pyAttention/branch/master/graph/badge.svg?token=ZCAT8XRG4W)](https://codecov.io/gh/dhrone/pyAttention)

## Key Features

* Retrieves data from TCP servers, socketIO services, RSS feeds, and SQL databases
* Retrieves basic system data from linux-based computers (disk space, IP address, temperatures)
* Provides a queue interface for retrieving received information
* Supports polling and asynchronous monitoring
* Sources can be run individually or monitored together as a collection
* Sources run in their own thread or can share a thread across a collection

## Installation

```shell
# Installation from pypi
pip pyAttention

# or
# Installation from github
$ git clone https://github.com/dhrone/pyAttention

# Install optional dependencies
# Databases
$ pip install sqlalchemy
$ pip install aiosqlite  # For sqlite database support
$ pip install asyncpg    # For PostgreSQL
$ pip install aiomysql   # For mySQL

# RSS Feeds
$ pip install httpx lxml beautifulsoup4

# socketIO services
$ pip install python-socketio[client]==4.6.* aiohttp

# Local system data
$ pip install psutil netifaces
```

## Quickstart

To retrieve data from a RSS feed

```python
from pyAttention.source import rss

# EXAMPLE: Pull 3 day forecast of Manchester, UK from the BBC News RSS feed
url = 'https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/2643123'
from pyAttention.source import rss
src = rss(url, frequency=21600)  # Query feed every 6 hours
weather = src.get()
```

To retrieve data from a socketIO service

```python
# EXAMPLE: monitor Volumio metadata from its socketIO API (see https://volumio.org)  
from pyAttention.source import socketIO
url = 'http://localhost:3000'
src = socketIO(url)

async def callback(data):
  await src.put(data)

src.subscribe('pushState', callback)
src.emit('getState')  # Command needed to get Volumio to send a pushState message
state = src.get()
```

To retrieve data from a database

```python
# EXAMPLE: pull data from a locally stored sqlite database
# Create test db
import sqlite3
con = sqlite3.connect('songs.db')
cur = con.cursor()
cur.execute('''CREATE TABLE songs (artist text, title text, album text)''')
cur.execute('''INSERT INTO songs VALUES ('Billie Eilish', 'bad guy', 'When We All Fall Asleep, Where Do We Go?')''')
cur.close()

from pyAttention.source import database
uri = 'sqlite+aiosqlite:///./songs.db'
src = database(uri, 'select * from songs')
songs = src.get()
```
sdl-webui-lite 0.1.2
This web UI aims to ease up the control of any Python-based SDLs by displaying functions and their parameters dynamically.
License: MIT

# Self-driving lab Web UI - lite
We don't define Self-driving labs (SDLs). We enable UI for them. 
This is the lite version of Hein Lab [SDL Web UI](https://gitlab.com/heingroup/web_controller)

## Description


Granting SDL flexibility makes it impossible to design a UI, yet it's a necessity for allowing more people to interact with it. 
This web UI aims to ease up the control of any Python-based SDLs by displaying functions and parameters dynamically. 
This lite version allow user to put actions in queue for simply workflow design. 

## Installation
```
pip install sdl-webui-lite
```

## Usage
in your self-driving platform class, use `start_gui(your_sdl)`. Example in [sample_code.py](sample_code.py)
```python
sdl = YourSDL()
from sdl_webui_lite.app import start_gui
start_gui(sdl)
```
## Additional settings
You can change the log file name/path, and the current SDL name, as this will reflect on the webapp page and title.
You can also add other loggers
```python
sdl = YourSDL()
from sdl_webui_lite.app import app, start_gui
app.config["DEBUG"] = False     # show fucntions startwith "_" if True
app.config["LOG_FILENAME"] = "/path/to/log.log"
app.config["TITLE"] = "Your SDL name"
start_gui(sdl, logger="your logger name")
# or
# start_gui(sdl, logger=["your logger name", "another logger"]) 
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Authors
Ivory Zhang | Hein Lab ([ivoryzhang@chem.ubc.ca]())

## UI snapshot
![page_screenshot.png](sdl_webui_lite/static/page_screenshot.png)