A teeworlds network protocol library, designed according to sans I/O (http://sans-io.readthedocs.io/) principles
Go to file
2023-03-16 14:50:20 +01:00
requirements Release 0.0.1 2023-03-16 14:50:20 +01:00
src Add tests 2023-03-16 14:04:48 +01:00
tests Add tests 2023-03-16 14:04:48 +01:00
.gitignore Release 0.0.1 2023-03-16 14:50:20 +01:00
.gitlab-ci.yml Release 0.0.1 2023-03-16 14:50:20 +01:00
.pylintrc First actual parse 2023-03-16 10:26:36 +01:00
LICENSE.txt Release 0.0.1 2023-03-16 14:50:20 +01:00
pyproject.toml Release 0.0.1 2023-03-16 14:50:20 +01:00
pytest.ini Add tests 2023-03-16 14:04:48 +01:00
README.md Release 0.0.1 2023-03-16 14:50:20 +01:00
requirements.txt Release 0.0.1 2023-03-16 14:50:20 +01:00
setup.cfg Release 0.0.1 2023-03-16 14:50:20 +01:00

A teeworlds network protocol library, designed according to sans I/O (http://sans-io.readthedocs.io/) principles

sample usage

packet = parse(b'\x04\x0a\x00\xcf\x2e\xde\x1d\04') # 0.7 close

print(packet) # => <class: 'TwPacket'>: {'version': '0.7', 'header': <class: 'Header'>, 'messages': [<class: 'CtrlMessage'>]}
print(packet.header) # => <class: 'Header'>: {'flags': <class: 'PacketFlags7, 'size': 0, 'ack': 10, 'token': b'\xcf.\xde\x1d', 'num_chunks': 0}
print(packet.header.flags) # => <class: 'PacketFlags7'>: {'control': True, 'resend': False, 'compression': False, 'connless': False}
for msg in packet.messages:
    print(msg.name) # => close

setup

git clone https://gitlab.com/teeworlds-network/twnet_parser
cd twnet_parser
python -m venv venv
source venv/bin/activate
pip install -r requirements

tests and linting

# dev dependencies
pip install -r requirements/dev.txt

# run unit tests
pytest .

# run style linter
pylint src/

# run type checker
mypy src/

package and release

pip install -r requirements/dev.txt
python -m build
python -m twine upload dist/*