Bottom Grid Grid

Feature flags for Python

Deploy faster, improve reliability, and release confidently using feature flags in Python applications.

Get the code
launchdarkly sdk for python video thumbnail

Take control of releases in Python

From Django and Flask to TensorFlow, feature flags help make the most of Python apps by letting teams deploy code changes to subsets of users, instantly roll back buggy features, and run A/B tests in production safely.

Get started

Small, frequent, low-risk deploys

Ship faster, confidently. LaunchDarkly feature flags decouple deployments from releases, so teams can safely test new functionality in production with the confidence to rollback instantly.

Instant rollbacks

Resolve incidents in real-time. Use feature flags like kill switches to turn off defective code with a single toggle. No emergency fixes, no redeploying an entire app.

Progressive rollouts

Use Python feature flags to roll out features to a specific subset of users then gradually roll it out to the broader user base when it's ready.

Collaborative software delivery

Empower business stakeholders to turn features on and off for users. Enhance the customer experience and save engineers time. Developers can deploy code and business leaders can release features when they’re ready.

play button icon

Learn more on our YouTube Channel

Watch “Developing APIs with Python and LaunchDarkly”

Get started with LaunchDarkly for Python

Install the SDK

# install with your favorite package manager
pip install launchdarkly-server-sdk
poetry add launchdarkly-server-sdk
Copy code

Initialize

import ldclient
from ldclient.config import Config
from ldclient import Context

ldclient.set_config(Config("sdk-key-123abc"))
client = ldclient.get()

context = Context.builder("<a unique user id>").name("<a more user friendly name for the user>").build()
Copy code

Evaluate Feature Flags

# our SDKs let you easily select flags by name and set a default value
api_rate_limit = client.variation("api-rate-limit", context, 1000)
Copy code

Why feature management?

Learn more

Feature management helps teams use feature flags on a massive scale across a variety of complex use cases.

Unlike configuration files, our feature management platform lets developers:

  • Progressively roll out new features to targeted groups of users.
  • Disable problematic code paths in milliseconds.
  • Take complete control over every feature in a Python application without having to redeploy.

Frequently Asked Questions

The LaunchDarkly Python SDK is a server-side SDK meaning you’ll use your Server-Side SDK Key to configure the client.

LaunchDarkly’s Python SDK uses a streaming connection, an always-open connection to the Flag Delivery Network. Thanks to this constant, high-speed connection to the flag delivery network, your connected SDKs will receive updates to feature flags within 200ms.

LaunchDarkly’s JavaScript SDKs all use a streaming connection, an always-open connection to the Flag Delivery Network. Thanks to this constant, high-speed connection to the flag delivery network, your connected SDKs will receive updates to feature flags within 200ms.

No, in fact, at app startup, when the SDK initializes, LaunchDarkly only needs 25ms to initialize and get the starting feature flag values from the Flag Delivery Network.

No. All our SDKs perform all feature flag evaluations in memory using the feature flag ruleset they have cached in memory.

Each of our SDKs follows the same pattern: initialize, evaluate, update. When feature flags are changed in LaunchDarkly, those changes are broadcast to the Flag Delivery Network.

LaunchDarkly reliably serves 20 trillion flags a day around the globe through our Flag Delivery Network. In the case where your app can’t reach LaunchDarkly’s flag delivery network, we’ve built in two backstops to ensure your application continues to work uninterrupted. Our SDKs are self-healing, if their connection to the flag delivery network is interrupted, they will continue to retry in the background until they can reconnect. Because all feature flag evaluations happen in memory, your app will just keep working. Each of our SDKs also offers the ability to set a default value in the event you can’t reach the flag delivery network at app startup, so your app can safely start serving your defaults and get its updates as soon as it can connect again.

Explore more

Launching Darkly with Python and a Star Wars API

Launching Darkly with Python and a Star Wars API

Feature Flags: Beyond the Boolean

Feature Flags: Beyond the Boolean

Wrapping LaunchDarkly

Wrapping LaunchDarkly

Read more on our blog.

play button icon

Learn more on our YouTube Channel

Watch “Cloud and Database Migrations with Python and LaunchDarkly”

We've been able to roll out new features at a pace that would've been unheard of a couple of years ago.

IBM
Michael McKaySr. Development Manager

Discover how to deploy code faster with less risk.

Get a demo