Open PrometheusPi opened 1 year ago
That's a great point and was a bit undervalued for the initial binding implementation.
One can add to a pybind binding multiple optional arguments with a raw string (body) and py::arg("name")
for positional function parameters, including an = ...
assignment for their default values.
Here is an example in ImpactX: https://github.com/ECP-WarpX/impactx/blob/22.11/src/python/elements.cpp#L136-L146
PRs that improve binding doc strings very welcome! :)
Thanks @ax3l for your reply. And thanks for your code example. I will see if/when I hae time.
Might be helpful for a start: https://github.com/pybind/pybind11_mkdoc
Thanks @franzpoeschel
Is your feature request related to a problem? If so, please describe. If one interactively uses openpmd-api in python e.g. via ipython or jupyter, one might need to look up the usage via reading the docstrings as e.g. below
Python:
results in a less-user-friendly output
Describe the solution you'd like It would be fantastic if one could have a more readably docstring for the openPMD-api python module.
Describe alternatives you've considered Currently the best way (for me) is to follow the examples.
Additional context This is not urgent, but it would enhance productivity if one does not have to look for the right example or to scroll through the source code to figure out how to use the python version.