symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.44k stars 147 forks source link

Add `skip_type_generation` argument to `generate_function` to suppress type generation #360

Closed gareth-cross closed 2 months ago

gareth-cross commented 1 year ago

This change adds an optional argument to generate_function to allow skipping generation of any code-generation types (c++/python/lcm).

When true, only the function code is generated and no other files are written. The logic proceeds normally otherwise, and the typenames_dict and namespaces_dict are filled out as expected.

This configuration is useful if you intend to define types manually elsewhere, and want to suppress any extra emitted files.

This is a more minimal version of the proposal raised here: https://github.com/symforce-org/symforce/discussions/183

CC @anuragmakineni

aaron-skydio commented 1 year ago

I think you could also accomplish this by passing shared_types as all the types the function takes, although it's maybe annoying to have to build that - I do think we maybe want to merge the flags, e.g. have a singleton ALL as something you can pass for shared_types to indicate that all types are shared, instead of adding an additional argument?