Skip to main content

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 --strict compliance with proper overloads

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

knotaru_common-0.1.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

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

Hashes for knotaru_common-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6dc5494ca07bc7de8bb3fdd9b036415f5cad970e3bbb50873bc634539bfd7662
MD5 b9733e12a80dc0472d31a60d0e824090
BLAKE2b-256 a501b2b8efcbd3f04c2eb4e72f01a94766abe63a98b81ae7841785b45b6e3ce3

See more details on using hashes here.

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

Hashes for knotaru_common-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f1cd669166c8fc41d860f98bd5bd0c7cee5eecc9ce76fc9678f154cdfc0a7ba
MD5 af498303177e8bcb2780ff7d18d8e057
BLAKE2b-256 5092dfe5e0ed7ad095768ad7fc4fd78b24d16bd070506dc222d6ad11fd5aabe8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page