| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
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!
This version of the LaunchDarkly SDK is compatible with Python 3.10+.
Refer to the SDK reference guide for instructions on getting started with using the SDK.
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())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.
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.
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.
We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.
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.
| Back | FazBrowse Home | New Git URL |