OpenAssetIO / OpenAssetIO-TraitGen

A code generation tool that produces OpenAssetIO Traits and Specifications from a simple YAML description.
Apache License 2.0
6 stars 5 forks source link

Alllow traitgen to generate traits to custom location #93

Open antirotor opened 1 month ago

antirotor commented 1 month ago

Problem

We would like to include generated trait python files in our repos because they are bound to the functionality and must be versioned together with code using them. So we have trait yaml file in our project and I am generating python files from them using traitgen. Because I can't set destination, I am doing it in temporary directory and after traits are generated, I move them to final their final destination.

As a bonus (because I am aggregating multiple sources of trait definitions - more yaml files) I create on higher level __init__.py that is adding imports and and __all__ = [] declaration for easier use.

But it would be nice to just set output path.

SamCrooksFoundry commented 1 month ago

Hey, does the --output-dir flag that's already in trait-gen meet your requirements? https://github.com/OpenAssetIO/OpenAssetIO-TraitGen/blob/fcbbabe27672759412b8ed9cc562c2b21b9ff058/python/openassetio_traitgen/__main__.py#L80