All Projects → KronoSKoderS → CalPack

KronoSKoderS / CalPack

Licence: MIT License
Packets in Python Simplified

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to CalPack

SerialTransfer
Arduino library to transfer dynamic, packetized data fast and reliably via Serial, I2C, or SPI
Stars: ✭ 273 (+1336.84%)
Mutual labels:  packets, bytes
Simplenet
An easy-to-use, event-driven, asynchronous network application framework compiled with Java 11.
Stars: ✭ 164 (+763.16%)
Mutual labels:  packets, bytes
octet
A library that makes working with bytebuffers painless.
Stars: ✭ 79 (+315.79%)
Mutual labels:  parsing, bytes
Pypacker
📦 The fastest and simplest packet manipulation lib for Python
Stars: ✭ 216 (+1036.84%)
Mutual labels:  parsing, packets
php-binary
A PHP library for parsing structured binary streams.
Stars: ✭ 30 (+57.89%)
Mutual labels:  parsing, bytes
tokenizr
String Tokenization Library for JavaScript
Stars: ✭ 70 (+268.42%)
Mutual labels:  parsing
rest-query-parser
Query Parser for REST
Stars: ✭ 29 (+52.63%)
Mutual labels:  parsing
httphead
No description or website provided.
Stars: ✭ 72 (+278.95%)
Mutual labels:  parsing
disco-dop
Discontinuous Data-Oriented Parsing
Stars: ✭ 40 (+110.53%)
Mutual labels:  parsing
ofxgo
Golang library for querying and parsing OFX
Stars: ✭ 96 (+405.26%)
Mutual labels:  parsing
literator
📝 Generate literate-style markdown docs from your sources
Stars: ✭ 55 (+189.47%)
Mutual labels:  parsing
tools-python
A Python library to parse, validate and create SPDX documents.
Stars: ✭ 65 (+242.11%)
Mutual labels:  parsing
webargs-starlette
Declarative request parsing and validation for Starlette with webargs
Stars: ✭ 36 (+89.47%)
Mutual labels:  parsing
parse-md
Parse Markdown file's metadata from its content
Stars: ✭ 15 (-21.05%)
Mutual labels:  parsing
Covfefe
A parser for nondeterministic context free languages
Stars: ✭ 49 (+157.89%)
Mutual labels:  parsing
magic-bytes
A library for detecting file types.
Stars: ✭ 20 (+5.26%)
Mutual labels:  bytes
Bullwinkle
An on-the-fly parser for BNF grammars
Stars: ✭ 39 (+105.26%)
Mutual labels:  parsing
php.json
A library for simplifying JSON linting and validation.
Stars: ✭ 59 (+210.53%)
Mutual labels:  parsing
cs-resources
Curated Computer Science and Programming Resource Guide
Stars: ✭ 42 (+121.05%)
Mutual labels:  parsing
apple-receipt
Apple InAppPurchase Receipt - Models, Parser, Validator
Stars: ✭ 25 (+31.58%)
Mutual labels:  parsing

Build Status Codacy Badge Coverage Status Documentation Status

CalPack Logo

CalPack

Packets in Python Simplified.

This python package is everything you need to "transmorgrify" your packets:

Calvin and Hobbes Strip

This package is intended to make creating and/or parsing packets (structured bytecode) on the fly quick and easy. This is a wrapper around the ctypes module built-in to python. This package is designed with influence from Django's modeling and will look familiar to those that have used it.

A quick explanation of Packets and how to use them

Packets are structured bytecode used for passing information from one place to another. The most common example is that of a TCP/IP Packet, but isn't necessarily limited to networking packets. Here's a quick example. Let's say we want to make a "smart" washing machine by attaching a Raspberry Pi that then talks to your other smart devices and alerts you when a load of laundry is done and how many loads of laundry you've done that day.

Example Diagram

One way to communicate between the Raspberry Pi and your other devices is to send status "packets" or byte data across a network. Let's say we want to know the following in our packet:

  • Status - a Boolean that represents whether the Washing Machine is running or stopped
  • Number of Loads - an Integer that represents the number of loads done that day

To create this packet in CalPack is simple:

from calpack import models

class MachineStatus(models.Packet):
    Status = models.BooleanField()
    Num_Loads = models.IntField()

On our monitoring device (the Raspberry Pi), we can easily create the byte data for the packet by using our new packet:

status_pkt = MachineStatus(
    Status=True,
    Num_Loads=12
)

# Send the byte data using an assumed custom `send` funcion
send(status_pkt.to_bytes())

And converting the recieved byte data is simple as well:

# assuming a `receive` function and returns the byte data of the sent packet
received_data = MachineSatus.from_bytes(receive())
print(received_data.status)

Installation

This package is maintained in GitHub and packaged for deployment on PyPi.

Simply using pip install calpack will get this installed.

SHOW ME THE DOCS

Documentation is host on read the docs

Python 2 and 3

Currently this module is designed to work for both Python 2.7+ and 3.3+, however, with the term of life for Python 2 nearing, this package will eventually port entirely over to Python 3.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].