Skip to main content

Dictionary utilities (DotDict, safe_merge) for the SciTeX ecosystem

Project description

scitex-dict

PyPI Python Tests Install Test Coverage Docs License: AGPL v3

Dictionary utilities for the SciTeX ecosystem.

Interfaces: Python ⭐⭐⭐ (primary) · CLI — · MCP — · Skills ⭐ · Hook — · HTTP —

Problem and Solution

# Problem Solution
1 YAML config access ergonomics -- CONFIG["MODEL"]["hidden_size"] vs CONFIG.MODEL.hidden_size matters in a notebook DotDict -- attribute-access dict subclass with recursive .x.y.z; works as a drop-in for the umpteen competing alternatives (addict, easydict, box, dotmap)
2 Merging configs silently overwrites -- {**a, **b} on duplicate keys loses information safe_merge -- duplicate keys raise; flatten turns nested dicts into dotted-key single-level for logging/CSV

Features

  • DotDict -- Dot-access dictionary with recursive nesting, JSON serialization, and full dict protocol
  • safe_merge -- Merge multiple dicts with overlap detection
  • flatten -- Flatten nested dicts into single-level with separator keys
  • listed_dict -- defaultdict(list) factory with optional pre-initialized keys
  • pop_keys -- Remove specified keys from a key list
  • replace -- Bulk string replacement using a mapping dict
  • to_str -- Convert a dict to a compact string representation

Installation

pip install scitex-dict

Usage

from scitex_dict import DotDict, safe_merge

cfg = DotDict({"model": {"lr": 0.001, "epochs": 100}})
print(cfg.model.lr)  # 0.001

merged = safe_merge({"a": 1}, {"b": 2})
# {"a": 1, "b": 2}

License

AGPL-3.0. See LICENSE.

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

scitex_dict-0.1.3.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

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

scitex_dict-0.1.3-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file scitex_dict-0.1.3.tar.gz.

File metadata

  • Download URL: scitex_dict-0.1.3.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_dict-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7c4d3aceca94494b70754cd1875273f7fee8f1eb53983b97c21a091d0e9bae0f
MD5 eac7f19be529da307aa4acd82e4ee22e
BLAKE2b-256 8dcb78cf81c72e88e5e32dabcc565c3165c5ed8088bbbca76513527a6f700400

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_dict-0.1.3.tar.gz:

Publisher: publish-pypi.yml on ywatanabe1989/scitex-dict

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scitex_dict-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: scitex_dict-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_dict-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ffa9c85750391027097acf7140321f8198997f12688988cfeed31028c6cea804
MD5 7ee416a9bf04ce68e7ec296ea2632fe0
BLAKE2b-256 9933c5658c666b5982ae69af99c2fdce960a48d5a3f5125319934511f947b7dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_dict-0.1.3-py3-none-any.whl:

Publisher: publish-pypi.yml on ywatanabe1989/scitex-dict

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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