Skip to content

v0.5.0 - Adds testing utility methods and support for id_lists

Choose a tag to compare

@tore-statsig tore-statsig released this 17 Dec 19:22
· 537 commits to main since this release

Testing utility functions

override_gate(gate:str, value:bool, user_id:str = None) - overrides a gate to the given value. If a user_id is not provided, all gate checks will return this value. If a specific user_id is passed, the override only applies to that given user_id

override_config and override_experiment function similarly, but for DynamicConfigs and Experiments

StatsigOptions.local_mode- local mode disables network access, so the SDK will only return default values and never hit statsig servers. Useful for unit testing

evaluate_all(user) - given a user, evaluates all gates/configs/experiments in the project and returns a dictionary with the results. Useful for reproducing an issue and determining which values a given user has

Example output:

"feature_gates":{
    "always_on_gate":{
        "value": True,
        "rule_id":"6N6Z8ODekNYZ7F8gFdoLP5"
    },
    "on_for_statsig_email":{
        "value": True,
        "rule_id":"7w9rbTSffLT89pxqpyhuqK"
    }
},
"dynamic_configs":{
    "test_config":{
        "value":{
            "boolean": False,
            "number":7,
            "string":"statsig"
        },
        "rule_id":"1kNmlB23wylPFZi1M0Divl"
    },
    "sample_experiment":{
        "value":{
            "experiment_param":"test"
        },
        "rule_id":"2RamGujUou6h2bVNQWhtNZ"
    }
}

ID Lists

Adds python SDK support for ID lists: https://docs.statsig.com/segments/add-id-list