Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.31.2 #218

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading