Giter VIP home page Giter VIP logo

python-psn's Introduction

python-psn

Pure Python parsing library for PSN V2 - PosiStageNet

Official PSN specification

Source code

PyPi page

Pytest

Check links in markdown

Installation

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

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)
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:
mypy pypsn/*py  --pretty  --no-strict-optional

Format

Testing

  • to test, use pytest
  • to test typing with mypy use
pytest --mypy -m mypy pypsn/*py

python-psn's People

Contributors

vanous avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.