PyPlotJuggling
PyPlotJuggling is a Python library for sending data over UDP, with a focus on providing analytics about the data transmission. It's designed to be used in applications where you need to stream data to a remote endpoint and monitor the performance of the data transfer.
Installation
You can install PyPlotJuggling using pip:
pip install pyplotjuggling
Usage
The main component of PyPlotJuggling is the PortJugglerClient, which is used to send data to a specified IP address and port. It also provides analytics about the data being sent.
Basic Usage
Here's a simple example of how to use PortJugglerClient:
from PyPlotJuggling import PlotJugglerClient, PJData
import time
# Create a client
client = PlotJugglerClient("127.0.0.1", 12345)
# Send some data
for i in range(10):
data = PJData(values={"value": i})
client.send(data)
time.sleep(0.1)
# Close the client
client.close()
Analytics
PortJugglerClient can provide analytics about the data being sent. There are four analytics modes, which can be set using the analytics parameter in the constructor:
AnalyticsMode.OFF: No analytics are collected. This is the default.AnalyticsMode.BASIC: Basic analytics are collected, but not sent with the data. You can get the analytics by calling theget_analytics()method.AnalyticsMode.IN_JUGGLER: The analytics data is included in the data sent to the remote endpoint. The analytics data is added to thevaluesdictionary of thePJDataobject, under the key "analytics".AnalyticsMode.PERIODIC: Analytics are logged periodically to the console. The interval can be set with theperiodic_intervalparameter.
Here's an example of how to use the IN_JUGGLER analytics mode:
from PyPlotJuggling import PlotJugglerClient, PJData, AnalyticsMode
import time
# Create a client with IN_JUGGLER analytics mode
client = PlotJugglerClient("127.0.0.1", 12345, analytics=AnalyticsMode.IN_JUGGLER)
# Send some data
for i in range(10):
data = PJData(values={"value": i})
client.send(data)
time.sleep(0.1)
# Close the client
client.close()
Analytics Data
The analytics data is provided as an AnalyticsModel object, which has the following fields:
num_values: The number of values in the last sentPJDataobject.frequency: The momentary frequency of messages sent, in Hz.duration: The total duration of the client's life, in seconds.rate: The momentary rate of data sent, in bytes per second.ow_warning: A boolean that is set toTrueif theanalyticskey is already present in thePJDataobject'svaluesdictionary when usingIN_JUGGLERmode.window_size: The size of the analytics window in seconds.
Periodic Analytics with Callback
When using AnalyticsMode.PERIODIC, you can also provide a callback function to process the analytics data.
from PyPlotJuggling import PlotJugglerClient, PJData, AnalyticsMode, AnalyticsModel
import time
def my_analytics_callback(analytics: AnalyticsModel):
print(f"Custom callback: {analytics.frequency:.2f} Hz")
# Create a client with a callback
client = PlotJugglerClient(
"127.0.0.1",
12345,
analytics=AnalyticsMode.PERIODIC,
periodic_interval=1.0,
analytics_callback=my_analytics_callback
)
# Send data for a few seconds
for i in range(50):
data = PJData(values={"value": i})
client.send(data)
time.sleep(0.1)
client.close()
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
This project is licensed under the terms of the LICENSE file.
Metadata
Release files for PyPlotJuggling 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyplotjuggling-1.0.2.tar.gz | 5.6 kB | Without provenance | Details for pyplotjuggling-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyplotjuggling-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for pyplotjuggling-1.0.2-py3-none-any.whl |
Total release size: 11.7 kB
Release files / pyplotjuggling-1.0.2.tar.gz
| Download URL | pyplotjuggling-1.0.2.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18fc695fa58c8d0ff6be8dbc35cdb92ede1d59901fd9c27422e63d3a090e7618
|
|
BLAKE2b-256 checksum How to use checksums |
430931f9e51ed547e1011985e6e1214c40a7dad52a1fcacee4a94405f8489793
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pyplotjuggling-1.0.2-py3-none-any.whl
| Download URL | pyplotjuggling-1.0.2-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
034561b85073113ef08b3aca89426305e49ec8c8a02d4f5b0b748292a38f58d2
|
|
BLAKE2b-256 checksum How to use checksums |
4394ac331f19232c2aa47a85a4749e1c4ca7b4559f03a93e5361338231da4dbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for PyPlotJuggling 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.