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

Release files for launchdarkly-server-sdk 9.17.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for launchdarkly-server-sdk 9.17.0
File Size Uploaded
launchdarkly_server_sdk-9.17.0.tar.gz 381.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for launchdarkly-server-sdk 9.17.0
File Interpreter ABI Platform
launchdarkly_server_sdk-9.17.0-py3-none-any.whl Python 3 none any Details

Total release size:653.7 kB

Release files / launchdarkly_server_sdk-9.17.0.tar.gz

Download URL launchdarkly_server_sdk-9.17.0.tar.gz
Size 381.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0c7ff0bf25aeb2e2579df00b74bab28fefa891b4633832f45933e9d76d3a788c
BLAKE2b-256 checksum
How to use checksums
55681f52405c0e3e85894a588220b77803ae4390723118c9bb36112bf29ca812
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / launchdarkly_server_sdk-9.17.0-py3-none-any.whl

Download URL launchdarkly_server_sdk-9.17.0-py3-none-any.whl
Size 272.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba2f308b87d47f200bd591040707cb9e0008654e14f0f93411a8c4530cbb5307
BLAKE2b-256 checksum
How to use checksums
c158bcede9c0f11b5c37b492ea993ed0599099e15f803b9fe98452558cfd6e96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

9.17.0 This release

2 release files

9.16.1

2 release files

9.15.1

2 release files

9.15.0

2 release files

9.14.1

2 release files

9.13.1

2 release files

9.13.0

2 release files

9.12.3

2 release files

9.12.2

2 release files

9.12.1

2 release files

9.12.0

2 release files

9.11.1

2 release files

9.11.0

2 release files

9.10.0

2 release files

9.9.0

2 release files

9.8.1

2 release files

9.8.0

2 release files

9.7.2

2 release files

9.7.1

2 release files

9.7.0

2 release files

9.6.0

2 release files

9.5.0

2 release files

9.4.0

2 release files

9.3.1

2 release files

9.3.0

2 release files

9.2.2

2 release files

9.2.1

2 release files

9.2.0

2 release files

9.1.0

2 release files

9.0.1

2 release files

9.0.0

2 release files

8.3.0

2 release files

8.2.1

2 release files

8.2.0

2 release files

8.1.7

2 release files

8.1.6

2 release files

8.1.5

2 release files

8.1.4

2 release files

8.1.3

2 release files

8.1.2

2 release files

8.1.1

2 release files

8.1.0

2 release files

8.0.0

2 release files

7.6.1

2 release files

7.6.0

2 release files

7.5.1

2 release files

7.5.0

1 release file

7.4.2

1 release file

7.4.1

1 release file

7.4.0

1 release file

7.3.1

1 release file

7.3.0

1 release file

7.2.1

1 release file

7.2.0

1 release file

7.1.0

1 release file

7.0.2

1 release file

7.0.1

1 release file

7.0.0

1 release file

6.13.3

1 release file

6.13.2

1 release file

6.13.1

1 release file

6.13.0

1 release file

6.12.2

1 release file

6.12.1

1 release file

6.12.0

1 release file

6.11.3

1 release file

6.11.2

1 release file

6.11.1

1 release file

6.11.0

1 release file

6.10.2

1 release file

6.10.1

1 release file

6.10.0

1 release file

6.9.4

1 release file

6.9.3

1 release file

6.9.2

1 release 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