All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.4.0 - 2022-07-07
- Support for parsing arguments based on
attrsattributes.
- Removed
Choicesin favor ofLiteral. - Changed packaging and tool configurations to using
pyproject.toml. - Changed certain fields in
ArgumentSpecs; added a note that this class is internal and offers no stability guarantees.
- Fixed a bug where arguments are not collected in the correct method resolution order (MRO).
0.3.1 - 2021-05-16
- Support for
snake_case(underscore style) arguments. (#6) - A
DeprecationWarningis now shown when usingChoicesinstead ofLiteral.
0.3.0 - 2021-01-08
- Support for list arguments. (#1)
__repr__method forArguments. (#2)- Defined arguments are now stored in a special class variable
__arguments__in theArgumentssubclass namespace. A utility functionargtyped.argument_specs(Args)is provided to inspect the specifications of the arguments.
- Annotations are now parsed on class construction, and the
argparse.ArgumentParserobject is stored for the whole lifetime of the class as__parser__. - Exceptions thrown for invalid type annotations are changed from
ValueErrors toTypeErrors.
- It is now possible to override an argument with default value defined in the base class with a new argument that does
not have a default. Namely, the following code is now valid (although discouraged):
from argtyped import Arguments, Choices class BaseArgs(Arguments): foo: int = 0 class DerivedArgs(BaseArgs): foo: Choices["a", "b"]
Optional[Literal[...]]is now correctly supported.Optional[Switch]is now correctly detected (although invalid).
0.2.0 - 2020-06-15
- Literal types:
Literal. They act mostly the same asChoices.
Argumentsis now pickle-able.
0.1 - 2020-02-16
- The base of everything: the
Argumentclass. - Choice types:
Choices. - Custom enum types:
Enum. They differ from built-inEnumin thatauto()produces the enum name instead of numbers. - Switch types:
Switch.