🐛 Ensure that an envvar set for a typer.Option list is split on whitespace#1791
Open
svlandeg wants to merge 3 commits into
Open
🐛 Ensure that an envvar set for a typer.Option list is split on whitespace#1791svlandeg wants to merge 3 commits into
typer.Option list is split on whitespace#1791svlandeg wants to merge 3 commits into
Conversation
|
For what it's worth, this behavior is documented for click (which is where I got the idea from). Thanks again for your help @svlandeg! |
Member
Author
Yes, but the point is that it's not documented for Typer. And going forward after the vendoring, only what is documented by Typer is considered to be part of Typer's public API. So, if this is a feature we want to explicitly support and test, we should also document it. (But that's considered follow-up work & decisions as we have tried to be as minimally breaking for now) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1789, thanks to @wpk-nist-gov for the report.
Description
This bug fix is related to #1787 though not quite the same. A user reported that this doesn't work anymore:
As far as I know, we don't actually document using
envvarin combination with alisttype. Before 0.26.0, Click's defaults would parse the envvar string on whitespace and produce a list when calling this with something likeenv={"ME": "rick morty"}.This currently still works for
Argumentas it doesn't have its own implementation ofvalue_from_envvar, it still uses Click's old one fromParameter. ForOption, this functionality was removed in the refactor. This PR restores the functionality forOptionin a quick bug fix PR.ArgumentandOptionshould work similarly, which is now the case with this PR. For the future, we should consider whether we want to keep & document this behaviour.AI Disclaimer
Used Cursor to help me debug the issue more quickly, manually reviewed everything in detail.
Checklist