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

Implement warning for duplicate subcommands #275

Merged
merged 8 commits into from
Mar 18, 2025

Conversation

brentyi
Copy link
Owner

@brentyi brentyi commented Mar 18, 2025

Summary

Test plan

  • Added a test case that triggers the duplicate subcommand warning
  • Generated corresponding Python 3.11 test variant
  • Verified that the warning is displayed when running the union_warning.py example directly

🤖 Generated with Claude Code

brentyi and others added 8 commits March 18, 2025 10:54
Test case adapted from an example by @foges in issue #273

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Resolves the TODO at line 498 in _parsers.py by adding a warning when a subcommand
with the same name already exists. This is related to confusing behavior in #273.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Make the warning message more specific and actionable by:
- Clearly explaining that only the last type will be accessible
- Suggesting solutions: use distinct class names or tyro.conf.subcommand()

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.82%. Comparing base (92aba8e) to head (0c8d2d1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #275   +/-   ##
=======================================
  Coverage   99.82%   99.82%           
=======================================
  Files          33       33           
  Lines        2320     2324    +4     
=======================================
+ Hits         2316     2320    +4     
  Misses          4        4           
Flag Coverage Δ
unittests 99.82% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@brentyi brentyi merged commit a97163e into main Mar 18, 2025
17 checks passed
@brentyi brentyi deleted the fix-duplicate-subcommand-warning branch March 18, 2025 11:26
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.

1 participant