Name | pypsn JSON |
Version |
0.2.3
JSON |
| download |
home_page | None |
Summary | PosiStageNet parser |
upload_time | 2024-07-18 20:47:42 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License |
keywords |
psn
posistagenet
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# python-psn
Pure Python parsing library for PSN V2 - [PosiStageNet](https://posistage.net/)
[Official PSN specification](https://github.com/vyv/psn-cpp/blob/master/doc/PosiStageNetprotocol_v2.03_2019_09_09.pdf)
[Source code](https://github.com/open-stage/python-psn)
[PyPi page](https://pypi.org/project/pypsn/)
[![Pytest](https://github.com/open-stage/python-psn/actions/workflows/run-tests.yaml/badge.svg)](https://github.com/open-stage/python-psn/actions/workflows/run-tests.yaml)
[![Check links in markdown](https://github.com/open-stage/python-psn/actions/workflows/check-links.yaml/badge.svg)](https://github.com/open-stage/python-psn/actions/workflows/check-links.yaml)
## Installation
```bash
pip install pypsn
```
To install latest master from git via pip:
```bash
python -m pip install https://codeload.github.com/open-stage/python-psn/zip/refs/heads/master
```
## Usage
```python
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.
## Development, status
- 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
### Type hints
* At this point, the `--no-strict-optional` is needed for mypy tests to pass:
```bash
mypy pypsn/*py --pretty --no-strict-optional
```
### Format
- to format, use [black](https://pypi.org/project/black/)
### Testing
- to test, use `pytest`
- to test typing with mypy use
```bash
pytest --mypy -m mypy pypsn/*py
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pypsn",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "vanous <noreply@nodomain.com>",
"keywords": "PSN, PosiStageNet",
"author": null,
"author_email": "vanous <noreply@nodomain.com>",
"download_url": null,
"platform": null,
"description": "# python-psn\n\nPure Python parsing library for PSN V2 - [PosiStageNet](https://posistage.net/)\n\n[Official PSN specification](https://github.com/vyv/psn-cpp/blob/master/doc/PosiStageNetprotocol_v2.03_2019_09_09.pdf)\n\n[Source code](https://github.com/open-stage/python-psn)\n\n[PyPi page](https://pypi.org/project/pypsn/)\n\n[![Pytest](https://github.com/open-stage/python-psn/actions/workflows/run-tests.yaml/badge.svg)](https://github.com/open-stage/python-psn/actions/workflows/run-tests.yaml)\n\n[![Check links in markdown](https://github.com/open-stage/python-psn/actions/workflows/check-links.yaml/badge.svg)](https://github.com/open-stage/python-psn/actions/workflows/check-links.yaml)\n\n## Installation\n\n```bash\npip install pypsn\n```\n\nTo install latest master from git via pip:\n```bash\npython -m pip install https://codeload.github.com/open-stage/python-psn/zip/refs/heads/master\n```\n\n## Usage\n\n```python\nimport pypsn\n\n# define a callback function\ndef callback_function(data):\n if isinstance(data, pypsn_module.psn_data_packet): # packet type: psn.psn_data_packet\n for tracker in data.trackers: # loop through all trackers\n print(tracker.pos) # print the received coordinates\n\n if isinstance(data, pypsn_module.psn_info_packet): # packet type: psn.psn_info_packet\n print(data.name) # print server name\n for tracker in data.trackers: # loop through all trackers\n print(tracker.tracker_name) # print the received tracker name\n\n# provide a callback function and an IP address\nreceiver = pypsn.receiver(callback_function)\nreceiver.start() # start the receiving thread\n\nreceiver.stop() # stop receiving\n\n```\nSee examples folder for some more examples. \n\n## Development, status\n\n- Supporting PSN V2\n- Parsing only, not sending\n- Using threading module\n- Linux, Windows and macOS tested\n- Typed, no-strict\n- Initial pytest testing provided together with CI/CD setup\n\n### Type hints\n\n* At this point, the `--no-strict-optional` is needed for mypy tests to pass:\n\n```bash\nmypy pypsn/*py --pretty --no-strict-optional\n```\n### Format\n\n- to format, use [black](https://pypi.org/project/black/)\n\n### Testing\n\n- to test, use `pytest`\n- to test typing with mypy use \n\n```bash\npytest --mypy -m mypy pypsn/*py\n```\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "PosiStageNet parser",
"version": "0.2.3",
"project_urls": {
"Changelog": "https://github.com/open-stage/python-psn/blob/master/CHANGELOG.md",
"Repository": "https://github.com/open-stage/python-psn"
},
"split_keywords": [
"psn",
" posistagenet"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58aeb9bd4fc13a9144825d40e62f191a99848f581ca759d0c2929f2f114e430f",
"md5": "c6c5c5f57b1871522c74eebf643956e6",
"sha256": "b57fc1bdb65af90d1269f646816c252ca82b10cfc232288f7fe1f465ab492d60"
},
"downloads": -1,
"filename": "pypsn-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c6c5c5f57b1871522c74eebf643956e6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5199,
"upload_time": "2024-07-18T20:47:42",
"upload_time_iso_8601": "2024-07-18T20:47:42.565998Z",
"url": "https://files.pythonhosted.org/packages/58/ae/b9bd4fc13a9144825d40e62f191a99848f581ca759d0c2929f2f114e430f/pypsn-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-18 20:47:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "open-stage",
"github_project": "python-psn",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pypsn"
}