wry 0.2.2.dev1__py3-none-any.whl → 0.2.3.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wry/_version.py CHANGED
@@ -1,8 +1,8 @@
1
1
  # file generated by poetry-dynamic-versioning
2
2
  from typing import TYPE_CHECKING
3
3
 
4
- __version__: str = "0.2.2.dev1" # This will be replaced during build
5
- __version_tuple__: tuple[int, ...] = (0, 2, 2, "dev1") # This will be replaced during build
4
+ __version__: str = "0.2.3.dev1" # This will be replaced during build
5
+ __version_tuple__: tuple[int, ...] = (0, 2, 3, "dev1") # This will be replaced during build
6
6
  __commit_id__: str | None = None # This will be replaced during build
7
7
 
8
8
  # For compatibility with setuptools-scm test expectations
wry/click_integration.py CHANGED
@@ -518,7 +518,16 @@ def generate_click_parameters(
518
518
  elif click_parameter:
519
519
  # Determine if it's an argument or option
520
520
  if hasattr(click_parameter, "__name__") and "argument" in str(click_parameter):
521
- arguments.append(extract_and_modify_argument_decorator(click_parameter))
521
+ modified_arg, arg_info = extract_and_modify_argument_decorator(click_parameter)
522
+ arguments.append(modified_arg)
523
+
524
+ # Track argument description for docstring injection
525
+ # Try to get help from decorator first, then from Field description
526
+ help_text = arg_info.get("help") or field_info.description
527
+ if help_text:
528
+ # Use the argument name from param_decls, uppercase it for display
529
+ arg_name = arg_info.get("param_decls", [field_name])[0].upper()
530
+ argument_docs.append((arg_name, help_text))
522
531
  else:
523
532
  # Only append if it's actually a Click decorator, not an AutoClickParameter
524
533
  if callable(click_parameter) and not isinstance(click_parameter, AutoClickParameter):
@@ -613,8 +622,15 @@ def generate_click_parameters(
613
622
 
614
623
  def extract_and_modify_argument_decorator(
615
624
  click_decorator: ClickParameterDecorator[Any],
616
- ) -> ClickParameterDecorator[Any]:
617
- """Extract and modify a click.argument decorator to set required=False."""
625
+ ) -> tuple[ClickParameterDecorator[Any], dict[str, Any]]:
626
+ """Extract and modify a click.argument decorator to set required=False.
627
+
628
+ Returns:
629
+ Tuple of (modified_decorator, info_dict) where info_dict contains:
630
+ - param_decls: list of parameter declaration strings
631
+ - help: help text if available
632
+ - other attributes from the original decorator
633
+ """
618
634
  # Default values - use a safe fallback
619
635
  param_decls: list[str] = ["argument"]
620
636
  attrs: dict[str, Any] = {"required": False}
@@ -655,8 +671,15 @@ def extract_and_modify_argument_decorator(
655
671
  # If closure inspection fails, just use defaults
656
672
  pass
657
673
 
674
+ # Create info dict with extracted information (including help if present)
675
+ info = {"param_decls": param_decls, **attrs}
676
+
677
+ # Remove 'help' from attrs before creating Click argument
678
+ # (click.Argument doesn't accept 'help' parameter)
679
+ argument_attrs = {k: v for k, v in attrs.items() if k != "help"}
680
+
658
681
  # Create new argument with modified attrs
659
- return click.argument(*param_decls, **attrs)
682
+ return click.argument(*param_decls, **argument_attrs), info
660
683
 
661
684
 
662
685
  def build_config_with_sources(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wry
3
- Version: 0.2.2.dev1
3
+ Version: 0.2.3.dev1
4
4
  Summary: Why Repeat Yourself? - Define your CLI once with Pydantic models
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -1,7 +1,7 @@
1
1
  wry/__init__.py,sha256=KDP1HwNl2_eF0QDE6p-ST6YAjrATnifnqaG0ECPr29Q,3305
2
- wry/_version.py,sha256=r3YhbanbbtY0QNzUxAbWoNU_rG8lI35GbeawLsDcMHo,520
2
+ wry/_version.py,sha256=qmVMHVs6fvYQY9UunIZhHjcS7ZXKE-ONNZzMlBtZL7w,520
3
3
  wry/auto_model.py,sha256=YY71mkYr46P3O4cjY8fN0AmothtPcvsDqvk1eQM4VbE,6927
4
- wry/click_integration.py,sha256=JIMngkna_6fCJCOlM0lEYv-gQMQz6vln2ApIkUO4IPI,30613
4
+ wry/click_integration.py,sha256=XDeNDHGh99Now77vrGMo151xp0KjWZYm7nTuIHh6CU4,31775
5
5
  wry/core/__init__.py,sha256=24Mu7qGzaFde8tAnyJOPPkD1ScZq-iSXNlDdAWSw_mg,894
6
6
  wry/core/accessors.py,sha256=Kn5dziklgcMWClOjbeJSwWNHOCQkpAWV9b1uH9ZGUPI,3708
7
7
  wry/core/env_utils.py,sha256=8TCgVPr7n5-YNThEVC5MvAG6qB0TW5MJkO1YT5yHZYI,4051
@@ -10,7 +10,7 @@ wry/core/model.py,sha256=CP0zElttAqpFHj2yD8O8CgMSm9VpSAT46nXcnCHw38U,25150
10
10
  wry/core/sources.py,sha256=4uboTc23f_CXiD3ql767-TvrGfe6xXN5NhXEIfNxD2U,1171
11
11
  wry/multi_model.py,sha256=f6Hf5NMfIZtdXc6t00iTPtUEbiWnQZiC7NKVchQ7QU4,5978
12
12
  wry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- wry-0.2.2.dev1.dist-info/METADATA,sha256=CJdAngrjvPCDxZoqlsCwKlG7pNkNifFv26Yorp_v-0U,19922
14
- wry-0.2.2.dev1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
15
- wry-0.2.2.dev1.dist-info/licenses/LICENSE,sha256=0EfVapSdYZQRHpfqCVAO5OeyT2xMu8cxPKaRkWWdb2g,1068
16
- wry-0.2.2.dev1.dist-info/RECORD,,
13
+ wry-0.2.3.dev1.dist-info/METADATA,sha256=viAAgfrP7T93g7xksj9_P9iTXjRx1b2G2-WQ-90Dm3g,19922
14
+ wry-0.2.3.dev1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
15
+ wry-0.2.3.dev1.dist-info/licenses/LICENSE,sha256=0EfVapSdYZQRHpfqCVAO5OeyT2xMu8cxPKaRkWWdb2g,1068
16
+ wry-0.2.3.dev1.dist-info/RECORD,,