QuantConnect / QuantConnect/lean-cli
Case handling for `Choice` help output (values forced to lowercase)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 326
- Forks
- 168
- Avg merge
- 3d 50m
- Merged PRs (30d)
- 3
Description
Expected Behavior
Values passed to click.Choice should preserve their original casing when displayed in --help output.
Example:
--brokerage [Interactive Brokers|Tradier|Oanda|Bitfinex|Coinbase Advanced Trade|Binance|Zerodha|Samco|Terminal Link|Trading Technologies|Kraken|CharlesSchwab|IQFeed|Polygon|CoinApi|ThetaData|Custom data only|Bybit|TradeStation|Alpaca|Tastytrade|Eze]
Actual Behavior
Since Click 8.2.0, all values are displayed in lowercase, regardless of how they were registered:
--brokerage [paper trading|interactive brokers|tradier|oanda|bitfinex|coinbase advanced trade|binance|zerodha|samco|terminal link|trading technologies|kraken|charlesschwab|bybit|tradestation|alpaca|tastytrade|eze]
This misleads users into thinking only lowercase values are accepted.
Potential Solution
- create custom class
MyChoice(Choice)override get_metavar(...)
- Continue using case-folding for parsing input when case_sensitive=False.
- The regression likely comes from PR #2796, which lowercases values when registering.
Reproducing the Problem
-
run:
lean live deploy --help -
Click 8.1.8: casing preserved ✅
-
Click 8.2.0+: values all lowercase ❌
System Information
- Click version(s): 8.2.0, 8.2.1 (regression)
- Last working version: 8.1.8
- OS: All (confirmed on Windows 10, Ubuntu 22.04)
- Python: 3.11
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
masterbranch - I have confirmed that this is not a duplicate issue by searching issues
- I have provided detailed steps to reproduce the issue
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the regression with lean live deploy --help, comparing Click 8.1.8 with 8.2.0 or 8.2.1. Start by reviewing Click Choice behavior and the registration change in PR #2796. Done means help output preserves the registered casing while case-insensitive parsing still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100