PosiStageNet parser
Project description
python-psn
Pure Python parsing library for PSN V2 - PosiStageNet
PSN specification as per GitHub repo
Installation
pip install pypsn
To install latest master from git, run pip:
python -m pip install https://codeload.github.com/open-stage/python-psn/zip/refs/heads/master
Usage
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, "10.0.0.1")
receiver.start() # start the receiving thread
receiver.stop() # stop receiving
See examples folder for some more examples.
Development, status
- Supporting PSN V2
- Parsing only, not sending
- Using threading module
- Linux, Windows and macOS tested
- Typed
- Initial pytest testing provided together with CI/CD setup
Type hints
- At this point, the
--no-strict-optional
is needed for mypy tests to pass:
mypy pypsn/*py --pretty --no-strict-optional
Format
- to format, use black
Testing
- to test, use
pytest
- to test typing with mypy use
pytest --mypy -m mypy pypsn/*py
Releasing to pypi
- update CHANGELOG.md
- increment version in setup.py
git tag versionCode
git push origin/versionCode
- generate wheel:
python3 setup.py sdist bdist_wheel
- test upload to TestPypi with twine:
python -m twine upload --repository testpypi dist/* --verbose
- release to official pypi:
python -m twine upload dist/*
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pypsn-0.1.0.tar.gz
(5.0 kB
view hashes)
Built Distribution
pypsn-0.1.0-py3-none-any.whl
(5.2 kB
view hashes)