GithubHelp home page GithubHelp logo

Comments (2)

neithere avatar neithere commented on July 27, 2024

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] and list[str | None] | None — there's no difference for us in the context of mapping).
  • 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.

neithere avatar neithere commented on July 27, 2024

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, but Annotated 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.