Skip to content

Argument parsing for functions #7

@emmatyping

Description

@emmatyping

To make writing Rust functions that take Python arguments ergonomic, we need an easy way to describe how to parse arguments, and ideally convert to Rust object abstractions. The C API for argument parsing is described here: https://docs.python.org/3/c-api/arg.html

C code in CPython uses a DSL to pre-generate C argument parsing code called argument clinic

We have a few different ways we could go here. PyO3 currently uses proc-macros to provide very ergonomic argument parsing. We could also modify argument clinic to generate Rust code and include!() the generated files, which might have better compilation times.

I am still undecided about which approach I prefer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions