Skip to content

Commit

Permalink
Merge pull request neithere#218 from neithere/release/v0.31.2
Browse files Browse the repository at this point in the history
Release v0.31.2
  • Loading branch information
neithere authored Jan 24, 2024
2 parents 278a840 + 9d4da94 commit 80f71e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

Version 0.31.2 (2024-01-24)
---------------------------

Bugs fixed:

- broken support for `Optional[List]` (but not `Optional[list]`), a narrower
case of the problem fixed earlier (issue #216).

Version 0.31.1 (2024-01-19)
---------------------------

Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "argh"
version = "0.31.1"
version = "0.31.2"
description = "Plain Python functions as CLI commands without boilerplate"
readme = "README.rst"
requires-python = ">=3.8"
Expand Down Expand Up @@ -59,10 +59,10 @@ test = [
"pytest-cov >= 4.1",
]
docs = [
"sphinx >= 6.1",
"sphinx-pyproject == 0.1.0",
"sphinx_rtd_theme >= 1.2.0",
"readthedocs-sphinx-search == 0.2.0",
"sphinx >= 7.2",
"sphinx-pyproject == 0.3",
"sphinx_rtd_theme >= 2.0",
"readthedocs-sphinx-search == 0.3.2",
]
linters = [
"pre-commit >= 3.4.0",
Expand Down
4 changes: 2 additions & 2 deletions src/argh/assembling.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,10 @@ def typing_hint_to_arg_spec_params(
if first_subtype in cls.BASIC_TYPES:
retval["type"] = first_subtype

if first_subtype == list:
if first_subtype in (list, List):
retval["nargs"] = ZERO_OR_MORE

if get_origin(first_subtype) == list:
if first_subtype != List and get_origin(first_subtype) == list:
retval["nargs"] = ZERO_OR_MORE
item_type = cls._extract_item_type_from_list_type(first_subtype)
if item_type:
Expand Down
1 change: 1 addition & 0 deletions tests/test_typing_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def test_list():
assert guess(list) == {"nargs": "*"}
assert guess(List) == {"nargs": "*"}
assert guess(Optional[list]) == {"nargs": "*", "required": False}
assert guess(Optional[List]) == {"nargs": "*", "required": False}

assert guess(List[str]) == {"nargs": "*", "type": str}
assert guess(List[int]) == {"nargs": "*", "type": int}
Expand Down

0 comments on commit 80f71e5

Please sign in to comment.