Comments (2)
MVP:
- add support for
str
,int
,float
(and their deprecated aliases:Str
, etc. until we drop support for Python 3.8 around Q4 2024) - deprecate or just drop support for the old mechanism (if possible, move it to a policy, like with name mapping).
Nice to have:
nargs=ZERO_OR_MORE
:-
list[str]
→nargs=ZERO_OR_MORE, type=str
- (same for
list[str] | None
,list[str | None]
andlist[str | None] | None
— there's no difference for us in the context of mapping).
- (same for
-
nargs=N
-
foo: Tuple[str, int, float]
->add_argument('foo', nargs=3)
followed by (e.g.)args = parser.parse_args(); args.foo[1] = int(args.foo[1]); args.foo[2] = float(args.foo[2])
(#107 (comment))
-
- Choices:
-
foo: Literal['one', 'two', 'three']
->add_argument('foo', choices=['one', 'two', 'three']
possibly with completion (later). (#107 (comment))
-
- Passing
add_argument()
params via hints instead of@arg
:-
Annotated[x, ExtraParams(type=some_callable, help="something", nargs="+")]
-
from argh.
Not doing the following:
Tuple[T, ...]
— not sure how to support mixed nested types, AFAIK argparse only allows one type. Maybe limit to uniform? But that also needs to be validated, etc.Annotated[T, ...]
— definitely must have, butAnnotated
was introduced in Python 3.9, so using it will require dropping support for Python 3.8. While we don't need to wait until EOY 2024 with this, it's good to at least ship whatever works before cutting support for the sake of an enhancement.
from argh.
Related Issues (20)
- Expose version information at runtime
- Revamp unit tests
- Remove previously deprecated stuff HOT 1
- Add type annotations to existing code
- Test coverage reported as <100% when argcomplete is installed HOT 5
- Keyword-Only Arguments as Options
- Add support for Python 3.12
- Refactor assembling module
- TypeError: cannot picke '_io.TextIOWrapper' regression in 0.30 for `type=FileType(..), default=sys.stdin)` HOT 2
- 0.30.X is breaking console scripts by moving options to positional arguments HOT 5
- Issue with underscores in positional arguments since 0.30.0 HOT 1
- Using argh.argh(args=... , default=...) causes double nesting of passed arguments HOT 1
- TypingHintArgSpecGuesser breaks on type alias List HOT 11
- Option to disable replacement of "_" with "-" in named cli arguments HOT 3
- Trim trailing `_` from argument names
- Setting the argument name with `dest` is ignored HOT 2
- cmake deprecation warning with cmake<3.5 HOT 1
- Test failures with Python 3.13.0b2 HOT 3
- Add ability to display long options in usage message
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argh.