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

Rough Draft #115

Closed
wants to merge 5 commits into from
Closed

Rough Draft #115

wants to merge 5 commits into from

Conversation

kschwab
Copy link

@kschwab kschwab commented Jan 12, 2024

Hey @brentyi!

Here's a rough draft of what we covered in #60. I have to set this down for now but wanted to drop this here in case you could pull it across the finish line 😄

It mostly works. I haven't added tests etc. but did make sure all the existing tests pass. It should provide a decent feel for what we're trying to accomplish. There is still cleanup needed around required field handling and associated help text, lots of testing, etc.

One additional item I added was "HideNoneSubcommands". I think this would be really nice to have as well. For our use case, None is only intended as an invalid field that can be overridden (i.e., not used to invalidate an already valid object).

Mutual exclusion I took the stance of using defaults, there are probably better ways to enforce this.

Lastly, it seems with the current implementation most of this will need to be constrained to the field list generation. There may be better ways to accomplish this. I had issues with types getting interpreted differently if I tried to resolve it at a higher level (i.e., mainly field_list_from_callable).

Copy link
Author

@kschwab kschwab Jan 12, 2024

Choose a reason for hiding this comment

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

I would suggest breaking this out of the PR and pulling it into main. This adds support for Sphinx autodoc comment strings. Currently it will insert a newline into the docstring formatting without this.

Copy link
Owner

Choose a reason for hiding this comment

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

thanks! makes sense to me 🙂

@kschwab
Copy link
Author

kschwab commented Jan 12, 2024

Also, I deferred converting cmd:None subcommands into flags (e.g. --cmd:None) and instead just left them as is.

Copy link

codecov bot commented Jan 13, 2024

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (3962ed8) 99.58% compared to head (5adcdb3) 98.66%.

Files Patch % Lines
src/tyro/_fields.py 42.85% 12 Missing ⚠️
src/tyro/_arguments.py 25.00% 3 Missing ⚠️
src/tyro/_docstrings.py 66.66% 2 Missing ⚠️
src/tyro/_strings.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #115      +/-   ##
==========================================
- Coverage   99.58%   98.66%   -0.92%     
==========================================
  Files          24       24              
  Lines        1918     1952      +34     
==========================================
+ Hits         1910     1926      +16     
- Misses          8       26      +18     
Flag Coverage Δ
unittests 98.66% <57.14%> (-0.92%) ⬇️

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.

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.

None yet

2 participants