Python bindings for justcode binary encoder/decoder
Project description
justcode-python
Python bindings for the justcode binary encoder/decoder library.
Installation
pip install justcode-python
Usage
import justcode
# Encode data (config is optional, uses defaults)
encoded = justcode.encode("Hello, world!")
# Decode data (target_type is optional - auto-detects type)
decoded = justcode.decode(encoded)
assert decoded == "Hello, world!"
# Or specify target type explicitly
decoded = justcode.decode(encoded, target_type="str")
assert decoded == "Hello, world!"
Advanced Usage
import justcode
# Create a custom configuration
config = justcode.PyConfig(size_limit=1024, variable_int_encoding=False)
# Encode with custom config
encoded = justcode.encode(42, config=config)
# Decode with custom config (auto-detects type)
decoded = justcode.decode(encoded, config=config)
assert decoded == 42
# Or specify target type explicitly
decoded = justcode.decode(encoded, config=config, target_type="int")
assert decoded == 42
Configuration
import justcode
# Standard configuration (default)
config = justcode.PyConfig.standard()
# Custom configuration with size limit
config = justcode.PyConfig(size_limit=1024)
# Custom configuration without variable int encoding
config = justcode.PyConfig(variable_int_encoding=False)
# Chain configuration methods
config = justcode.PyConfig.standard().with_limit(2048).with_variable_int_encoding(False)
Development
Build the package:
maturin develop
Run tests:
pytest tests/test_justcode_python.py -v
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
justcode_python-0.3.0.tar.gz
(11.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file justcode_python-0.3.0.tar.gz.
File metadata
- Download URL: justcode_python-0.3.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e50af3b343212acb5c0035acb959f3307cd33be19290aa045b979348bb5182fc
|
|
| MD5 |
ac7ecf0cc7668311f320a54c9efbb69e
|
|
| BLAKE2b-256 |
8d8e74ac00bcd9b8b35680957e39c418a011a9d54b5d14c4d39bc494fd7ba4ff
|
File details
Details for the file justcode_python-0.3.0-cp38-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: justcode_python-0.3.0-cp38-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 243.5 kB
- Tags: CPython 3.8+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b6a7ed8b51e365cd3d3126df0edd560bf1a036de4685ff58650cde24d3f5f2d
|
|
| MD5 |
c5ee9f3308a64baaee09f14be7a88b50
|
|
| BLAKE2b-256 |
34381a359947e09ac64e6a4c69df6ed1d98cdbf839fc480d4a529bc34c03485d
|