Getting Started with the Python SDK
Split’s Python SDK provides robust, scalable feature flag management, giving any team the power to safely launch features and target them to users.
Why use the Split Python SDK?
Split’s Python SDK brings scalable feature flagging to any app, website or experience built in Python. Split helps teams control rollouts and customer experiences while gathering new data and insight on how their products are being engaged. With Split, teams can:
- Release features to production but disabled for all users by default
- Target new features only to internal QA teams
- Slowly roll out features to a broader audience by percentage, demographic, geography, account type, or any other metric
- Kill features with a single click to revert back to your safe state
Split works across many different languages, letting developers, PMs and support teams control feature rollout from one unified view—and monitor the success of any new code. Our integrations bring rollout updates into the tools your team is already using, further opening the feature-delivery process up to your entire organization.
Using the Split Python SDK with Django
Split’s Python SDK for Django supports two different approaches to share information across processes: in-memory cache (via uWSGI) and External cache (via Redis).
django_splitio supports both Python 2 (2.7.10 or later) and Python 3 (3.3 or later) and Django 1.8 (or later). Stable versions can be installed from PyPI using pip.
Using the Python SDK in Multi-Process Mode
When running Python in multi-process mode, state is usually shared between multiple processes using a remote data store. As a result, the Python SDK with multi-process support is architected differently than the plain Python SDK. This architecture has three components:
- The Synchronizer Service The Synchronizer Service is responsible for fetching the data from Split servers it needs to evaluate what treatment to show to a customer. It is a background service that can be run on one machine on a schedule via your scheduling system. We recommend supervisord.
- The cache component The cache is where cron jobs store data fetched from Split servers. Moreover, the SDK client reads from this cache and stores diagnostic data in the cache which is posted back to Split servers via cron jobs. We currently support two types of caches: in-memory cache (via uWSGI), and External cache (via Redis). The current Redis support requires Redis >= v2.6 and the SDK uses Python’s Redis library to communicate with Redis.
- The SDK client is embedded within your Python app. It is the brain that uses data fetched from the cache to decide which treatment to show to a customer for a particular split.
Visit our documentation to learn more about the Split Python SDK’s multi-process mode.
Getting Started with Split for Python
Split’s Python SDK is very simple to integrate into your code base and is completely open source. All it really takes to get rolling with Split is initiating the SDK, then splitting your code.