Our new Python Variant Exporter helps you to export Add-on variants from the same codebase

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:

We are looking forward to your feedback and some battle testing!

We just published our new Python Distribution Tools, which are most useful for Python addons/plugins/extensions. Ready to be battle-tested.

  • Python Vendoring Tool - Vendor libraries in a subpackage, which can be placed anywhere in a project.

  • Python Variant Exporter - Export a specific variant from a codebase.

  • Python Packer Tool - Pack a package into a single Python file.

Have a look here: https://pypi.org/project/pdistx/