Skip to main content

LaunchDarkly Server-side SDK for Python

Actions Status readthedocs

PyPI PyPI

LaunchDarkly overview

LaunchDarkly is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. Get started using LaunchDarkly today!

Twitter Follow

Supported Python versions

This version of the LaunchDarkly SDK is compatible with Python 3.10+.

Getting started

Refer to the SDK reference guide for instructions on getting started with using the SDK.

Async support

[!CAUTION] The async implementation (AsyncLDClient and its associated async API) is experimental and should NOT be considered ready for production use. It may change or be removed without notice and is not subject to backwards compatibility guarantees.

Pin to a specific minor version and review the changelog before upgrading.

[!NOTE] Using Redis with the async client (big segments or a persistent data store) requires redis>=4.2.0, the version that introduced redis.asyncio. The redis extra itself still permits older versions for synchronous use, so install redis>=4.2.0 when using Redis with the async client.

An async implementation, AsyncLDClient, is available for use with asyncio-based applications. It uses aiohttp for HTTP and requires installing the optional async extra:

pip install launchdarkly-server-sdk[async]
import asyncio
from ldclient import Config, Context
from ldclient.async_client import AsyncLDClient

async def main():
    async with AsyncLDClient(Config("sdk-key")) as client:
        value = await client.variation("my-flag", Context.create("user-key"), False)
        print(value)

asyncio.run(main())

Event loop

AsyncLDClient runs on the caller's event loop. It targets a single event loop and is not thread-safe. Use one client for the whole application.

The constructor does not need a running event loop. So you can create the client once, before the application forks or preloads its workers. Then start the client on each worker's event loop with await client.start(). You can also use async with AsyncLDClient(config) as client:, which starts and closes the client for you.

This model fits ASGI servers. Create the client at application startup, and start it in the ASGI lifespan handler.

Learn more

Read our documentation for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the complete reference guide for this SDK.

Generated API documentation is on readthedocs.io.

Testing

We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.

Contributing

We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.

Verifying SDK build provenance with the SLSA framework

LaunchDarkly uses the SLSA framework (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the provenance guide.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read our documentation for a complete list.
  • Explore LaunchDarkly

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

launchdarkly_server_sdk-9.17.0.tar.gz (381.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

launchdarkly_server_sdk-9.17.0-py3-none-any.whl (272.7 kB view details)

Uploaded Python 3

File details

Details for the file launchdarkly_server_sdk-9.17.0.tar.gz.

File metadata

  • Download URL: launchdarkly_server_sdk-9.17.0.tar.gz
  • Upload date:
  • Size: 381.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for launchdarkly_server_sdk-9.17.0.tar.gz
Algorithm Hash digest
SHA256 0c7ff0bf25aeb2e2579df00b74bab28fefa891b4633832f45933e9d76d3a788c
MD5 79bcac6618b1eb456ff7092ce8b566a8
BLAKE2b-256 55681f52405c0e3e85894a588220b77803ae4390723118c9bb36112bf29ca812

See more details on using hashes here.

File details

Details for the file launchdarkly_server_sdk-9.17.0-py3-none-any.whl.

File metadata

File hashes

Hashes for launchdarkly_server_sdk-9.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba2f308b87d47f200bd591040707cb9e0008654e14f0f93411a8c4530cbb5307
MD5 ecb34349500aadff279fbafb0789f58b
BLAKE2b-256 c158bcede9c0f11b5c37b492ea993ed0599099e15f803b9fe98452558cfd6e96

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

9.17.0 This release

2 files

9.16.1

2 files

9.16.0

2 files

9.15.1

2 files

9.15.0

2 files

9.14.1

2 files

9.14.0

2 files

9.13.1

2 files

9.13.0

2 files

9.12.3

2 files

9.12.2

2 files

9.12.1

2 files

9.12.0

2 files

9.11.1

2 files

9.11.0

2 files

9.10.0

2 files

9.9.0

2 files

9.8.1

2 files

9.8.0

2 files

9.7.2

2 files

9.7.1

2 files

9.7.0

2 files

9.6.0

2 files

9.5.0

2 files

9.4.0

2 files

9.3.1

2 files

9.3.0

2 files

9.2.2

2 files

9.2.1

2 files

9.2.0

2 files

9.1.0

2 files

9.0.1

2 files

9.0.0

2 files

8.3.0

2 files

8.2.1

2 files

8.2.0

2 files

8.1.7

2 files

8.1.6

2 files

8.1.5

2 files

8.1.4

2 files

8.1.3

2 files

8.1.2

2 files

8.1.1

2 files

8.1.0

2 files

8.0.0

2 files

7.6.1

2 files

7.6.0

2 files

7.5.1

2 files

7.5.0

1 file

7.4.2

1 file

7.4.1

1 file

7.4.0

1 file

7.3.1

1 file

7.3.0

1 file

7.2.1

1 file

7.2.0

1 file

7.1.0

1 file

7.0.2

1 file

7.0.1

1 file

7.0.0

1 file

6.13.3

1 file

6.13.2

1 file

6.13.1

1 file

6.13.0

1 file

6.12.2

1 file

6.12.1

1 file

6.12.0

1 file

6.11.3

1 file

6.11.2

1 file

6.11.1

1 file

6.11.0

1 file

6.10.2

1 file

6.10.1

1 file

6.10.0

1 file

6.9.4

1 file

6.9.3

1 file

6.9.2

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page