[ANN] pyml_bindgen: a CLI app to generate Python bindings directly from OCaml value specifications

New release

Version 0.4.1 is now available from GitHub and Opam. The change log has more details.

New stuff

New attributes

There is a new attribute you can use: py_arg_name. It allows you to use different argument names on the OCaml side from those that are used on the Python side.

One use case is for Python functions that have an argument name that is the same as some reserved OCaml keyword. In this case, you can use py_arg_name to map it to something else on the OCaml side.

val f : t -> method_:string -> unit -> string 
[@@py_arg_name method_ method]

The attribute is followed by two items, the first is the argument name on the OCaml side, and the second is the argument name on the Python side.

See the attributes example on GitHub for more info.

Helper scripts

I added a couple of scripts to help in cases where you need to run pyml_bindgen on a lot of different input files in one go. I have been using them when writing bindings for bigger Python libraries, and in cases where there are a lot of cyclic python classes to bind.

This example has more info about using the helper scripts.

Other stuff

  • Added an option to split generated modules into ml and mli files.
  • Added a dev package for (hopefully) easier installation of development dependencies.

Happy hacking!! :sparkles:

7 Likes