Skip to main content

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 ✔️
Deserialize 0.7 chunk headers ✔️
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 ❌ TODO: link if someone implemented it on top
Protocol version detection ❌ 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

Metadata

Release files for twnet-parser 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twnet-parser 0.3.2
File Size Uploaded Provenance Actions
twnet_parser-0.3.2.tar.gz 27.7 kB Without provenance Details for twnet_parser-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for twnet-parser 0.3.2
File Interpreter ABI Platform Actions
twnet_parser-0.3.2-py3-none-any.whl Python 3 none any Details for twnet_parser-0.3.2-py3-none-any.whl

Total release size: 92.2 kB

Release files / twnet_parser-0.3.2.tar.gz

Download URL twnet_parser-0.3.2.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0bb220ad94c5af60f99eadbead80900b3afc9fa97f0c885b1be3cfec8438cdbf
BLAKE2b-256 checksum
How to use checksums
5291a8abc8fa562b632518c93bf10f649603b9fa7aace5959029400fef20d7c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / twnet_parser-0.3.2-py3-none-any.whl

Download URL twnet_parser-0.3.2-py3-none-any.whl
Size 64.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0011df86fe0263baef1dc57885fc8115f82ebd3820582623d700b4c4eece5e8
BLAKE2b-256 checksum
How to use checksums
1b1f334d385aaca567604e392965b16ade46c6168de576e1845f680b3d769122
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for twnet-parser 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page