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.4

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.4
File Size Uploaded Provenance Actions
launchdarkly_server_sdk-9.18.4.tar.gz 416.5 kB Without provenance Details for launchdarkly_server_sdk-9.18.4.tar.gz

Built distribution (wheel)

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

Total release size: 700.2 kB

Release files / launchdarkly_server_sdk-9.18.4.tar.gz

Download URL launchdarkly_server_sdk-9.18.4.tar.gz
Size 416.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b5ecb89c84e99133a420a29015dbb705c760cc3493478307577993bc53ae6195
BLAKE2b-256 checksum
How to use checksums
a775e3608fd0298afc683ae4daf0b9daae3bfae7b30458d57c601a67c0e45aaa
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.4-py3-none-any.whl

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

Security for launchdarkly-server-sdk 9.18.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

9.18.4 This release

2 release files No provenance

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