Releases: geyang/params-proto
v3.3.0
Features
- Deep Nested Dot Notation for CLI: Support for overriding nested dataclass fields via CLI
# Now works:
python train.py train-config --epochs 200 --model.hidden-size 512 --model.num-layers 8- Recursively detects nested dataclass fields in type annotations
- Supports arbitrary nesting depth (e.g.,
--model.encoder.layers 12) - Automatically constructs nested dataclass instances
Closes #30
v3.2.4
Bug Fixes
-
Context Manager Protocol: Fixed regression where
__enter__and__exit__were stripped from@protodecorated classes- Classes implementing context managers now work correctly with
withstatements - Also preserves all user-defined protocol methods:
__call__,__iter__,__next__,__getitem__,__len__, etc.
- Classes implementing context managers now work correctly with
-
Simplified Implementation: Removed method wrapping that caused issues
- Decorated class is now a proper subclass of the original, so methods are inherited naturally
- No more wrapping of methods to return
self- use explicitreturn selfif needed - Standard Python semantics: classmethods receive
cls, not bound to instance
v3.2.3
Bug Fixes
-
Context Manager Protocol: Fixed regression where
__enter__and__exit__were stripped from@protodecorated classes- Classes implementing context managers now work correctly with
withstatements - Also preserves all user-defined protocol methods:
__call__,__iter__,__next__,__getitem__,__len__, etc.
- Classes implementing context managers now work correctly with
-
Simplified Implementation: Removed method wrapping that caused issues
- Decorated class is now a proper subclass of the original, so methods are inherited naturally
- No more wrapping of methods to return
self- use explicitreturn selfif needed - Standard Python semantics: classmethods receive
cls, not bound to instance
v3.2.2
Bug Fixes
-
super()in@protoMethods: Fixedsuper()calls failing withTypeError: super(type, obj): obj must be an instance or subtype of type- Methods using
super()in@protoor@proto.prefixdecorated classes now work correctly
- Methods using
-
@protoInheriting from@proto: FixedTypeError: duplicate base class ptypewhen a@protoclass inherits from another@protoclass
v3.2.1
Bug Fixes
- Positional Arguments in Subcommands: Fixed positional arguments being silently ignored after subcommand name (#29)
- Before:
myapp add my-env/v1.2.3→ positional arg silently dropped - After:
myapp add my-env/v1.2.3→ positional arg captured by subcommand's required field - Enables CLI patterns like
pip install requests,cargo add serde - Raises clear error for extra unrecognized positional arguments
- Before:
Documentation
- Fixed outdated notes claiming
Optional[str]was not supported (it works)
Install
pip install params-proto==3.2.1v3.2.0
Features
-
Unprefixed CLI Subcommand Attributes: Subcommand attributes no longer require prefix by default
- Old:
python train.py train-config --config.epochs 200 - New:
python train.py train-config --epochs 200 - Prefixed syntax still works for backwards compatibility
- Old:
-
@proto.prefixControls CLI Prefix Requirement: Classes decorated with@proto.prefixrequire prefixed CLI syntax- Regular dataclasses:
--epochs 200(unprefixed) @proto.prefixclasses:--config.epochs 200(prefixed required)
- Regular dataclasses:
Bug Fixes
isinstance()for@proto.prefixInstances: Fixedisinstance(instance, DecoratedClass)returningFalse- Instances of
@proto.prefixdecorated classes now correctly pass isinstance checks - Enables proper type checking in Union subcommand handlers
- Instances of
Testing
- Added comprehensive nested CLI subcommand tests (
test_nested_cli.py) - Added parallel test execution with
pytest-xdist - Run tests in parallel:
pytest -n auto
v3.1.1
Bug Fixes
- EnvVar Descriptor Protocol: EnvVar now works in plain classes without
@protodecorator- Previously
EnvVar @ "VAR" | defaultreturned_EnvVarobject in plain classes - Now auto-resolves via
__get__descriptor when accessed as class attribute - Fixes:
AttributeError: '_EnvVar' object has no attribute 'decode'
- Previously
API Changes
- Removed
.get()method: Use class attribute access instead- Old:
EnvVar("PORT", dtype=int).get() - New:
class C: port = EnvVar("PORT", dtype=int)thenC.port - Use
invalidate_cache()to force re-read from environment
- Old:
v3.1.0
Features
_dictProperty anddict()Support: Get a clean dict of parameter values from proto classes and functionsConfig._dictreturns{'lr': 0.001, 'batch_size': 32}(defaults merged with overrides)dict(Config)works identically via__iter__support- Works for both
@proto/@proto.prefixclasses and@proto.cli/@proto.prefixfunctions
Documentation
- Added
_dictproperty documentation to API reference - Updated Claude skill references with clean dict examples
v3.0.0-rc27
Features
-
EnvVar OR Operation: Try multiple environment variable names in order
EnvVar @ "API_KEY" @ "SECRET_KEY" | "default"- tries API_KEY first, then SECRET_KEY- Function syntax:
EnvVar("A", "B", default="value") - Returns first env var that is set, or default if none are set
-
EnvVar Lazy Loading: Environment variables are cached after first read
ev.get()caches result for subsequent callsev.get(lazy=False)forces re-read from environmentev.invalidate_cache()clears cached value
-
Automatic Type Inference for Untyped Attributes
name = "hello"is treated asname: str = "hello"data = Noneis treated asdata: Any = None
Bug Fixes
- Consolidated duplicate
_EnvVarclass definitions - Untyped class attributes now correctly appear in
vars(self)during__post_init__
v3.0.0-rc26
Features
- Automatic Type Inference for Untyped Attributes: Class attributes without explicit type annotations are now automatically inferred
name = "hello"is treated asname: str = "hello"count = 42is treated ascount: int = 42data = Noneis treated asdata: Any = None(generic type)- Untyped attributes now appear in
vars(self)inside__post_init__ - Explicit type annotations are always preserved
Bug Fixes
- Untyped class attributes now correctly appear in
vars(self)during__post_init__