Pure Python parsing library for PSN V2 - PosiStageNet
pip install pypsn
To install latest master from git via pip:
python -m pip install https://codeload.github.com/open-stage/python-psn/zip/refs/heads/master
import pypsn
# define a callback function
def callback_function(data):
if isinstance(data, pypsn_module.psn_data_packet): # packet type: psn.psn_data_packet
for tracker in data.trackers: # loop through all trackers
print(tracker.pos) # print the received coordinates
if isinstance(data, pypsn_module.psn_info_packet): # packet type: psn.psn_info_packet
print(data.name) # print server name
for tracker in data.trackers: # loop through all trackers
print(tracker.tracker_name) # print the received tracker name
# provide a callback function and an IP address
receiver = pypsn.receiver(callback_function)
receiver.start() # start the receiving thread
receiver.stop() # stop receiving
See examples folder for some more examples.
- Supporting PSN V2
- Parsing only, not sending
- Using threading module
- Linux, Windows and macOS tested
- Typed, no-strict
- Initial pytest testing provided together with CI/CD setup
- At this point, the
--no-strict-optional
is needed for mypy tests to pass:
mypy pypsn/*py --pretty --no-strict-optional
- to format, use black
- to test, use
pytest
- to test typing with mypy use
pytest --mypy -m mypy pypsn/*py