pthom / litgen

litgen: a pybind11 automatic generator for humans who like nice code and API documentation. Also a C++ transformer tool
https://pthom.github.io/litgen
GNU General Public License v3.0
36 stars 3 forks source link

How to disable comments or use pybind11 literals #4

Closed nnop closed 3 months ago

nnop commented 3 months ago

Hi, Thanks for the great tool. It can save me a lot of tedious work when binding C++ code. I have two questions:

  1. how to disable generating comments with the binding code?
  2. how to use pybind11 literals _a instead of py::arg?

Didn't find that in the options code.

nnop commented 3 months ago

Could you have a look at this issue? @pthom

pthom commented 3 months ago

Hello,

Thanks for your output.

how to use pybind11 literals _a instead of py::arg

I do not see the motivation for this, given that this is generated code. Can you please explain why you would want this?

If this is to save a few bytes in the generated code, I do not think it is worth the effort.

how to disable generating comments with the binding code?

Same question, what is your use case? Also, are you referring to the comment in the python stubs file, the C++ file, or both?

pthom commented 3 months ago

See https://github.com/pthom/litgen/commit/ebf7c044effe45ae960521a8945f32effd826cb5

nnop commented 3 months ago

Thanks for you respondence and the update.

Now I mainly use litgen to generating an initial version of the binding code and handful modification to fullfill my work. For example, converting the CamelCase names to underscore_case.

Because many C++ functions exist in the form of output parameters, I need to wrap them with lambda functions, create temporary variables, and return them.

Also, considering return value policies and object life time, there's still some manual modification work involved. And I feel more confirmed in that way. Therefore, I hope to start with a relatively simple initial binding code.

Litgen is a powerful tool and is quite new to me. I think, as my understanding of it deepens, I will become less and less dependent on manually writing and modifying binding code.