Python client to communicate with FarSounder's ARGOS sensors
Project description
Python API Client for Argos data
Python client to communicate with SonaSoft via API.
[!NOTE] This is still under active development and testing. But may serve as an example for integration, beyond the lower level example in sdk repo. For now the docs are the interfaces and the examples in examples/
Usage
Clone locally and install (uv add .) or install from pypi like:
uv add farsounder
(or use pip, etc)
Then - for example to subscribe to TargetData messages:
import time
from farsounder import config, requests, subscriber
from farsounder.proto import nav_api_pb2
def main() -> None:
# Build the configuration:
# - where is the api running?
# - what messages do you care about subscribing to?
# - if ports are changed, they can overridden here
cfg = config.build_config(
host="127.0.0.1",
subscribe=["TargetData"],
)
# Pub/Sub
sub = subscriber.subscribe(cfg)
# A callback to run when there are new target data messages
# - don't do a lot of processing in here it will block (thank GIL - for now...)
# - use sync mechanism if you're accessing shared data (callbacks
# run on thread pool [default] or on the receive thread for the message
# type)
def on_targets(message: nav_api_pb2.TargetData) -> None:
print("Got a TargetData!")
print("Targets:", len(message.groups))
# register the callback(s)
sub.on("TargetData", on_targets)
# start the receive loop
sub.start()
# Req/rep
# for each of the request / reply endpoints - there are specific
# get/set functions
settings = requests.get_processor_settings(cfg)
print(settings)
history = requests.get_history_data(
cfg,
latitude=41.7223,
longitude=-71.35,
radius_meters=500,
)
print(history.gridded_bottom_detections)
time.sleep(1.0)
# Stop receive loop
sub.stop()
if __name__ == "__main__":
main()
Simulated backend
You can run a local simulated backend that publishes dummy messages and responds to request/reply calls:
uv run examples/simulated_backend.py
Note: the examples/ directory is not installed with uv add farsounder.
Clone the repo to run the examples locally.
Development
Re-generate Protobuf stubs
Protobuf sources live in proto/. Generate Python stubs with:
uv run --group dev gen-protos
Or:
uv run tools/gen_protos.py
Tests
Run tests with:
uv run --group dev pytest
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file farsounder-0.1.1.tar.gz.
File metadata
- Download URL: farsounder-0.1.1.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b611913666e87a8bf48d8c3136c7ff3bbb27ecb9b00eb2a6d7ebb202f1ada3f9
|
|
| MD5 |
25329f77589cc89af388f13524299ad5
|
|
| BLAKE2b-256 |
ca849c168b7dd7e4ffad4d757ef9051891a9491ee9a4942813f75fbee0e4037c
|
File details
Details for the file farsounder-0.1.1-py3-none-any.whl.
File metadata
- Download URL: farsounder-0.1.1-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14413b9fbbbb7cfa755afcf8770efc5cff26874ff4e979628199438c49f65a9c
|
|
| MD5 |
28ae9b4a913710d879f372c3f563fa17
|
|
| BLAKE2b-256 |
49fc779695a5893b6f8016d85049080600b9f6547d367bd97f768268f3eb988c
|