flagdock 0.3.2__tar.gz → 0.3.3__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.
- {flagdock-0.3.2 → flagdock-0.3.3}/PKG-INFO +9 -6
- {flagdock-0.3.2 → flagdock-0.3.3}/README.md +8 -5
- {flagdock-0.3.2 → flagdock-0.3.3}/pyproject.toml +1 -1
- {flagdock-0.3.2 → flagdock-0.3.3}/src/flagdock/provider.py +1 -1
- {flagdock-0.3.2 → flagdock-0.3.3}/.gitignore +0 -0
- {flagdock-0.3.2 → flagdock-0.3.3}/LICENSE +0 -0
- {flagdock-0.3.2 → flagdock-0.3.3}/src/flagdock/__init__.py +0 -0
- {flagdock-0.3.2 → flagdock-0.3.3}/src/flagdock/_usage.py +0 -0
- {flagdock-0.3.2 → flagdock-0.3.3}/src/flagdock/engine.py +0 -0
- {flagdock-0.3.2 → flagdock-0.3.3}/src/flagdock/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: flagdock
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Flagdock feature flags for Python: an OpenFeature provider that downloads the rules once and evaluates in memory
|
|
5
5
|
Project-URL: Homepage, https://flagdock.com
|
|
6
6
|
Author-email: Flagdock <info@flagdock.com>
|
|
@@ -47,14 +47,16 @@ The only dependency is `openfeature-sdk`; HTTP uses the standard library. Python
|
|
|
47
47
|
from openfeature.evaluation_context import EvaluationContext
|
|
48
48
|
from flagdock import FlagdockProvider
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
provider = FlagdockProvider(os.environ["FLAGDOCK_KEY"], app_name="checkout-api")
|
|
51
|
+
api.set_provider_and_wait(provider)
|
|
51
52
|
flags = api.get_client()
|
|
52
53
|
|
|
53
54
|
if flags.get_boolean_value("new-checkout", False, EvaluationContext(user.id, {"plan": user.plan})):
|
|
54
55
|
... # the new code path
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
Call `api.shutdown()` when
|
|
58
|
+
`EvaluationContext(targeting_key, attributes)` says who is asking. Call `api.shutdown()` when
|
|
59
|
+
the process stops, so the last usage counts are sent.
|
|
58
60
|
|
|
59
61
|
Server keys can read your targeting rules, so keep them on the server.
|
|
60
62
|
|
|
@@ -71,7 +73,7 @@ Server keys can read your targeting rules, so keep them on the server.
|
|
|
71
73
|
| `start_timeout` | `10` | Seconds `initialize` waits for the first download. |
|
|
72
74
|
| `usage_interval` | `60` | Seconds between usage reports; `0` turns reporting off. |
|
|
73
75
|
| `stream` | `True` | Follow changes live; `False` only polls. |
|
|
74
|
-
| `url`, `fallback_urls` |
|
|
76
|
+
| `url`, `fallback_urls` | `https://edge.flagdock.com`, then `https://app.flagdock.com` | Where the rules come from. Leave them out unless you were given another address. |
|
|
75
77
|
|
|
76
78
|
Number flags can be read with `get_integer_value` (whole numbers only) or `get_float_value`, and
|
|
77
79
|
JSON flags with `get_object_value`. While Flagdock can't be reached, answers carry the reason
|
|
@@ -86,8 +88,9 @@ epoch milliseconds, `datetime` and `date` values.
|
|
|
86
88
|
rules). Put it in the page as JSON and pass it as `bootstrap` to `@flagdock/web` or
|
|
87
89
|
`@flagdock/react`, so the browser shows the right values in its first render.
|
|
88
90
|
- `provider.rotate_key(new_key)` switches keys without a restart.
|
|
89
|
-
- `
|
|
90
|
-
reports a goal event, which the console uses to compare the values of a flag
|
|
91
|
+
- `flags.track("order-completed", EvaluationContext(user.id), TrackingEventDetails(value=order.total))`
|
|
92
|
+
reports a goal event, which the console uses to compare the values of a flag
|
|
93
|
+
(`from openfeature.track import TrackingEventDetails`).
|
|
91
94
|
- The provider is thread safe; with forking servers (gunicorn, uWSGI) create it in each worker
|
|
92
95
|
after the fork.
|
|
93
96
|
|
|
@@ -28,14 +28,16 @@ The only dependency is `openfeature-sdk`; HTTP uses the standard library. Python
|
|
|
28
28
|
from openfeature.evaluation_context import EvaluationContext
|
|
29
29
|
from flagdock import FlagdockProvider
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
provider = FlagdockProvider(os.environ["FLAGDOCK_KEY"], app_name="checkout-api")
|
|
32
|
+
api.set_provider_and_wait(provider)
|
|
32
33
|
flags = api.get_client()
|
|
33
34
|
|
|
34
35
|
if flags.get_boolean_value("new-checkout", False, EvaluationContext(user.id, {"plan": user.plan})):
|
|
35
36
|
... # the new code path
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
Call `api.shutdown()` when
|
|
39
|
+
`EvaluationContext(targeting_key, attributes)` says who is asking. Call `api.shutdown()` when
|
|
40
|
+
the process stops, so the last usage counts are sent.
|
|
39
41
|
|
|
40
42
|
Server keys can read your targeting rules, so keep them on the server.
|
|
41
43
|
|
|
@@ -52,7 +54,7 @@ Server keys can read your targeting rules, so keep them on the server.
|
|
|
52
54
|
| `start_timeout` | `10` | Seconds `initialize` waits for the first download. |
|
|
53
55
|
| `usage_interval` | `60` | Seconds between usage reports; `0` turns reporting off. |
|
|
54
56
|
| `stream` | `True` | Follow changes live; `False` only polls. |
|
|
55
|
-
| `url`, `fallback_urls` |
|
|
57
|
+
| `url`, `fallback_urls` | `https://edge.flagdock.com`, then `https://app.flagdock.com` | Where the rules come from. Leave them out unless you were given another address. |
|
|
56
58
|
|
|
57
59
|
Number flags can be read with `get_integer_value` (whole numbers only) or `get_float_value`, and
|
|
58
60
|
JSON flags with `get_object_value`. While Flagdock can't be reached, answers carry the reason
|
|
@@ -67,8 +69,9 @@ epoch milliseconds, `datetime` and `date` values.
|
|
|
67
69
|
rules). Put it in the page as JSON and pass it as `bootstrap` to `@flagdock/web` or
|
|
68
70
|
`@flagdock/react`, so the browser shows the right values in its first render.
|
|
69
71
|
- `provider.rotate_key(new_key)` switches keys without a restart.
|
|
70
|
-
- `
|
|
71
|
-
reports a goal event, which the console uses to compare the values of a flag
|
|
72
|
+
- `flags.track("order-completed", EvaluationContext(user.id), TrackingEventDetails(value=order.total))`
|
|
73
|
+
reports a goal event, which the console uses to compare the values of a flag
|
|
74
|
+
(`from openfeature.track import TrackingEventDetails`).
|
|
72
75
|
- The provider is thread safe; with forking servers (gunicorn, uWSGI) create it in each worker
|
|
73
76
|
after the fork.
|
|
74
77
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "flagdock"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.3"
|
|
8
8
|
description = "Flagdock feature flags for Python: an OpenFeature provider that downloads the rules once and evaluates in memory"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|