Skip to content

feat: Report provider name and version to LaunchDarkly - #51

Open
kinyoklion wants to merge 2 commits into
mainfrom
devin/openfeature-python-wrapper-info
Open

feat: Report provider name and version to LaunchDarkly#51
kinyoklion wants to merge 2 commits into
mainfrom
devin/openfeature-python-wrapper-info

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Aug 19, 2026

Copy link
Copy Markdown
Member

The provider now identifies itself as the wrapper, so requests it makes are attributed to the OpenFeature provider rather than to the Python SDK.

  • Sets wrapper_name to open-feature-python-server and wrapper_version to the provider version
  • Uses Config.with_wrapper_information, released in launchdarkly-server-sdk 9.17.0
  • Raises the SDK floor to >=9.17.0
  • Adds ld_openfeature/version.py, kept current by release-please

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions
Implementation details

Describe the solution you've provided

self.__client = LDClient(config.with_wrapper_information(WRAPPER_NAME, VERSION))

This matches the Java and .NET providers, which derive a config from the application-supplied one:

new LDClient(sdkKey, LDConfig.Builder.fromConfig(config)
    .wrapper(Components.wrapperInfo()
        .wrapperName("open-feature-java-server")
        .wrapperVersion(Version.SDK_VERSION)).build());

The provider version comes from a new ld_openfeature/version.py, added to extra-files in release-please-config.json so the constant is bumped with each release the same way docs/conf.py already is.

Describe alternatives you've considered

An earlier revision of this PR copied the Config and assigned its name-mangled private wrapper fields, because wrapper information could only be supplied to the constructor. That depends on SDK internals, hence the SDK change instead (python-server-sdk#501).

Testing

test_provider_identifies_itself_as_the_wrapper asserts the client's config carries the provider's name and version, and that the config passed in by the caller is unchanged. Against the released 9.17.0: 80 tests pass, mypy clean.

Link to Devin session: https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Open in Devin Desktop: https://app.devin.ai/desktop/session/0c452d209ec54b068ba120b4c92b8f6c?variant=devin
Requested by: @kinyoklion


Note

Overview
LaunchDarkly traffic from this provider is now attributed to the OpenFeature integration instead of looking like plain Python SDK usage.

LaunchDarklyProvider builds the underlying LDClient from config.with_wrapper_information("open-feature-python-server", VERSION) so wrapper name and version are set on the client config without mutating the caller’s Config. The version lives in new ld_openfeature/version.py, wired into release-please alongside docs/conf.py.

The minimum launchdarkly-server-sdk dependency is raised to >=9.17.0 for with_wrapper_information. A test asserts the client carries the expected wrapper fields and that the original config’s wrapper_name stays unset.

Reviewed by Cursor Bugbot for commit 8f3861b. Bugbot is set up for automated code reviews on this repo. Configure here.

@kinyoklion kinyoklion self-assigned this Aug 19, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot added the devin-pr Pull request created by Devin AI label Aug 19, 2026
kinyoklion added a commit to launchdarkly/python-server-sdk that referenced this pull request Aug 20, 2026
Adds `Config.with_wrapper_information`, so wrapper libraries can derive
a config that identifies themselves without reaching into `Config`
internals.

- New public method returning a copy of the config with
`wrapper_name`/`wrapper_version` replaced
- The original config is left unmodified
- Mirrors `Configuration.Builder(config).WrapperInfo(...)` in .NET and
`LDConfig.Builder.fromConfig(config).wrapper(...)` in Java

**Requirements**

- [x] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [x] I have validated my changes against all supported platform
versions

<details>
<summary>Implementation details</summary>

**Related issues**

Needed by
[openfeature-python-server#51](launchdarkly/openfeature-python-server#51),
where the OpenFeature provider must report itself as the wrapper.
Wrapper information can only be supplied to the `Config` constructor
today, so a provider that accepts an application-supplied `Config` has
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_key` is 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**

```python
def with_wrapper_information(self, wrapper_name, wrapper_version=None) -> 'Config':
    updated = copy.copy(self)
    updated.__wrapper_name = wrapper_name
    updated.__wrapper_version = wrapper_version

    return updated
```

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**

- A general `copy_with(**kwargs)`: broader surface area than needed, and
re-exposes the constructor's parameter list to the same drift problem.
- A `Config.Builder`-style API matching .NET/Java: a much larger change
to a long-standing public API, and not required to unblock the
providers.
- Letting wrappers keep assigning the name-mangled private fields:
works, but depends on implementation details of the SDK.

**Testing**

`test_with_wrapper_information` covers replacing both fields while
leaving unrelated settings and the original config intact;
`test_with_wrapper_information_defaults_the_version` covers omitting the
version.

</details>


Link to Devin session:
https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Requested by: @kinyoklion

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Adds `Config.with_wrapper_information` so wrapper libraries (e.g.
OpenFeature providers) can stamp `wrapper_name` / `wrapper_version` onto
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.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6db02bf. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@kinyoklion

Copy link
Copy Markdown
Member Author

Devin, update this PR to use the just released python version.

devin-ai-integration Bot and others added 2 commits August 28, 2026 21:31
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/openfeature-python-wrapper-info branch from 892c905 to 8f3861b Compare August 28, 2026 21:32
@devin-ai-integration

Copy link
Copy Markdown
Contributor

Rebased onto main and pinned to the released SDK: launchdarkly-server-sdk >=9.17.0, which contains Config.with_wrapper_information. Tests pass against the published release (80 passed, mypy clean) and the "blocked until released" caveat is gone from the description.

@kinyoklion
kinyoklion marked this pull request as ready for review August 28, 2026 21:39
@kinyoklion
kinyoklion requested a review from a team as a code owner August 28, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devin-pr Pull request created by Devin AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant