Garrus990
New Contributor II

Hey guys,

I think I managed to find a workaround. I will leave it here for everyone that is seeking the same answers, including future me.

What I did is basically this piece of code:

def main():
    try:
        assign_variants(standalone_mode=False)
    except SystemExit as e:
        # Only suppress exit code 0 (success)
        if e.code != 0:
            raise
        # For success, exit cleanly
        sys.exit(0)

Where assign_variants is the name of my Click-decorated function. The function can be called in the script or pointed as an endpoint.