Skip to content

Add Positional Feature#176

Open
Daraan wants to merge 16 commits intoswansonk14:mainfrom
Daraan:add-positional
Open

Add Positional Feature#176
Daraan wants to merge 16 commits intoswansonk14:mainfrom
Daraan:add-positional

Conversation

@Daraan
Copy link
Contributor

@Daraan Daraan commented Dec 28, 2025

Resolves: #169

To also work for pydantic needs: #174, then also resolves: #165 (thats why latest tests) fail

Supports

from tap import Tap, Positional

class MyTap(Tap):
    positional_arg: Positional[int]
    positional_default: Positional[int] = 2
    positional_args: Positional[list[str]]

@codecov-commenter
Copy link

codecov-commenter commented Dec 28, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.38%. Comparing base (2215ef5) to head (7199f92).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #176      +/-   ##
==========================================
+ Coverage   94.18%   94.38%   +0.20%     
==========================================
  Files           4        4              
  Lines         757      784      +27     
==========================================
+ Hits          713      740      +27     
  Misses         44       44              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines -186 to 188
kwargs["help"] += " " + self.class_variables[variable]["comment"]
if variable in self.class_variables and (comment := self.class_variables[variable]["comment"]):
kwargs["help"] += " " + comment

Copy link
Contributor Author

@Daraan Daraan Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This avoids just an additional untrimmed space at the end of the help message if there is none; i.e. "(int, required) " -> "(int, required)"

@Daraan
Copy link
Contributor Author

Daraan commented Dec 30, 2025

Ready for review :)

@martinjm97
Copy link
Collaborator

Thank you! This looks great! Sorry for the delay, we'll do our best to review this sizable PR soon.

--JK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Positional argument with default value Feature request: Positional arguments from pydantic model

3 participants

Comments