We have developed a small tool to export different variants from the same Python codebase and named it Python Variant Exporter :-).
It is useful, e.g., if you are an addon developer and want to export a free and a commercial version of an addon from the same codebase.
If you have code like this:
__VARIANT__ = 'DEV'
def example():
if __VARIANT__ in ['DEV', 'PRO']:
print('PRO')
elif __VARIANT__ == 'FREE':
print('FREE')
example()
Python Variant Exporter can export it for you to fit:
pvariant -d __VARIANT__=PRO example.py example_pro.py
__VARIANT__ = 'PRO'
def example():
print('PRO')
example()
See here for more:
- https://pypi.org/project/pdistx/
- https://github.com/3dninjas/pdistx
- https://github.com/3dninjas/pdistx/tree/main/examples/blender_addon
We are looking forward to your feedback and some battle testing!