Skip to main content

Dictionary utilities (DotDict, safe_merge) for the SciTeX ecosystem

Project description

scitex-dict

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.2.tar.gz (35.8 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.2-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scitex_dict-0.1.2.tar.gz
  • Upload date:
  • Size: 35.8 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.2.tar.gz
Algorithm Hash digest
SHA256 35a0ba457c8c7e90f5517eda66c3cebe2c7e3cea4e8574cad73d7257657c5d61
MD5 d0c02adc4d30696a8f726d13d0381dbf
BLAKE2b-256 5cbaac6d758d1a1c738923312fcc6585cbba5ecb62d2c6ab1d8760a174abeb1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_dict-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: scitex_dict-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 25.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55de7882858870ec20598c486c08ef775e56498506ef116ecbd1a0bfc4156113
MD5 0a765c63237afb8a47ae235a3d87a423
BLAKE2b-256 be0c1ebeaa7b9bfb40f9a760bde757298eb89ae4f013b2fe958f8220c30e9ffe

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_dict-0.1.2-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