Dictionary utilities (DotDict, safe_merge) for the SciTeX ecosystem
Project description
scitex-dict
Dictionary utilities — DotDict, safe_merge, flatten, listed_dict, replace.
Full Documentation · uv pip install scitex-dict[all]
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 |
Installation
pip install scitex-dict
Architecture
scitex-dict/
├── src/scitex_dict/
│ ├── _DotDict.py # attribute-access dict subclass
│ ├── _safe_merge.py # raises on duplicate keys
│ ├── _flatten.py # nested → dotted-key
│ └── _listed_dict.py # default-list dict factory
└── tests/
1 Interfaces
Python API
from scitex_dict import (
DotDict, flatten, listed_dict, pop_keys,
replace, safe_merge, to_str,
)
cfg = DotDict({"model": {"lr": 0.001}})
cfg.model.lr # 0.001
safe_merge({"a": 1}, {"b": 2})
flatten({"x": {"y": 1, "z": [10, 20]}}) # {"x_y": 1, "x_z_0": 10, ...}
d = listed_dict(["a", "b"])
replace("hello world", {"hello": "hi"}) # "hi world"
to_str({"a": 1, "b": 2})
Demo
flowchart LR
YAML[YAML config] --> DD[DotDict]
DD -->|cfg.model.lr| Code[Your code]
A[dict A] --> SM[safe_merge]
B[dict B] --> SM
SM --> Merged[merged dict]
Quick Start
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})
Part of SciTeX
scitex-dict is part of SciTeX. Install via
the umbrella with pip install scitex[dict] to use as
scitex.dict (Python) or scitex dict ... (CLI).
Four Freedoms for Research
- The freedom to run your research anywhere — your machine, your terms.
- The freedom to study how every step works — from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- The freedom to modify any module and share improvements with the community.
AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.
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
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 scitex_dict-0.1.5.tar.gz.
File metadata
- Download URL: scitex_dict-0.1.5.tar.gz
- Upload date:
- Size: 8.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13ed438dd0d68423f7d6a1a338cc044d3772141c243c99f0d3a98be516d0c6f6
|
|
| MD5 |
0409fa4f3b9fdd94c05e3fd59893122d
|
|
| BLAKE2b-256 |
d878bed46454139b78359b5e42f74c30b7f356a4477f550d1d62bad4cfb37528
|
Provenance
The following attestation bundles were made for scitex_dict-0.1.5.tar.gz:
Publisher:
publish-pypi.yml on ywatanabe1989/scitex-dict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_dict-0.1.5.tar.gz -
Subject digest:
13ed438dd0d68423f7d6a1a338cc044d3772141c243c99f0d3a98be516d0c6f6 - Sigstore transparency entry: 1567359694
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-dict@e5a6d99c0b745d26f18f4a02095c9f82ab053532 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e5a6d99c0b745d26f18f4a02095c9f82ab053532 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scitex_dict-0.1.5-py3-none-any.whl.
File metadata
- Download URL: scitex_dict-0.1.5-py3-none-any.whl
- Upload date:
- Size: 8.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5a7728ee740c3f543c858f1eb8d1262032f4ebf079b5399320412a10c6e53c8
|
|
| MD5 |
aaa79658bbc33ff39f882aa587a195a3
|
|
| BLAKE2b-256 |
36b3f4fcb5de71c96ecbf44588ab7204c2bd77c98ca6f76016f96e98d8367cc7
|
Provenance
The following attestation bundles were made for scitex_dict-0.1.5-py3-none-any.whl:
Publisher:
publish-pypi.yml on ywatanabe1989/scitex-dict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_dict-0.1.5-py3-none-any.whl -
Subject digest:
d5a7728ee740c3f543c858f1eb8d1262032f4ebf079b5399320412a10c6e53c8 - Sigstore transparency entry: 1567359705
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-dict@e5a6d99c0b745d26f18f4a02095c9f82ab053532 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e5a6d99c0b745d26f18f4a02095c9f82ab053532 -
Trigger Event:
push
-
Statement type: