Releases: launchdarkly/python-server-sdk
8.0.0
[8.0.0] - 2022-12-30
The latest version of this SDK supports LaunchDarkly's new custom contexts feature. Contexts are an evolution of a previously-existing concept, "users." Contexts let you create targeting rules for feature flags based on a variety of different information, including attributes pertaining to users, organizations, devices, and more. You can even combine contexts to create "multi-contexts."
This feature is only available to members of LaunchDarkly's Early Access Program (EAP). If you're in the EAP, you can use contexts by updating your SDK to the latest version and, if applicable, updating your Relay Proxy. Outdated SDK versions do not support contexts, and will cause unpredictable flag evaluation behavior.
If you are not in the EAP, only use single contexts of kind "user", or continue to use the user type if available. If you try to create contexts, the context will be sent to LaunchDarkly, but any data not related to the user object will be ignored.
For detailed information about this version, please refer to the list below. For information on how to upgrade from the previous version, please read the migration guide.
Added:
- In
ldclient
, theContext
type defines the new context model. - For all SDK methods that took a user parameter in the form of a
dict
, you can now pass aContext
instead. You can still pass adict
containing user properties, in which case the SDK will convert it to aContext
transparently; however,Context
is preferable if you value efficiency since there is some overhead to this conversion. - The
TestData
flag builder methods have been extended to support now context-related options, such as matching a key for a specific context type other than "user".
Changed (breaking changes from 7.x):
- It was previously allowable to set a user key to an empty string. In the new context model, the key is not allowed to be empty. Trying to use an empty key will cause evaluations to fail and return the default value.
- There is no longer such a thing as a
secondary
meta-attribute that affects percentage rollouts. If you set an attribute with that name in aContext
, it will simply be a custom attribute like any other. - The
anonymous
attribute is now a simple boolean, with no distinction between a false state and a null/undefined state. Previously, a flag rule likeanonymous is false
would not match if the attribute was undefined, but now undefined is treated the same as false.
Changed (requirements/dependencies/build):
- The minimum Python version is now 3.7.
Changed (behavioral changes):
- The SDK can now evaluate segments that have rules referencing other segments.
- Analytics event data now uses a new JSON schema due to differences between the context model and the old user model.
- Several optimizations within the flag evaluation logic have improved the performance of evaluations. For instance, target lists are now stored internally as sets for faster matching.
Removed:
- Removed all types, properties, and methods that were deprecated as of the most recent 5.x release.
- Removed the deprecated
ldclient.flag
module. This was previously an alternate way to import theEvaluationDetail
type; now, you can only import that type fromldclient.evaluation
. - The
alias
method no longer exists because alias events are not needed in the new context model. - The
inline_users_in_events
option no longer exists because it is not relevant in the new context model.
7.5.1
[7.5.1] - 2022-09-29
Added:
- Publishing this package now includes a pre-built wheel distribution in addition to the customary source distribution.
7.5.0
[7.5.0] - 2022-07-01
Added:
- A new
redis_opts
parameter is available when configuring a Redis feature or Big Segment store. This parameter will be passed through to the underlying redis driver, allowing for greater configurability. (Thanks, danie1k!)
Fixed:
- Our previous attempt at adding mypy type checking support missed the inclusion of the required py.typed file. (Thanks, anentropic!)
7.4.2
[7.4.2] - 2022-06-16
Changed:
- Removed upper version restriction on expiringdict. This was originally necessary to allow compatibility with older Python versions which are no longer supported.
7.4.1
[7.4.1] - 2022-04-22
Added:
- Added py.typed file to indicate typing support. Thanks @phillipuniverse
Fixed:
- Fixed invalid operator in key in TestData.
- Fixed bucketing logic to not treat boolean values as bucketable value types.
7.4.0
[7.4.0] - 2022-02-16
Added:
TestData
, in the new moduleldclient.integrations.test_data
, is a new way to inject feature flag data programmatically into the SDK for testing—either with fixed values for each flag, or with targets and/or rules that can return different values for different users. Unlike the file data source, this mechanism does not use any external resources, only the data that your test code has provided.
7.3.1
[7.3.1] - 2022-02-14
Added:
- CI builds now include a cross-platform test suite implemented in https://github.com/launchdarkly/sdk-test-harness. This covers many test cases that are also implemented in unit tests, but may be extended in the future to ensure consistent behavior across SDKs in other areas.
Fixed:
- The SDK no longer uses the deprecated method
threading.Condition.notifyAll()
. (Thanks, jdmoldenhauer!) - A rule clause that uses a date operator should be considered a non-match, rather than an error, if either value is
None
. - A rule clause that uses a semver operator should be considered a non-match, rather than an error, if either value is not a string.
- Rules targeting the
secondary
attribute will now reference the correct value. - The
identify
method should not emit an event if the user key is an empty string. - Do not include
prereqOf
field in event data if it is null. This is done to save on event transfer bandwidth. - Data from
all_flags_state
was always including the flag's version even when it was unnecessary. - Any base URIs set in
Config
will work consistently whether they have trailing slashes or not. - When using
all_flags_state
to produce bootstrap data for the JavaScript SDK, the Python SDK was not returning the correct metadata for evaluations that involved an experiment. As a result, the analytics events produced by the JavaScript SDK did not correctly reflect experimentation results. - Data from
all_flags_state
was always including the flag's version even when it was unnecessary.
7.3.0
[7.3.0] - 2021-12-10
Added:
- The SDK now supports evaluation of Big Segments. See: https://docs.launchdarkly.com/home/users/big-segments
7.2.1
[7.2.1] - 2021-12-03
Changed:
- Added CI testing for Python 3.10.
Fixed:
- In streaming mode, the SDK could sometimes fail to receive flag data from LaunchDarkly if the data contained characters that are not in the Basic Latin character set. The error was intermittent and would depend on unpredictable factors of speed and network behavior which could cause the first byte of a multi-byte UTF8 character to be processed before the rest of the bytes had arrived.
- Fixed some irregularities in the SSE parsing logic used for stream data. The SDK's CI tests now include a more thorough test suite for SSE behavior that is implemented in https://github.com/launchdarkly/sse-contract-tests, to ensure that it is consistent with other LaunchDarkly SDKs.
7.2.0
[7.2.0] - 2021-06-17
Added:
- The SDK now supports the ability to control the proportion of traffic allocation to an experiment. This works in conjunction with a new platform feature now available to early access customers.