Skip to content

Releases: geyang/params-proto

v3.3.0

05 Feb 07:42

Choose a tag to compare

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

05 Feb 07:10

Choose a tag to compare

Bug Fixes

  • Context Manager Protocol: Fixed regression where __enter__ and __exit__ were stripped from @proto decorated classes

    • Classes implementing context managers now work correctly with with statements
    • Also preserves all user-defined protocol methods: __call__, __iter__, __next__, __getitem__, __len__, etc.
  • 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 explicit return self if needed
    • Standard Python semantics: classmethods receive cls, not bound to instance

v3.2.3

05 Feb 07:08

Choose a tag to compare

Bug Fixes

  • Context Manager Protocol: Fixed regression where __enter__ and __exit__ were stripped from @proto decorated classes

    • Classes implementing context managers now work correctly with with statements
    • Also preserves all user-defined protocol methods: __call__, __iter__, __next__, __getitem__, __len__, etc.
  • 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 explicit return self if needed
    • Standard Python semantics: classmethods receive cls, not bound to instance

v3.2.2

04 Feb 01:50

Choose a tag to compare

Bug Fixes

  • super() in @proto Methods: Fixed super() calls failing with TypeError: super(type, obj): obj must be an instance or subtype of type

    • Methods using super() in @proto or @proto.prefix decorated classes now work correctly
  • @proto Inheriting from @proto: Fixed TypeError: duplicate base class ptype when a @proto class inherits from another @proto class

v3.2.1

01 Feb 09:16

Choose a tag to compare

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

Documentation

  • Fixed outdated notes claiming Optional[str] was not supported (it works)

Install

pip install params-proto==3.2.1

v3.2.0

01 Feb 08:38

Choose a tag to compare

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
  • @proto.prefix Controls CLI Prefix Requirement: Classes decorated with @proto.prefix require prefixed CLI syntax

    • Regular dataclasses: --epochs 200 (unprefixed)
    • @proto.prefix classes: --config.epochs 200 (prefixed required)

Bug Fixes

  • isinstance() for @proto.prefix Instances: Fixed isinstance(instance, DecoratedClass) returning False
    • Instances of @proto.prefix decorated classes now correctly pass isinstance checks
    • Enables proper type checking in Union subcommand handlers

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

25 Jan 18:02

Choose a tag to compare

Bug Fixes

  • EnvVar Descriptor Protocol: EnvVar now works in plain classes without @proto decorator
    • Previously EnvVar @ "VAR" | default returned _EnvVar object in plain classes
    • Now auto-resolves via __get__ descriptor when accessed as class attribute
    • Fixes: AttributeError: '_EnvVar' object has no attribute 'decode'

API Changes

  • Removed .get() method: Use class attribute access instead
    • Old: EnvVar("PORT", dtype=int).get()
    • New: class C: port = EnvVar("PORT", dtype=int) then C.port
    • Use invalidate_cache() to force re-read from environment

v3.1.0

23 Jan 21:54

Choose a tag to compare

Features

  • _dict Property and dict() Support: Get a clean dict of parameter values from proto classes and functions
    • Config._dict returns {'lr': 0.001, 'batch_size': 32} (defaults merged with overrides)
    • dict(Config) works identically via __iter__ support
    • Works for both @proto/@proto.prefix classes and @proto.cli/@proto.prefix functions

Documentation

  • Added _dict property documentation to API reference
  • Updated Claude skill references with clean dict examples

v3.0.0-rc27

12 Jan 05:28
de2461d

Choose a tag to compare

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 calls
    • ev.get(lazy=False) forces re-read from environment
    • ev.invalidate_cache() clears cached value
  • Automatic Type Inference for Untyped Attributes

    • name = "hello" is treated as name: str = "hello"
    • data = None is treated as data: Any = None

Bug Fixes

  • Consolidated duplicate _EnvVar class definitions
  • Untyped class attributes now correctly appear in vars(self) during __post_init__

v3.0.0-rc26

12 Jan 00:40
6a3460b

Choose a tag to compare

Features

  • Automatic Type Inference for Untyped Attributes: Class attributes without explicit type annotations are now automatically inferred
    • name = "hello" is treated as name: str = "hello"
    • count = 42 is treated as count: int = 42
    • data = None is treated as data: 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__