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

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 Context
from ldclient.async_client import AsyncLDClient
from ldclient.async_config import AsyncConfig

async def main():
    async with AsyncLDClient(AsyncConfig("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

Metadata

Release files for launchdarkly-server-sdk 9.18.2

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.18.2
File Size Uploaded
launchdarkly_server_sdk-9.18.2.tar.gz 414.7 kB Details

Built distribution (wheel)

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

Total release size: 698.3 kB

Release files / launchdarkly_server_sdk-9.18.2.tar.gz

Download URL launchdarkly_server_sdk-9.18.2.tar.gz
Size 414.7 kB
Tags Source
SHA-256 checksum
How to use checksums
044c97db6228034326286c8ee69c6569ee3a7d2602edb9206b81269b8be704c7
BLAKE2b-256 checksum
How to use checksums
ba36dc12ddb4aaa52b67e8ad9b601bc79bdbe970639963a9ac14e62e96c428f4
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.18.2-py3-none-any.whl

Download URL launchdarkly_server_sdk-9.18.2-py3-none-any.whl
Size 283.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b0438d1be78b4df403540d2c21d1a6226fd362395460fb0f53f8bcfd0320a3e
BLAKE2b-256 checksum
How to use checksums
0ffd50f8f6c7b57b73b34b53de52d60789633ea05e13668b00e92f589c76f976
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.18.2 This release

2 release files

9.18.0

2 release files

9.17.0

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