feat: Add Config.with_wrapper_information - #501
Merged
Conversation
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
|
@cursor review |
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
keelerm84
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Config.with_wrapper_information, so wrapper libraries can derive a config that identifies themselves without reaching intoConfiginternals.wrapper_name/wrapper_versionreplacedConfiguration.Builder(config).WrapperInfo(...)in .NET andLDConfig.Builder.fromConfig(config).wrapper(...)in JavaRequirements
Implementation details
Related issues
Needed by openfeature-python-server#51, where the OpenFeature provider must report itself as the wrapper. Wrapper information can only be supplied to the
Configconstructor today, so a provider that accepts an application-suppliedConfighas no supported way to add it. The .NET and Java providers do this through their SDK's builder-from-config API; Python has no equivalent.copy_with_new_sdk_keyis the closest existing method, but it is deprecated and rebuilds the config by hand, so it silently drops anything added since it was written (application,hooks,plugins,datasystem_config, and others).Describe the solution you've provided
Shallow-copying avoids the maintenance hazard of re-listing every constructor parameter: fields added later are carried over automatically. Component references (feature store, hooks, plugins) are shared with the original config, which matches how a config is used — the derived config is what gets handed to
LDClient, and the original is not used to build a second client.Describe alternatives you've considered
copy_with(**kwargs): broader surface area than needed, and re-exposes the constructor's parameter list to the same drift problem.Config.Builder-style API matching .NET/Java: a much larger change to a long-standing public API, and not required to unblock the providers.Testing
test_with_wrapper_informationcovers replacing both fields while leaving unrelated settings and the original config intact;test_with_wrapper_information_defaults_the_versioncovers omitting the version.Link to Devin session: https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Requested by: @kinyoklion
Note
Overview
Adds
Config.with_wrapper_informationso wrapper libraries (e.g. OpenFeature providers) can stampwrapper_name/wrapper_versiononto an application-supplied config without reconstructing it or touching private fields.The method shallow-copies the existing
Config, replaces those two fields, and leaves the original instance unchanged. Shared objects such as the feature store and HTTP config are not cloned. Tests cover replacement of both fields and omitting the version.Reviewed by Cursor Bugbot for commit 6db02bf. Bugbot is set up for automated code reviews on this repo. Configure here.