devcycle-python-server-sdk 3.9.0__tar.gz → 3.11.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/PKG-INFO +8 -7
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/README.md +20 -9
- devcycle_python_server_sdk-3.11.0/devcycle_python_sdk/VERSION.txt +1 -0
- devcycle_python_server_sdk-3.11.0/devcycle_python_sdk/bucketing-lib.release.wasm +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/cloud_client.py +7 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/devcycle_client.py +7 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/local_client.py +11 -2
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/models/event.py +1 -1
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/models/platform_data.py +2 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/models/user.py +5 -2
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/open_feature_provider/provider.py +26 -2
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_server_sdk.egg-info/PKG-INFO +8 -7
- devcycle_python_server_sdk-3.11.0/devcycle_python_server_sdk.egg-info/requires.txt +8 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/pyproject.toml +8 -11
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/setup.py +1 -0
- devcycle_python_server_sdk-3.9.0/devcycle_python_sdk/VERSION.txt +0 -1
- devcycle_python_server_sdk-3.9.0/devcycle_python_sdk/bucketing-lib.release.wasm +0 -0
- devcycle_python_server_sdk-3.9.0/devcycle_python_server_sdk.egg-info/requires.txt +0 -9
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/LICENSE +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/api/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/api/backoff.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/api/bucketing_client.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/api/config_client.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/api/event_client.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/api/local_bucketing.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/exceptions.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/managers/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/managers/config_manager.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/managers/event_queue_manager.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/managers/sse_manager.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/models/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/models/bucketed_config.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/models/error_response.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/models/feature.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/models/variable.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/open_feature_provider/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/options.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/protobuf/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/protobuf/utils.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/protobuf/variableForUserParams_pb2.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/protobuf/variableForUserParams_pb2.pyi +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/py.typed +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/util/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/util/strings.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/util/version.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_server_sdk.egg-info/SOURCES.txt +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_server_sdk.egg-info/dependency_links.txt +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_server_sdk.egg-info/top_level.txt +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/example/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/example/cloud_client_example.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/example/local_bucketing_client_example.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/example/openfeature_example.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/setup.cfg +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/api/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/api/test_bucketing_client.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/api/test_config_client.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/api/test_event_client.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/api/test_local_bucketing.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/fixture/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/fixture/data.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/managers/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/managers/test_config_manager.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/managers/test_event_queue_manager.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/models/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/models/test_bucketed_config.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/models/test_user.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/openfeature_test/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/openfeature_test/test_provider.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/openfeature_test/test_provider_local_sdk.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/test_cloud_client.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/test_local_client.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/util/__init__.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/util/test_strings.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/util/test_utils.py +0 -0
- {devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/util/test_version.py +0 -0
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: devcycle-python-server-sdk
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.11.0
|
|
4
4
|
Summary: DevCycle Python SDK
|
|
5
5
|
Home-page: https://github.com/devcycleHQ/python-server-sdk
|
|
6
6
|
Author-email:
|
|
7
7
|
Keywords: DevCycle
|
|
8
|
+
Requires-Python: >=3.9
|
|
8
9
|
License-File: LICENSE
|
|
9
10
|
Requires-Dist: setuptools>=21.0.0
|
|
10
11
|
Requires-Dist: urllib3>=1.15.1
|
|
11
|
-
Requires-Dist: requests
|
|
12
|
-
Requires-Dist: wasmtime
|
|
12
|
+
Requires-Dist: requests>=2.32
|
|
13
|
+
Requires-Dist: wasmtime~=30.0.0
|
|
13
14
|
Requires-Dist: protobuf>=4.23.3
|
|
14
|
-
Requires-Dist: openfeature-sdk>=0.
|
|
15
|
-
Requires-Dist: launchdarkly-eventsource>=1.2.
|
|
16
|
-
Requires-Dist: responses
|
|
17
|
-
Requires-Dist: dataclasses~=0.6
|
|
15
|
+
Requires-Dist: openfeature-sdk>=0.8.0
|
|
16
|
+
Requires-Dist: launchdarkly-eventsource>=1.2.1
|
|
17
|
+
Requires-Dist: responses>=0.23.1
|
|
18
18
|
Dynamic: description
|
|
19
19
|
Dynamic: home-page
|
|
20
20
|
Dynamic: keywords
|
|
21
21
|
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
22
23
|
Dynamic: summary
|
|
23
24
|
|
|
24
25
|
The DevCycle Python SDK used for feature management.
|
|
@@ -4,15 +4,16 @@ The DevCycle Python SDK used for feature management.
|
|
|
4
4
|
|
|
5
5
|
This SDK allows your application to interface with the [DevCycle Bucketing API](https://docs.devcycle.com/bucketing-api/#tag/devcycle).
|
|
6
6
|
|
|
7
|
-
## Requirements
|
|
7
|
+
## Requirements
|
|
8
8
|
|
|
9
|
-
* Python 3.
|
|
9
|
+
* Python 3.9+
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
14
|
pip install devcycle-python-server-sdk
|
|
15
15
|
```
|
|
16
|
+
|
|
16
17
|
(you may need to run `pip` with root permission: `sudo pip install devcycle-python-server-sdk`)
|
|
17
18
|
|
|
18
19
|
## Getting Started
|
|
@@ -65,38 +66,47 @@ When developing the SDK it is recommended that you have both a 3.8 and 3.12 pyth
|
|
|
65
66
|
### Dependencies
|
|
66
67
|
|
|
67
68
|
To set up dependencies for local development, run:
|
|
68
|
-
|
|
69
|
+
|
|
70
|
+
```bash
|
|
69
71
|
pip install -r requirements.test.txt
|
|
70
72
|
```
|
|
71
73
|
|
|
72
74
|
To run the example app against the local version of the API for testing and development, run:
|
|
73
|
-
|
|
75
|
+
|
|
76
|
+
```bash
|
|
74
77
|
pip install --editable .
|
|
75
78
|
```
|
|
76
|
-
from the top level of the repo (same level as setup.py). Then run the example app as normal.
|
|
77
79
|
|
|
80
|
+
from the top level of the repo (same level as setup.py). Then run the example app as normal:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python example/local_bucketing_client_example.py
|
|
84
|
+
```
|
|
78
85
|
|
|
79
86
|
### Linting & Formatting
|
|
80
87
|
|
|
81
88
|
Linting checks on PRs are run using [ruff](https://github.com/charliermarsh/ruff), and are configured using `.ruff.toml`. To run the linter locally, run this command from the top level of the repo:
|
|
82
|
-
|
|
89
|
+
|
|
90
|
+
```bash
|
|
83
91
|
ruff check .
|
|
84
92
|
```
|
|
85
93
|
|
|
86
94
|
Ruff can automatically fix simple linting errors (the ones marked with `[*]`). To do so, run:
|
|
87
|
-
|
|
95
|
+
|
|
96
|
+
```bash
|
|
88
97
|
ruff check . --fix
|
|
89
98
|
```
|
|
90
99
|
|
|
91
100
|
Formatting checks on PRs are done using [black](https://github.com/psf/black). To run the formatter locally, run this command from the top level of the repo:
|
|
92
101
|
|
|
93
|
-
```
|
|
102
|
+
```bash
|
|
94
103
|
black .
|
|
95
104
|
```
|
|
96
105
|
|
|
97
106
|
### Unit Tests
|
|
98
107
|
|
|
99
108
|
To run the unit tests, run:
|
|
109
|
+
|
|
100
110
|
```bash
|
|
101
111
|
pytest
|
|
102
112
|
```
|
|
@@ -104,6 +114,7 @@ pytest
|
|
|
104
114
|
### Benchmarks
|
|
105
115
|
|
|
106
116
|
To run the benchmarks, run:
|
|
117
|
+
|
|
107
118
|
```bash
|
|
108
119
|
pytest --benchmark-only
|
|
109
120
|
```
|
|
@@ -116,4 +127,4 @@ To generate the protobuf source files run the following from the root of the pro
|
|
|
116
127
|
protoc --proto_path=./protobuf/ --python_out=devcycle_python_sdk/protobuf --pyi_out=devcycle_python_sdk/protobuf variableForUserParams.proto
|
|
117
128
|
```
|
|
118
129
|
|
|
119
|
-
This will rebuild the `variableForUserParams_pb2.py` file. DO NOT edit this file directly.
|
|
130
|
+
This will rebuild the `variableForUserParams_pb2.py` file. DO NOT edit this file directly.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11.0
|
|
@@ -182,6 +182,13 @@ class DevCycleCloudClient(AbstractDevCycleClient):
|
|
|
182
182
|
except Exception as e:
|
|
183
183
|
logger.error(f"DevCycle: Error tracking event: {e}")
|
|
184
184
|
|
|
185
|
+
def close(self) -> None:
|
|
186
|
+
"""
|
|
187
|
+
Closes the client and releases any resources held by it.
|
|
188
|
+
"""
|
|
189
|
+
# Cloud client doesn't need to release any resources
|
|
190
|
+
logger.debug("DevCycle: Cloud client closed")
|
|
191
|
+
|
|
185
192
|
|
|
186
193
|
def _validate_sdk_key(sdk_key: str) -> None:
|
|
187
194
|
if sdk_key is None or len(sdk_key) == 0:
|
|
@@ -2,7 +2,7 @@ import json
|
|
|
2
2
|
import logging
|
|
3
3
|
import uuid
|
|
4
4
|
from numbers import Real
|
|
5
|
-
from typing import Any, Dict, Union
|
|
5
|
+
from typing import Any, Dict, Union, Optional
|
|
6
6
|
|
|
7
7
|
from devcycle_python_sdk import DevCycleLocalOptions, AbstractDevCycleClient
|
|
8
8
|
from devcycle_python_sdk.api.local_bucketing import LocalBucketing
|
|
@@ -50,12 +50,21 @@ class DevCycleLocalClient(AbstractDevCycleClient):
|
|
|
50
50
|
sdk_key, self.client_uuid, self.options, self.local_bucketing
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
-
self._openfeature_provider =
|
|
53
|
+
self._openfeature_provider: Optional[DevCycleProvider] = None
|
|
54
54
|
|
|
55
55
|
def get_sdk_platform(self) -> str:
|
|
56
56
|
return "Local"
|
|
57
57
|
|
|
58
58
|
def get_openfeature_provider(self) -> AbstractProvider:
|
|
59
|
+
if self._openfeature_provider is None:
|
|
60
|
+
self._openfeature_provider = DevCycleProvider(self)
|
|
61
|
+
|
|
62
|
+
# Update platform data for OpenFeature
|
|
63
|
+
self._platform_data.sdkPlatform = "python-of"
|
|
64
|
+
self.local_bucketing.set_platform_data(
|
|
65
|
+
json.dumps(self._platform_data.to_json())
|
|
66
|
+
)
|
|
67
|
+
|
|
59
68
|
return self._openfeature_provider
|
|
60
69
|
|
|
61
70
|
def is_initialized(self) -> bool:
|
|
@@ -18,7 +18,7 @@ class EventType:
|
|
|
18
18
|
class DevCycleEvent:
|
|
19
19
|
type: Optional[str] = None
|
|
20
20
|
target: Optional[str] = None
|
|
21
|
-
date: datetime = field(default_factory=lambda: datetime.
|
|
21
|
+
date: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
|
22
22
|
value: Optional[int] = None
|
|
23
23
|
metaData: Optional[Dict[str, str]] = None
|
|
24
24
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# ruff: noqa: N815
|
|
2
2
|
import platform
|
|
3
3
|
import socket
|
|
4
|
+
from typing import Optional
|
|
4
5
|
from dataclasses import dataclass
|
|
5
6
|
from devcycle_python_sdk.util.version import sdk_version
|
|
6
7
|
|
|
@@ -13,6 +14,7 @@ class PlatformData:
|
|
|
13
14
|
deviceModel: str
|
|
14
15
|
platform: str
|
|
15
16
|
hostname: str
|
|
17
|
+
sdkPlatform: Optional[str] = None
|
|
16
18
|
|
|
17
19
|
def to_json(self):
|
|
18
20
|
return {
|
|
@@ -16,7 +16,7 @@ class DevCycleUser:
|
|
|
16
16
|
appVersion: Optional[str] = None
|
|
17
17
|
appBuild: Optional[str] = None
|
|
18
18
|
customData: Optional[Dict[str, Any]] = None
|
|
19
|
-
createdDate: datetime = field(default_factory=lambda: datetime.
|
|
19
|
+
createdDate: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
|
20
20
|
privateCustomData: Optional[Dict[str, Any]] = None
|
|
21
21
|
lastSeenDate: Optional[datetime] = None
|
|
22
22
|
platform: Optional[str] = None
|
|
@@ -24,6 +24,7 @@ class DevCycleUser:
|
|
|
24
24
|
deviceModel: Optional[str] = None
|
|
25
25
|
sdkType: Optional[str] = None
|
|
26
26
|
sdkVersion: Optional[str] = None
|
|
27
|
+
sdkPlatform: Optional[str] = None
|
|
27
28
|
|
|
28
29
|
def to_json(self):
|
|
29
30
|
json_dict = {
|
|
@@ -50,7 +51,7 @@ class DevCycleUser:
|
|
|
50
51
|
data["createdDate"].replace("Z", "+00:00")
|
|
51
52
|
)
|
|
52
53
|
else:
|
|
53
|
-
created_date = datetime.
|
|
54
|
+
created_date = datetime.now(timezone.utc)
|
|
54
55
|
|
|
55
56
|
last_seen_date = None
|
|
56
57
|
if "lastSeenDate" in data:
|
|
@@ -75,6 +76,7 @@ class DevCycleUser:
|
|
|
75
76
|
deviceModel=data.get("deviceModel"),
|
|
76
77
|
sdkType=data.get("sdkType"),
|
|
77
78
|
sdkVersion=data.get("sdkVersion"),
|
|
79
|
+
sdkPlatform=data.get("sdkPlatform"),
|
|
78
80
|
)
|
|
79
81
|
|
|
80
82
|
@staticmethod
|
|
@@ -156,4 +158,5 @@ class DevCycleUser:
|
|
|
156
158
|
if private_custom_data:
|
|
157
159
|
user.privateCustomData = private_custom_data
|
|
158
160
|
|
|
161
|
+
user.sdkPlatform = "python-of"
|
|
159
162
|
return user
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import time
|
|
2
3
|
|
|
3
4
|
from typing import Any, Optional, Union, List
|
|
4
5
|
|
|
@@ -6,11 +7,16 @@ from devcycle_python_sdk import AbstractDevCycleClient
|
|
|
6
7
|
from devcycle_python_sdk.models.user import DevCycleUser
|
|
7
8
|
|
|
8
9
|
from openfeature.provider import AbstractProvider
|
|
10
|
+
from openfeature.provider.metadata import Metadata
|
|
9
11
|
from openfeature.evaluation_context import EvaluationContext
|
|
10
12
|
from openfeature.flag_evaluation import FlagResolutionDetails, Reason
|
|
11
|
-
from openfeature.exception import
|
|
13
|
+
from openfeature.exception import (
|
|
14
|
+
ErrorCode,
|
|
15
|
+
InvalidContextError,
|
|
16
|
+
TypeMismatchError,
|
|
17
|
+
GeneralError,
|
|
18
|
+
)
|
|
12
19
|
from openfeature.hook import Hook
|
|
13
|
-
from openfeature.provider.metadata import Metadata
|
|
14
20
|
|
|
15
21
|
logger = logging.getLogger(__name__)
|
|
16
22
|
|
|
@@ -26,6 +32,24 @@ class DevCycleProvider(AbstractProvider):
|
|
|
26
32
|
self.client = devcycle_client
|
|
27
33
|
self.meta_data = Metadata(name=f"DevCycle {self.client.get_sdk_platform()}")
|
|
28
34
|
|
|
35
|
+
def initialize(self, evaluation_context: EvaluationContext) -> None:
|
|
36
|
+
timeout = 2
|
|
37
|
+
start_time = time.time()
|
|
38
|
+
|
|
39
|
+
# Wait for the client to be initialized or timeout
|
|
40
|
+
while not self.client.is_initialized():
|
|
41
|
+
if time.time() - start_time > timeout:
|
|
42
|
+
raise GeneralError(
|
|
43
|
+
f"DevCycleProvider initialization timed out after {timeout} seconds"
|
|
44
|
+
)
|
|
45
|
+
time.sleep(0.1) # Sleep briefly to avoid busy waiting
|
|
46
|
+
|
|
47
|
+
if self.client.is_initialized():
|
|
48
|
+
logger.debug("DevCycleProvider initialized successfully")
|
|
49
|
+
|
|
50
|
+
def shutdown(self) -> None:
|
|
51
|
+
self.client.close()
|
|
52
|
+
|
|
29
53
|
def get_metadata(self) -> Metadata:
|
|
30
54
|
return self.meta_data
|
|
31
55
|
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: devcycle-python-server-sdk
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.11.0
|
|
4
4
|
Summary: DevCycle Python SDK
|
|
5
5
|
Home-page: https://github.com/devcycleHQ/python-server-sdk
|
|
6
6
|
Author-email:
|
|
7
7
|
Keywords: DevCycle
|
|
8
|
+
Requires-Python: >=3.9
|
|
8
9
|
License-File: LICENSE
|
|
9
10
|
Requires-Dist: setuptools>=21.0.0
|
|
10
11
|
Requires-Dist: urllib3>=1.15.1
|
|
11
|
-
Requires-Dist: requests
|
|
12
|
-
Requires-Dist: wasmtime
|
|
12
|
+
Requires-Dist: requests>=2.32
|
|
13
|
+
Requires-Dist: wasmtime~=30.0.0
|
|
13
14
|
Requires-Dist: protobuf>=4.23.3
|
|
14
|
-
Requires-Dist: openfeature-sdk>=0.
|
|
15
|
-
Requires-Dist: launchdarkly-eventsource>=1.2.
|
|
16
|
-
Requires-Dist: responses
|
|
17
|
-
Requires-Dist: dataclasses~=0.6
|
|
15
|
+
Requires-Dist: openfeature-sdk>=0.8.0
|
|
16
|
+
Requires-Dist: launchdarkly-eventsource>=1.2.1
|
|
17
|
+
Requires-Dist: responses>=0.23.1
|
|
18
18
|
Dynamic: description
|
|
19
19
|
Dynamic: home-page
|
|
20
20
|
Dynamic: keywords
|
|
21
21
|
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
22
23
|
Dynamic: summary
|
|
23
24
|
|
|
24
25
|
The DevCycle Python SDK used for feature management.
|
|
@@ -5,12 +5,12 @@ addopts = "--benchmark-skip --showlocals"
|
|
|
5
5
|
|
|
6
6
|
# black options
|
|
7
7
|
[tool.black]
|
|
8
|
-
target-version = ['
|
|
8
|
+
target-version = ['py39']
|
|
9
9
|
extend-exclude = '_pb2\.pyi?$'
|
|
10
10
|
|
|
11
11
|
# mypy options
|
|
12
12
|
[tool.mypy]
|
|
13
|
-
python_version = "3.
|
|
13
|
+
python_version = "3.9"
|
|
14
14
|
exclude = "django-app"
|
|
15
15
|
|
|
16
16
|
# See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker
|
|
@@ -43,20 +43,17 @@ ignore_missing_imports = true
|
|
|
43
43
|
[tool.ruff]
|
|
44
44
|
# https://beta.ruff.rs/docs/rules/
|
|
45
45
|
select = [
|
|
46
|
-
"F",
|
|
47
|
-
"E",
|
|
48
|
-
"W",
|
|
49
|
-
"N",
|
|
50
|
-
"T20",
|
|
46
|
+
"F", # PyFlakes
|
|
47
|
+
"E", # pycodestyle error
|
|
48
|
+
"W", # pycodestyle warning
|
|
49
|
+
"N", # pep8-naming
|
|
50
|
+
"T20", # flake8-print
|
|
51
51
|
"RUF100", # ensure noqa comments actually match an error
|
|
52
52
|
]
|
|
53
53
|
ignore = [
|
|
54
54
|
"E501", # line too long
|
|
55
55
|
]
|
|
56
|
-
exclude = [
|
|
57
|
-
"variableForUserParams_pb2.pyi"
|
|
58
|
-
]
|
|
56
|
+
exclude = ["variableForUserParams_pb2.pyi"]
|
|
59
57
|
[tool.ruff.per-file-ignores]
|
|
60
58
|
"__init__.py" = ["F401"]
|
|
61
59
|
"variableForUserParams_pb2.py" = ["F821", "N999", "E712"]
|
|
62
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.9.0
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/devcycle_python_sdk/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/api/test_event_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/fixture/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/managers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/models/test_user.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/test_cloud_client.py
RENAMED
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/test_local_client.py
RENAMED
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/util/__init__.py
RENAMED
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/util/test_strings.py
RENAMED
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/util/test_utils.py
RENAMED
|
File without changes
|
{devcycle_python_server_sdk-3.9.0 → devcycle_python_server_sdk-3.11.0}/test/util/test_version.py
RENAMED
|
File without changes
|