Metadata-Version: 2.1
Name: hi_tension
Version: 0.1.0
Classifiers: Programming Language :: Python :: 3
Classifiers: Development Status :: 3 - Alpha
Classifiers: License :: OSI Approved :: MIT License
Classifiers: Operating System :: OS Independent
Classifiers: Programming Language :: Rust
Classifiers: Intended Audience :: Science/Research
Classifiers: Topic :: Scientific/Engineering
Classifiers: Topic :: System :: Networking
Requires-Dist: numpy>=1.18.4
Summary: Basic but fast network communication between scientific applications
Author: gggto <47183108+gggto@users.noreply.github.com>
Author-Email: gggto <47183108+gggto@users.noreply.github.com>
License: MIT
Requires-Python: >=3.6
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/gggto/py-hi-tension

# py-hi-tension, hi-tension for Python

`py-hi-tension` is a Python module designed for *basic* but *fast* network
communication between scientific applications, backed by
[`hi-tension`](https://github.com/gggto/hi-tension). The focus is on
transferring large unsized arrays of `f64` with maximum throughput and minimum
latency. More informations to be found in `hi-tension`'s [github
page](https://github.com/gggto/hi-tension).

## Usage

Using the library is quite simple:
```python
# Connect to a server
socket = HiTensionSocket.connect("127.0.0.1:34487")
# You can make such a server though the following line:
# socket = HiTensionSocket.accept("127.0.0.1:34487")

# Send a simple text message
socket.send(b"status\n")
# Receive a simple text message
text_data = socket.read()

# Send formatted data as simple text message
id = 1
msg = f"do_something {id + 1}\n"
socket.send(msg.encode())

# Send formatted data and receive a high tension message
msg = f"fly {id}\n"
socket.send(msg.encode())
array = socket.hiread() # array is a numpy array

# Send the array back as a high tension message
socket.hisend(array)
socket.hidelimiter()

# You can send the array back
socket.hisend(array)
socket.hidelimiter()

# You may send your data in multible packets
socket.hisend(array[:10])
socket.hisend(array[10:])
socket.hidelimiter()
# This is useful for example if you are calculating your data while
# transferring it.
```

