Create an entanglement across network and even programming language.
Project description
# Entangle-Python [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
wasd
## Install
Simply pip install from the github repo.
```bash
pip install entangle-python
```
## Usage
### Entanglement Server
Note that an entanglement object corresponds to a client.
```python
import entangle
# Define a callback for every new entanglement
def on_entangle(entanglement):
def rprint(x):
print(x)
entanglement.test = x
entanglement.rprint = rprint
# Listen for entanglements (listenes in blocking mode)
entangle.listen(host="localhost", port=12345, password="42", callback=on_entangle)
```
### Entanglement Client
If your script wants to connect to an entanglement server use the following.
```python
import entangle
def on_entangle(entanglement):
entanglement.remote_fun("rprint")("Hello Universe!")
entanglement.close()
# asyncronously connect to a client (entanglement spawns a daemon thread)
entangle.connect(host="localhost", port=12345, password="42", callback=on_entangle)
```
wasd
## Install
Simply pip install from the github repo.
```bash
pip install entangle-python
```
## Usage
### Entanglement Server
Note that an entanglement object corresponds to a client.
```python
import entangle
# Define a callback for every new entanglement
def on_entangle(entanglement):
def rprint(x):
print(x)
entanglement.test = x
entanglement.rprint = rprint
# Listen for entanglements (listenes in blocking mode)
entangle.listen(host="localhost", port=12345, password="42", callback=on_entangle)
```
### Entanglement Client
If your script wants to connect to an entanglement server use the following.
```python
import entangle
def on_entangle(entanglement):
entanglement.remote_fun("rprint")("Hello Universe!")
entanglement.close()
# asyncronously connect to a client (entanglement spawns a daemon thread)
entangle.connect(host="localhost", port=12345, password="42", callback=on_entangle)
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
entangle-python-0.0.1.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for entangle_python-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28f36f713f17110e586a593f2e7cb34a5dc716d0420d37fed7ead07d4c1001c1 |
|
MD5 | a824453b15451e78cff29de5168304b0 |
|
BLAKE2b-256 | eaa76c78c21b4bf34c17c3b2c40685a08a295ed4afbf4e84ad4667751d6e4ccb |