v0.31.0 — Annotation-driven!
What's Changed
This release is a major step forward for Argh. It paves the way to a fully annotations-driven approach where decorators will remain a mere legacy.
This text is a brief summary of the full changelog entry: https://argh.readthedocs.io/en/latest/changes.html#version-0-31-0-2023-12-30
Breaking changes:
- The typing hints introspection feature is automatically enabled for any command (function) which does not have any arguments specified via
@arg
decorator. - A small change in the legacy argument mapping policy
BY_NAME_IF_HAS_DEFAULT
concerning the order of variadic positional vs. keyword-only arguments. - Removed the previously deprecated decorator
@expects_obj
.
Enhancements:
- Type hints: basic usage to infer argument types (fixes #203) by @neithere in #211
- Support realtime output through a pipe (fixes #145) by @neithere in #202
- High-level functions
argh.dispatch_command()
andargh.dispatch_commands()
now accept a new parameterold_name_mapping_policy
.
Deprecated:
- the
namespace
argument inargh.dispatch()
andargh.parse_and_resolve()
.
Rationale: continued API cleanup. It's already possible to mutate the
namespace object between parsing and calling the endpoint; it's unlikely that
anyone would need to specify a custom namespace class or pre-populate it
before parsing. Please file an issue if you have a valid use case.
Other changes:
- Refactoring.
Full Diff: v0.30.5...v0.31.0