Python quickstart
1. Install hypertune-sdk
hypertune-sdkOnce you have a Python application ready, install Hypertune's Python SDK:
pip install hypertune-sdk2. Install the Hypertune CLI
Run the following command to install the CLI
curl -fsSL https://app.hypertune.com/install-cli.sh | shAlternatively, you can download the Hypertune CLI for your system:
Then:
Put it somewhere accessible via your
PATHAdd execute permissions to it with
chmod +x hypertuneRight-click to open it
3. Generate the client
Generate a type-safe client to access your flags by running:
hypertune generate --language python --output-file-dir generated --token <token> Replace <token> with your main project token which you can find in the Settings tab of your project.
4. Use the client
import generated.hypertune as hypertune
def main():
root_node = hypertune.create_source().root({
"context": {
"environment": "development",
"user": {
"id": "test_id",
"name": "Test",
"email": "[email protected]",
}
}
})
root_node.wait_for_initialization()
example_flag = root_node.exampleFlag().get(False)
if __name__ == "__main__":
main()Next steps
Now you can update the logic for exampleFlag from the Hypertune UI without updating your code or waiting for a new build, deployment, app release, or service restart.
To add a new flag, create it in the Hypertune UI then regenerate the client.
Last updated