FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Report provider name and version to LaunchDarkly by kinyoklion · Pull Request #51 · launchdarkly/openfeature-python-server · GitHub

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .json  (1) .py  (3) .toml  (1) All 3 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 5 additions & 1 deletion ld_openfeature/provider.py
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@

from ld_openfeature.impl.context_converter import EvaluationContextConverter
from ld_openfeature.impl.details_converter import ResolutionDetailsConverter
from ld_openfeature.version import VERSION


WRAPPER_NAME = "open-feature-python-server"


logger = getLogger("launchdarkly-openfeature-server")


class LaunchDarklyProvider(AbstractProvider):
def __init__(self, config: Config):
self.__client = LDClient(config)
self.__client = LDClient(config.with_wrapper_information(WRAPPER_NAME, VERSION))

self.__context_converter = EvaluationContextConverter()
self.__details_converter = ResolutionDetailsConverter()
Expand Down
1 change: 1 addition & 0 deletions ld_openfeature/version.py
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = "0.6.0" # x-release-please-version
2 changes: 1 addition & 1 deletion pyproject.toml
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ packages = [
[tool.poetry.dependencies]
python = "^3.10"
openfeature-sdk = ">=0.9.0,<1"
launchdarkly-server-sdk = "<10"
launchdarkly-server-sdk = ">=9.17.0,<10"


[tool.poetry.group.dev.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion release-please-config.json
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"release-type": "python",
"versioning": "default",
"include-v-in-tag": false,
"extra-files": ["docs/conf.py"],
"extra-files": ["docs/conf.py", "ld_openfeature/version.py"],
"include-component-in-tag": false
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/test_provider.py
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from openfeature import api

from ld_openfeature import LaunchDarklyProvider, Config
from ld_openfeature.version import VERSION
from tests.test_data_sources import FailingDataSource, InitializedThenFailingDataSource, StaleDataSource, UpdatingDataSource, DelayedFailingDataSource


Expand Down Expand Up @@ -49,6 +50,12 @@ def test_ldclient_is_accessible(provider: LaunchDarklyProvider):
assert type(provider.client) is LDClient


def test_provider_identifies_itself_as_the_wrapper(provider: LaunchDarklyProvider, config: Config):
assert provider.client._config.wrapper_name == "open-feature-python-server"
assert provider.client._config.wrapper_version == VERSION
assert config.wrapper_name is None


def test_not_providing_context_returns_error(provider: LaunchDarklyProvider):
resolution_details = provider.resolve_boolean_details("flag-key", True, None)

Expand Down
Loading

Back | FazBrowse Home | New Git URL