https://github.com/swimos/swim-system-python
Standalone Python framework for building massively real-time streaming WARP clients.
https://github.com/swimos/swim-system-python
Last synced: 6 months ago
JSON representation
Standalone Python framework for building massively real-time streaming WARP clients.
- Host: GitHub
- URL: https://github.com/swimos/swim-system-python
- Owner: swimos
- License: apache-2.0
- Created: 2019-10-04T08:52:51.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-11-21T17:06:48.000Z (11 months ago)
- Last Synced: 2025-03-23T12:32:49.337Z (7 months ago)
- Language: Python
- Homepage:
- Size: 556 KB
- Stars: 9
- Watchers: 3
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Swim System Python Implementation
[](https://badge.fury.io/py/swimos)
[](https://dev.azure.com/swimai-build/swim-rust/_build/latest?definitionId=6&branchName=main)
[](LICENSE)
[](CODE_OF_CONDUCT.md)
[](https://gitter.im/swimos/community)The **Swim System** Python implementation provides a standalone set of
frameworks for building massively real-time streaming WARP clients.The **Swim Python Client** is a streaming API client for linking to lanes
of stateful Web Agents using the WARP protocol, enabling massively
real-time applications that continuously synchronize all shared states
with ping latency. WARP is like pub-sub without the broker,
enabling every state of a Web API to be streamed, without
interference from billions of queues.
## Installation
`pip install swimos`
## Usage
```python
# Setting the value of a value lane on a remote agent.
import timefrom swimos import SwimClient
with SwimClient() as swim_client:
host_uri = 'ws://localhost:9001'
node_uri = '/unit/foo'
lane_uri = 'info'value_downlink = swim_client.downlink_value()
value_downlink.set_host_uri('ws://localhost:9001')
value_downlink.set_node_uri('/unit/foo')
value_downlink.set_lane_uri('info')
value_downlink.open()new_value = 'Hello from Python!'
value_downlink.set(new_value)print('Stopping the client in 2 seconds')
time.sleep(2)
```
## Development### Dependencies
##### Code dependencies
`pip install -r requirements.txt`
##### Development tools dependencies
`pip install -r requirements-dev.txt`
### Run unit tests
##### Basic:
1) Install async test package: `pip install aiounittest`
2) Run tests: `python -m unittest`##### With coverage:
1) Install async test package: `pip install aiounittest`
2) Install coverage package: `pip install coverage`
3) Generate report: `coverage run --source=swimos -m unittest`
4) View report: `coverage report -m`### Run Lint
##### Manual
1) Install lint package: `pip install flake8`
2) Run checks: `flake8`
##### Automatic (before commit)
1) Install commit hook package: `pip install pre-commit`
2) Run hook installation: `pre-commit install`
### Build package
##### Building package distribution
1) Install build package: `pip install build`
2) Run: `python -m build`
##### Releasing a new version
1) Add version tag: `git tag VERSION (e.g. 0.1.0)`
2) Push to remote: `git push origin VERSION`