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
attrs
attributes.
- Removed
Choices
in 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
DeprecationWarning
is now shown when usingChoices
instead 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 theArguments
subclass 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.ArgumentParser
object is stored for the whole lifetime of the class as__parser__
. - Exceptions thrown for invalid type annotations are changed from
ValueError
s toTypeError
s.
- 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
.
Arguments
is now pickle-able.
0.1 - 2020-02-16
- The base of everything: the
Argument
class. - Choice types:
Choices
. - Custom enum types:
Enum
. They differ from built-inEnum
in thatauto()
produces the enum name instead of numbers. - Switch types:
Switch
.