Shared utilities for Knotaru — JSON, type helpers, and more
Project description
knotaru-common
Shared utilities for the Knotaru platform — zero dependencies, stdlib only.
Modules
| Module | Description |
|---|---|
knotaru_common.json |
Safe JSON serialisation and deserialisation |
Installation
pip install knotaru-common
Quick Start
Safe JSON
from knotaru_common.json import safe_json_dumps, safe_json_loads
# Serialise — returns None instead of raising on failure
text = safe_json_dumps({"key": "value"}) # '{"key": "value"}'
text = safe_json_dumps(object()) # None (unserializable)
text = safe_json_dumps(object(), default="{}") # "{}" (custom fallback)
# Deserialise — returns None instead of raising on failure
data = safe_json_loads('{"key": "value"}') # {"key": "value"}
data = safe_json_loads("not json") # None (parse error)
data = safe_json_loads("not json", default={}) # {} (custom fallback)
Design Principles
- Zero mandatory dependencies — pure stdlib, always importable
- Never raises — all safe_* functions catch errors and return a default
- Typed — full
mypy --strictcompliance with proper overloads
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
knotaru_common-0.1.0.tar.gz
(3.0 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 knotaru_common-0.1.0.tar.gz.
File metadata
- Download URL: knotaru_common-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.7 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dc5494ca07bc7de8bb3fdd9b036415f5cad970e3bbb50873bc634539bfd7662
|
|
| MD5 |
b9733e12a80dc0472d31a60d0e824090
|
|
| BLAKE2b-256 |
a501b2b8efcbd3f04c2eb4e72f01a94766abe63a98b81ae7841785b45b6e3ce3
|
File details
Details for the file knotaru_common-0.1.0-py3-none-any.whl.
File metadata
- Download URL: knotaru_common-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.7 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f1cd669166c8fc41d860f98bd5bd0c7cee5eecc9ce76fc9678f154cdfc0a7ba
|
|
| MD5 |
af498303177e8bcb2780ff7d18d8e057
|
|
| BLAKE2b-256 |
5092dfe5e0ed7ad095768ad7fc4fd78b24d16bd070506dc222d6ad11fd5aabe8
|