A teeworlds network protocol library, designed according to sans I/O (http://sans-io.readthedocs.io/) principles
Project description
A teeworlds network protocol library, designed according to sans I/O (http://sans-io.readthedocs.io/) principles
THIS LIBRARY IS IN EARLY DEVELOPMENT
Do not get bamboozled by the mature looking readme!
This project is not in a very usable state yet. It is in very early development!
APIs might change and many essential features are missing!
install
pip install twnet_parser
sample usage
import twnet_parser.packet
packet = twnet_parser.packet.parse7(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.message_name) # => close
Features
Feature | Status |
---|---|
Deserialize 0.7 packet headers | :heavy_check_mark: |
Deserialize 0.7 chunk headers | :heavy_check_mark: |
Deserialize 0.7 messages | 70% |
Deserialize 0.7 snapshots | |
Serialize 0.7 packet headers | |
Serialize 0.7 chunk headers | |
Serialize 0.7 messages | 70% |
Deserialize 0.6 packet headers | |
Deserialize 0.6 chunk headers | |
Deserialize 0.6 messages | |
Deserialize 0.6 snapshots | |
Serialize 0.6 packet headers | |
Serialize 0.6 chunk headers | |
Serialize 0.6 messages |
Non-Features (also not planned for this library)
Feature | Status | Where to find it |
---|---|---|
Networking | :x: | TODO: link if someone implemented it on top |
Protocol version detection | :x: | TODO: link if someone implemented it on top |
Look elsewhere for these features. Or use this library to implement them on top.
development 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/dev.txt
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
# manual
pip install -r requirements/dev.txt
version=0.0.2
sed -i "s/^version =.*/version = \"$version\"/" pyproject.toml
python -m build
git tag -a "v$version" -m "# version $version"
python -m twine upload dist/*
# or use the interactive convience script
./scripts/release.sh
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
twnet_parser-0.3.1.tar.gz
(20.6 kB
view details)
Built Distribution
File details
Details for the file twnet_parser-0.3.1.tar.gz
.
File metadata
- Download URL: twnet_parser-0.3.1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4961f2db24420a1b792ccc2b02f48b4e26c097dbe6c651f61fdc318338b0dde7 |
|
MD5 | 4a1d22fc8dd39f6229d0ffc5d864e566 |
|
BLAKE2b-256 | 927ae41a4726e090e4e1f2ebc63f3c616002c7cb062426982bbb5cf796421e0a |
File details
Details for the file twnet_parser-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: twnet_parser-0.3.1-py3-none-any.whl
- Upload date:
- Size: 52.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5c5d61d8b9bd0994446e55394b79a8861c91473558f4e1cc0d0fb4050490ced |
|
MD5 | b06df4b1b257a716d41ca5cefa893374 |
|
BLAKE2b-256 | 33ab9d7b308a12a53dc451605de8930a12954c56bc88e5ec25c87127e90df145 |