This release is a pre-release and may not be stable for production use.
nshconfig v3
Typed Python configuration with editable drafts, live interpolation, and independent read-only snapshots. Config files, presets, and execution are ordinary Python modules and functions.
pip install 'nshconfig==3.0.0a0'
import nshconfig as C
class Pairformer(C.Config):
c_z: int = C.interp(lambda c: c.root(Run).c_z)
class Run(C.Config):
project: str
run_name: str
c_z: int = 128
pairformer: Pairformer = Pairformer()
config = Run.draft()
config.project = "af3"
config.run_name = "wide"
config.c_z = 256
assert config.pairformer.c_z == 256
ready = config.finalize()
config.c_z = 384
assert ready.pairformer.c_z == 256
assert config.pairformer.c_z == 384
For short configs, Run(project="af3", run_name="wide", c_z=256) also creates an editable draft. Constructors have checked keyword signatures; .draft() permits required fields to be populated later. Both use .finalize() before execution.
Composition is Python
def wide(config: Run) -> None:
config.c_z = 256
def experiment() -> Run:
config = Run(project="af3", run_name="wide")
wide(config)
return config
# In your ordinary Python entry point:
# train(experiment().finalize())
The runnable AF3 example demonstrates shared model dimensions, presets, nested configs, and training-set/weight validation in a reduced configuration.
Validation and ownership
Writes defer validation. Reads validate requested values and their dependencies; declaration order does not matter. Use Pydantic Annotated metadata for field-local normalization and constraints, and @C.check for final cross-field checks:
from typing import Annotated
class Data(C.Config):
batch_size: Annotated[int, C.Field(gt=0)] = 1
train_sets: list[str] = ["pdb"]
weights: list[float] = [1.0]
@C.check
def aligned(self) -> None:
if len(self.train_sets) != len(self.weights):
raise ValueError("train_sets and weights must align")
Explicit child assignment preserves identity and requires a single owner. Use .copy() for reuse. Declared defaults are copied automatically per parent. Plain incoming lists/dicts become managed containers; aliases read from a config stay live. Final snapshots and computed subtrees reject nested mutation at runtime.
The same schema type describes drafts and finals. ty, Pyright, and mypy check names and value types; completeness and read-only state are runtime guarantees. Managed list/dict values implement sequence/mapping interfaces and are not built-in list/dict instances. Arbitrary mutable opaque leaves are unsupported.
Python 3.10-3.14 and Pydantic 2.13 through the latest 2.x are supported. Install nshconfig[transport] for trusted cloudpickle transport of notebook-defined schemas. v3 is an intentional breaking redesign of v2.
See DESIGN.md for the exact contract, the documentation for guides, and SKILL.md for agent usage.
Metadata
Release files for nshconfig 3.0.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nshconfig-3.0.0a0.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nshconfig-3.0.0a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.0 kB
Release files / nshconfig-3.0.0a0.tar.gz
| Download URL | nshconfig-3.0.0a0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95d9c8a299b43bea5576033d8ac6378fa698b8b40a1e718af30eeafc66085707
|
|
BLAKE2b-256 checksum How to use checksums |
821a9d9f3fc760a7ccf9e6952450e971fbb1e16a5db9c40d5b568c0fbb270f3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / nshconfig-3.0.0a0-py3-none-any.whl
| Download URL | nshconfig-3.0.0a0-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
796c84047a1aa6930fd90052d0a52bc9323d2e5bfedaf0dba133da89739b2a13
|
|
BLAKE2b-256 checksum How to use checksums |
67d3b302595d9001ca87c1d60826fcf24c30fef926c0671e189fd00dcba12ac0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|