openfeature-provider-flagd 0.1.5__tar.gz → 0.2.1__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.
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/.gitignore +3 -0
- openfeature_provider_flagd-0.2.1/CHANGELOG.md +126 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/LICENSE +1 -1
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/PKG-INFO +116 -15
- openfeature_provider_flagd-0.2.1/README.md +148 -0
- openfeature_provider_flagd-0.2.1/pyproject.toml +136 -0
- openfeature_provider_flagd-0.2.1/pytest.ini +22 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/config.py +250 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/src/openfeature/contrib/provider/flagd/provider.py +88 -12
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/resolvers/__init__.py +5 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/resolvers/grpc.py +357 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/src/openfeature/contrib/provider/flagd/resolvers/in_process.py +40 -31
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/resolvers/process/connector/__init__.py +11 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/resolvers/process/connector/file_watcher.py +107 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py +218 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/src/openfeature/contrib/provider/flagd/resolvers/process/custom_ops.py +58 -19
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/resolvers/process/flags.py +95 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/resolvers/process/targeting.py +35 -0
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/resolvers/__init__.py → openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/resolvers/protocol.py +2 -6
- openfeature_provider_flagd-0.2.1/src/openfeature/contrib/provider/flagd/sync_metadata_hook.py +14 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2.py +72 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2.pyi +450 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2_grpc.py +358 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2_grpc.pyi +155 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2.py +50 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2.pyi +148 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2_grpc.py +186 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2_grpc.pyi +86 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/schema/v1/schema_pb2.py +72 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/schema/v1/schema_pb2.pyi +451 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/schema/v1/schema_pb2_grpc.py +358 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/schema/v1/schema_pb2_grpc.pyi +156 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/sync/v1/sync_service_pb2.py +47 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/sync/v1/sync_service_pb2.pyi +174 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/sync/v1/sync_service_pb2_grpc.py +143 -0
- openfeature_provider_flagd-0.2.1/src/openfeature/schemas/protobuf/sync/v1/sync_service_pb2_grpc.pyi +70 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/conftest.py +6 -4
- openfeature_provider_flagd-0.2.1/tests/e2e/__init__.py +0 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/conftest.py +9 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/file/__init__.py +0 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/file/conftest.py +28 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/file/test_flaqd.py +5 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/flagd_container.py +82 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/inprocess/__init__.py +0 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/inprocess/conftest.py +19 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/inprocess/test_flaqd.py +5 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/parsers.py +7 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/paths.py +2 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/rpc/__init__.py +0 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/rpc/conftest.py +19 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/rpc/test_flaqd.py +5 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/step/_utils.py +30 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/step/config_steps.py +107 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/step/context_steps.py +73 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/step/event_steps.py +90 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/step/flag_step.py +96 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/step/provider_steps.py +141 -0
- openfeature_provider_flagd-0.2.1/tests/e2e/testfilter.py +125 -0
- openfeature_provider_flagd-0.2.1/tests/flags/invalid-fractional-args-wrong-content.json +16 -0
- openfeature_provider_flagd-0.2.1/tests/flags/invalid-fractional-weights-strings.json +19 -0
- openfeature_provider_flagd-0.2.1/tests/test_config.py +149 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/test_errors.py +36 -3
- openfeature_provider_flagd-0.2.1/tests/test_file_store.py +46 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/test_flagd.py +1 -1
- openfeature_provider_flagd-0.2.1/tests/test_targeting.py +262 -0
- openfeature_provider_flagd-0.1.5/CHANGELOG.md +0 -60
- openfeature_provider_flagd-0.1.5/README.md +0 -48
- openfeature_provider_flagd-0.1.5/pyproject.toml +0 -71
- openfeature_provider_flagd-0.1.5/scripts/gen_protos.sh +0 -10
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/config.py +0 -59
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2.py +0 -62
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2_grpc.py +0 -267
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2.py +0 -40
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2_grpc.py +0 -135
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2.py +0 -62
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2_grpc.py +0 -267
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2.py +0 -37
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2_grpc.py +0 -102
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/resolvers/grpc.py +0 -145
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/resolvers/process/file_watcher.py +0 -89
- openfeature_provider_flagd-0.1.5/src/openfeature/contrib/provider/flagd/resolvers/process/flags.py +0 -51
- openfeature_provider_flagd-0.1.5/test-harness/.gherkin-lintrc +0 -57
- openfeature_provider_flagd-0.1.5/test-harness/.git +0 -1
- openfeature_provider_flagd-0.1.5/test-harness/.github/workflows/ci.yml +0 -59
- openfeature_provider_flagd-0.1.5/test-harness/.github/workflows/lint-pr.yml +0 -42
- openfeature_provider_flagd-0.1.5/test-harness/.github/workflows/release-please.yml +0 -93
- openfeature_provider_flagd-0.1.5/test-harness/.release-please-manifest.json +0 -3
- openfeature_provider_flagd-0.1.5/test-harness/CHANGELOG.md +0 -210
- openfeature_provider_flagd-0.1.5/test-harness/Makefile +0 -6
- openfeature_provider_flagd-0.1.5/test-harness/README.md +0 -41
- openfeature_provider_flagd-0.1.5/test-harness/flagd/Dockerfile +0 -17
- openfeature_provider_flagd-0.1.5/test-harness/flagd/Dockerfile.unstable +0 -12
- openfeature_provider_flagd-0.1.5/test-harness/flags/changing-flag-bar.json +0 -12
- openfeature_provider_flagd-0.1.5/test-harness/flags/changing-flag-foo.json +0 -12
- openfeature_provider_flagd-0.1.5/test-harness/flags/custom-ops.json +0 -167
- openfeature_provider_flagd-0.1.5/test-harness/flags/edge-case-flags.json +0 -57
- openfeature_provider_flagd-0.1.5/test-harness/flags/evaluator-refs.json +0 -52
- openfeature_provider_flagd-0.1.5/test-harness/flags/testing-flags.json +0 -156
- openfeature_provider_flagd-0.1.5/test-harness/flags/zero-flags.json +0 -36
- openfeature_provider_flagd-0.1.5/test-harness/gherkin/flagd-json-evaluator.feature +0 -117
- openfeature_provider_flagd-0.1.5/test-harness/gherkin/flagd-reconnect.feature +0 -15
- openfeature_provider_flagd-0.1.5/test-harness/gherkin/flagd.feature +0 -36
- openfeature_provider_flagd-0.1.5/test-harness/package-lock.json +0 -682
- openfeature_provider_flagd-0.1.5/test-harness/package.json +0 -8
- openfeature_provider_flagd-0.1.5/test-harness/release-please-config.json +0 -11
- openfeature_provider_flagd-0.1.5/test-harness/renovate.json +0 -15
- openfeature_provider_flagd-0.1.5/test-harness/scripts/change-flag-wrapper.sh +0 -22
- openfeature_provider_flagd-0.1.5/test-harness/scripts/change-flag.sh +0 -15
- openfeature_provider_flagd-0.1.5/test-harness/scripts/restart-wrapper.sh +0 -31
- openfeature_provider_flagd-0.1.5/test-harness/sync/Dockerfile +0 -22
- openfeature_provider_flagd-0.1.5/test-harness/sync/Dockerfile.unstable +0 -17
- openfeature_provider_flagd-0.1.5/test-harness/sync/README.md +0 -91
- openfeature_provider_flagd-0.1.5/test-harness/sync/go.mod +0 -20
- openfeature_provider_flagd-0.1.5/test-harness/sync/go.sum +0 -1138
- openfeature_provider_flagd-0.1.5/test-harness/sync/main.go +0 -13
- openfeature_provider_flagd-0.1.5/test-harness/sync/pkg/config.go +0 -50
- openfeature_provider_flagd-0.1.5/test-harness/sync/pkg/file_watcher.go +0 -150
- openfeature_provider_flagd-0.1.5/test-harness/sync/pkg/server.go +0 -136
- openfeature_provider_flagd-0.1.5/tests/e2e/conftest.py +0 -208
- openfeature_provider_flagd-0.1.5/tests/e2e/parsers.py +0 -2
- openfeature_provider_flagd-0.1.5/tests/e2e/test_inprocess_custom_ops.py +0 -38
- openfeature_provider_flagd-0.1.5/tests/e2e/test_inprocess_edge_cases.py +0 -15
- openfeature_provider_flagd-0.1.5/tests/e2e/test_inprocess_evaluator_reuse.py +0 -13
- openfeature_provider_flagd-0.1.5/tests/e2e/test_inprocess_events.py +0 -91
- openfeature_provider_flagd-0.1.5/tests/e2e/test_inprocess_testing_flags.py +0 -24
- openfeature_provider_flagd-0.1.5/tests/e2e/test_inprocess_zero_evals.py +0 -28
- openfeature_provider_flagd-0.1.5/tests/test_config.py +0 -29
- openfeature_provider_flagd-0.1.5/tests/test_file_store.py +0 -33
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/src/openfeature/contrib/provider/flagd/__init__.py +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/src/openfeature/contrib/provider/flagd/flag_type.py +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/__init__.py +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-broken-default.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-broken-state.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-broken-targeting.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-broken-variants.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-disabled.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-invalid.not-json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-no-state.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-wrong-structure.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag-wrong-variant.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/basic-flag.yaml +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/invalid-fractional-args.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/invalid-fractional-weights.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/invalid-semver-args.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/invalid-semver-op.json +0 -0
- {openfeature_provider_flagd-0.1.5 → openfeature_provider_flagd-0.2.1}/tests/flags/invalid-stringcomp-args.json +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.1](https://github.com/open-feature/python-sdk-contrib/compare/openfeature-provider-flagd/v0.2.0...openfeature-provider-flagd/v0.2.1) (2025-03-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ✨ New Features
|
|
7
|
+
|
|
8
|
+
* **flagd:** Add features to customize auth to Sync API servers ([#203](https://github.com/open-feature/python-sdk-contrib/issues/203)) ([5151e94](https://github.com/open-feature/python-sdk-contrib/commit/5151e941d229101bdbcc5b40f570f69d77ddda7b))
|
|
9
|
+
* **flagd:** Context value hydration ([#195](https://github.com/open-feature/python-sdk-contrib/issues/195)) ([4fa619b](https://github.com/open-feature/python-sdk-contrib/commit/4fa619b93faf1d1f62a9ead99f33baa21c04e267))
|
|
10
|
+
|
|
11
|
+
## [0.2.0](https://github.com/open-feature/python-sdk-contrib/compare/openfeature-provider-flagd/v0.1.5...openfeature-provider-flagd/v0.2.0) (2025-02-18)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* drop Python 3.8 support ([#187](https://github.com/open-feature/python-sdk-contrib/issues/187))
|
|
17
|
+
* **flagd-rpc:** add events for rpc mode, some breaking config fixes ([#108](https://github.com/open-feature/python-sdk-contrib/issues/108))
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug Fixes
|
|
20
|
+
|
|
21
|
+
* **flagd:** fix semver version parsing to allow "v" prefix([#106](https://github.com/open-feature/python-sdk-contrib/issues/106)) ([#107](https://github.com/open-feature/python-sdk-contrib/issues/107)) ([93fee85](https://github.com/open-feature/python-sdk-contrib/commit/93fee8593c8c278dff6371b68b21366bea9d5f01))
|
|
22
|
+
* **flagd:** improve targeting and fix fractional issue([#92](https://github.com/open-feature/python-sdk-contrib/issues/92)) ([#105](https://github.com/open-feature/python-sdk-contrib/issues/105)) ([eb31b83](https://github.com/open-feature/python-sdk-contrib/commit/eb31b8324662df113cd27205eb12f09a1cf30b06))
|
|
23
|
+
* object resolution for RPC and Object types, add test-harness ([ca76802](https://github.com/open-feature/python-sdk-contrib/commit/ca7680242085fb9b77d9b0844147468544010074))
|
|
24
|
+
* object resolution for RPC and Object types, add test-harness. ([#103](https://github.com/open-feature/python-sdk-contrib/issues/103)) ([ca76802](https://github.com/open-feature/python-sdk-contrib/commit/ca7680242085fb9b77d9b0844147468544010074))
|
|
25
|
+
* remove modifications to license files ([#81](https://github.com/open-feature/python-sdk-contrib/issues/81)) ([a23f61e](https://github.com/open-feature/python-sdk-contrib/commit/a23f61e1c14c70e45a4bce4a014d5599813f1d28))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### ✨ New Features
|
|
29
|
+
|
|
30
|
+
* attempts with connection improvements ([#118](https://github.com/open-feature/python-sdk-contrib/issues/118)) ([8e23a70](https://github.com/open-feature/python-sdk-contrib/commit/8e23a700244a85291671b41083b1be82670cf79d))
|
|
31
|
+
* Change fractional custom op from percentage-based to relative weighting. ([#91](https://github.com/open-feature/python-sdk-contrib/issues/91)) ([7b34822](https://github.com/open-feature/python-sdk-contrib/commit/7b34822afdabfb89e991ae81a91681cafcbdfbd3))
|
|
32
|
+
* **flagd-rpc:** add caching ([#110](https://github.com/open-feature/python-sdk-contrib/issues/110)) ([16179e3](https://github.com/open-feature/python-sdk-contrib/commit/16179e3e68eb5bc18b5d12ec80caf511b7dec762))
|
|
33
|
+
* **flagd-rpc:** add events for rpc mode, some breaking config fixes ([#108](https://github.com/open-feature/python-sdk-contrib/issues/108)) ([b62d3d1](https://github.com/open-feature/python-sdk-contrib/commit/b62d3d1ab5ce40f275e795ae2682ae3fe315f431))
|
|
34
|
+
* **flagd-rpc:** adding grace attempts ([#117](https://github.com/open-feature/python-sdk-contrib/issues/117)) ([41d0ad8](https://github.com/open-feature/python-sdk-contrib/commit/41d0ad8b6a5b32272c75684cfcbabffb57e53470))
|
|
35
|
+
* **flagd:** add custom cert path ([#131](https://github.com/open-feature/python-sdk-contrib/issues/131)) ([f50351a](https://github.com/open-feature/python-sdk-contrib/commit/f50351a0435064111fb98753a49139fafa8307e6))
|
|
36
|
+
* **flagd:** Add in-process evaluator ([#104](https://github.com/open-feature/python-sdk-contrib/issues/104)) ([01285e7](https://github.com/open-feature/python-sdk-contrib/commit/01285e726baa3acbf1b5d6ed0e802be54342a6d9))
|
|
37
|
+
* **flagd:** add ssl cert path option ([f50351a](https://github.com/open-feature/python-sdk-contrib/commit/f50351a0435064111fb98753a49139fafa8307e6))
|
|
38
|
+
* **flagd:** migrate to new provider mode file and update e2e tests ([#121](https://github.com/open-feature/python-sdk-contrib/issues/121)) ([eed1ee0](https://github.com/open-feature/python-sdk-contrib/commit/eed1ee053191ecaca21f82749da9fe443712206f))
|
|
39
|
+
* **flagd:** use test-harness version number for integration tests ([#120](https://github.com/open-feature/python-sdk-contrib/issues/120)) ([3c3e9c8](https://github.com/open-feature/python-sdk-contrib/commit/3c3e9c86e7111fc165eebd650453069a0e8f4dae))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### 🧹 Chore
|
|
43
|
+
|
|
44
|
+
* **deps:** update dependency grpcio-health-checking to v1.68.1 ([#125](https://github.com/open-feature/python-sdk-contrib/issues/125)) ([4e75a36](https://github.com/open-feature/python-sdk-contrib/commit/4e75a366468ab0f588031587a7224d16ae6cd0c6))
|
|
45
|
+
* **deps:** update dependency grpcio-health-checking to v1.69.0 ([#147](https://github.com/open-feature/python-sdk-contrib/issues/147)) ([905b42b](https://github.com/open-feature/python-sdk-contrib/commit/905b42b6e654c86c9161f02d87a812ad4ac42bed))
|
|
46
|
+
* **deps:** update dependency grpcio-health-checking to v1.70.0 ([#168](https://github.com/open-feature/python-sdk-contrib/issues/168)) ([06a9b58](https://github.com/open-feature/python-sdk-contrib/commit/06a9b5880093680575422e3e16d14a81f2cd7bef))
|
|
47
|
+
* **deps:** update dependency providers/openfeature-provider-flagd/openfeature/test-harness to v0.5.21 ([#145](https://github.com/open-feature/python-sdk-contrib/issues/145)) ([1495263](https://github.com/open-feature/python-sdk-contrib/commit/149526337c5fd9948e10a1e3aab0176f2d1e7c8b))
|
|
48
|
+
* **deps:** update dependency providers/openfeature-provider-flagd/openfeature/test-harness to v2 ([#178](https://github.com/open-feature/python-sdk-contrib/issues/178)) ([ce16a54](https://github.com/open-feature/python-sdk-contrib/commit/ce16a5406e7e2d36fabe1ebe704f3a528e72027f))
|
|
49
|
+
* **deps:** update dependency providers/openfeature-provider-flagd/openfeature/test-harness to v2.2.0 ([#190](https://github.com/open-feature/python-sdk-contrib/issues/190)) ([9db9ad6](https://github.com/open-feature/python-sdk-contrib/commit/9db9ad62445deae3bb50505cb9d6a902d3234d34))
|
|
50
|
+
* **deps:** update pre-commit hook astral-sh/ruff-pre-commit to v0.9.0 ([#149](https://github.com/open-feature/python-sdk-contrib/issues/149)) ([24b11e1](https://github.com/open-feature/python-sdk-contrib/commit/24b11e14599251a47d70ee5b4080a326206f85a6))
|
|
51
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/schemas digest to 76d611f ([#138](https://github.com/open-feature/python-sdk-contrib/issues/138)) ([853ece7](https://github.com/open-feature/python-sdk-contrib/commit/853ece72feb558b208cad5680c358c4b09aabf91))
|
|
52
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/schemas digest to b81a56e ([#134](https://github.com/open-feature/python-sdk-contrib/issues/134)) ([a2a0ba0](https://github.com/open-feature/python-sdk-contrib/commit/a2a0ba0d9a59c763829fa630fdc2f28b93b2f037))
|
|
53
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to 54952f3 ([#188](https://github.com/open-feature/python-sdk-contrib/issues/188)) ([d88b29a](https://github.com/open-feature/python-sdk-contrib/commit/d88b29a01b14d411027007395e6de881602e91a1))
|
|
54
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to 5b07065 ([#171](https://github.com/open-feature/python-sdk-contrib/issues/171)) ([6f45c15](https://github.com/open-feature/python-sdk-contrib/commit/6f45c15b4da2a404cc0583fa3c4f8d22de13fad1))
|
|
55
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to 6c673d7 ([#151](https://github.com/open-feature/python-sdk-contrib/issues/151)) ([1c2c650](https://github.com/open-feature/python-sdk-contrib/commit/1c2c650bd7f0f5b5953bbb3948c3d657172e46ff))
|
|
56
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to 8d6eeb3 ([#177](https://github.com/open-feature/python-sdk-contrib/issues/177)) ([02dcfc0](https://github.com/open-feature/python-sdk-contrib/commit/02dcfc02089f3a0a3f300e3a2485e9f847ff765e))
|
|
57
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to 95fe981 ([#184](https://github.com/open-feature/python-sdk-contrib/issues/184)) ([f1fb247](https://github.com/open-feature/python-sdk-contrib/commit/f1fb2477f61a1a37ecfcbd858a80bdfac277340b))
|
|
58
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to a69f748 ([#193](https://github.com/open-feature/python-sdk-contrib/issues/193)) ([4251f36](https://github.com/open-feature/python-sdk-contrib/commit/4251f36d8ac1fbb70e44a87bea3b2755bcf09ecf))
|
|
59
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to be56f22 ([#186](https://github.com/open-feature/python-sdk-contrib/issues/186)) ([a15d5a2](https://github.com/open-feature/python-sdk-contrib/commit/a15d5a230e5a7d5a66a2cce4341f312bf98a3503))
|
|
60
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to d261f68 ([#140](https://github.com/open-feature/python-sdk-contrib/issues/140)) ([6801522](https://github.com/open-feature/python-sdk-contrib/commit/68015220ea9005286c0a45d4cdeb3891d9f43b3b))
|
|
61
|
+
* **deps:** update providers/openfeature-provider-flagd/openfeature/spec digest to ed0f9ef ([#135](https://github.com/open-feature/python-sdk-contrib/issues/135)) ([bee9205](https://github.com/open-feature/python-sdk-contrib/commit/bee9205d475473b5005fbbea9b4b5c756ad1d20e))
|
|
62
|
+
* drop Python 3.8 support ([#187](https://github.com/open-feature/python-sdk-contrib/issues/187)) ([b55cc1e](https://github.com/open-feature/python-sdk-contrib/commit/b55cc1e0f823d05a330c12af6861dbd3bec69c3a))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### 🔄 Refactoring
|
|
66
|
+
|
|
67
|
+
* replace typing_extensions import ([#98](https://github.com/open-feature/python-sdk-contrib/issues/98)) ([adb8a69](https://github.com/open-feature/python-sdk-contrib/commit/adb8a69d9ed1b0b03cb96d924b2269d973822794))
|
|
68
|
+
|
|
69
|
+
## [0.1.5](https://github.com/open-feature/python-sdk-contrib/compare/openfeature-provider-flagd/v0.1.4...openfeature-provider-flagd/v0.1.5) (2024-04-11)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### ✨ New Features
|
|
73
|
+
|
|
74
|
+
* in-process offline flagd resolver ([#74](https://github.com/open-feature/python-sdk-contrib/issues/74)) ([8cea506](https://github.com/open-feature/python-sdk-contrib/commit/8cea5066ee96f637f3108a9dc3a7539c450a14be))
|
|
75
|
+
|
|
76
|
+
## [0.1.4](https://github.com/open-feature/python-sdk-contrib/compare/openfeature-provider-flagd/v0.1.3...openfeature-provider-flagd/v0.1.4) (2024-03-26)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
### 🐛 Bug Fixes
|
|
80
|
+
|
|
81
|
+
* include targetingKey in flagd serialized evaluation context ([#58](https://github.com/open-feature/python-sdk-contrib/issues/58)) ([ddd79a4](https://github.com/open-feature/python-sdk-contrib/commit/ddd79a49b765aa0679a2c1938447c61b37b6d0fe))
|
|
82
|
+
* respect timeout setting in grpc method calls ([#60](https://github.com/open-feature/python-sdk-contrib/issues/60)) ([0149cf7](https://github.com/open-feature/python-sdk-contrib/commit/0149cf7ced8116f54a9b220549834a1970460bd9))
|
|
83
|
+
* return proper metadata object in FlagdProvider ([#59](https://github.com/open-feature/python-sdk-contrib/issues/59)) ([6508234](https://github.com/open-feature/python-sdk-contrib/commit/6508234486ba0b650e849cbee22505988233131a))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### ✨ New Features
|
|
87
|
+
|
|
88
|
+
* implement environment-variable based config ([#62](https://github.com/open-feature/python-sdk-contrib/issues/62)) ([a8b78b2](https://github.com/open-feature/python-sdk-contrib/commit/a8b78b28fe44ca712b00db04ac1a23a9c9bc6d9b))
|
|
89
|
+
* replace schema with tls argument in FlagdProvider constructor ([#61](https://github.com/open-feature/python-sdk-contrib/issues/61)) ([7a7210f](https://github.com/open-feature/python-sdk-contrib/commit/7a7210f6f63a9cba886f4d512c01ebac39d910a9))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
### 🧹 Chore
|
|
93
|
+
|
|
94
|
+
* exclude generated protobuf files from coverage report ([#51](https://github.com/open-feature/python-sdk-contrib/issues/51)) ([660a0cb](https://github.com/open-feature/python-sdk-contrib/commit/660a0cbc9bb932ac0dd9cb09f1d75177b161601b))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### 🔄 Refactoring
|
|
98
|
+
|
|
99
|
+
* add mypy and fix typing issues ([#72](https://github.com/open-feature/python-sdk-contrib/issues/72)) ([b405925](https://github.com/open-feature/python-sdk-contrib/commit/b4059255045cdb7054a35bc338207e23c42ce068))
|
|
100
|
+
|
|
101
|
+
## [0.1.3](https://github.com/open-feature/python-sdk-contrib/compare/openfeature-provider-flagd/v0.1.2...openfeature-provider-flagd/v0.1.3) (2024-02-23)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### 🐛 Bug Fixes
|
|
105
|
+
|
|
106
|
+
* include proto file in build for openfeature-provider-flagd ([#45](https://github.com/open-feature/python-sdk-contrib/issues/45)) ([7783cc8](https://github.com/open-feature/python-sdk-contrib/commit/7783cc8e7fb8fe0f9b812938efcd1f4c07e3ff68))
|
|
107
|
+
|
|
108
|
+
## [0.1.2](https://github.com/open-feature/python-sdk-contrib/compare/openfeature-provider-flagd-v0.1.1...openfeature-provider-flagd/v0.1.2) (2024-02-22)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### 🐛 Bug Fixes
|
|
112
|
+
|
|
113
|
+
* remove mention of local eval in readme ([41df80e](https://github.com/open-feature/python-sdk-contrib/commit/41df80e1b3044356e3b228a484f3a13c92068d91))
|
|
114
|
+
* remove setup from flagd tests ([#39](https://github.com/open-feature/python-sdk-contrib/issues/39)) ([85661ff](https://github.com/open-feature/python-sdk-contrib/commit/85661ff170b378d37b0a3d5d0a955dad3417f538))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### 🧹 Chore
|
|
118
|
+
|
|
119
|
+
* **main:** release providers/flagd 0.1.1 ([#40](https://github.com/open-feature/python-sdk-contrib/issues/40)) ([d42ee1e](https://github.com/open-feature/python-sdk-contrib/commit/d42ee1e531249e0023456dbe46db2f4f0c52a5c5))
|
|
120
|
+
|
|
121
|
+
## [0.1.1](https://github.com/open-feature/python-sdk-contrib/compare/providers/flagd-v0.1.0...providers/flagd/v0.1.1) (2024-02-22)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### 🐛 Bug Fixes
|
|
125
|
+
|
|
126
|
+
* remove setup from flagd tests ([#39](https://github.com/open-feature/python-sdk-contrib/issues/39)) ([85661ff](https://github.com/open-feature/python-sdk-contrib/commit/85661ff170b378d37b0a3d5d0a955dad3417f538))
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: openfeature-provider-flagd
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: OpenFeature provider for the flagd flag evaluation engine
|
|
5
5
|
Project-URL: Homepage, https://github.com/open-feature/python-sdk-contrib
|
|
6
6
|
Author-email: OpenFeature <openfeature-core@groups.io>
|
|
@@ -192,7 +192,7 @@ License: Apache License
|
|
|
192
192
|
same "printed page" as the copyright notice for easier
|
|
193
193
|
identification within third-party archives.
|
|
194
194
|
|
|
195
|
-
Copyright
|
|
195
|
+
Copyright [yyyy] [name of copyright owner]
|
|
196
196
|
|
|
197
197
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
198
198
|
you may not use this file except in compliance with the License.
|
|
@@ -209,19 +209,20 @@ License-File: LICENSE
|
|
|
209
209
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
210
210
|
Classifier: Programming Language :: Python
|
|
211
211
|
Classifier: Programming Language :: Python :: 3
|
|
212
|
-
Requires-Python: >=3.
|
|
213
|
-
Requires-Dist:
|
|
212
|
+
Requires-Python: >=3.9
|
|
213
|
+
Requires-Dist: cachebox
|
|
214
|
+
Requires-Dist: grpcio>=1.68.1
|
|
214
215
|
Requires-Dist: mmh3>=4.1.0
|
|
215
|
-
Requires-Dist: openfeature-sdk>=0.
|
|
216
|
+
Requires-Dist: openfeature-sdk>=0.6.0
|
|
216
217
|
Requires-Dist: panzi-json-logic>=1.0.1
|
|
217
|
-
Requires-Dist: protobuf>=4.
|
|
218
|
+
Requires-Dist: protobuf>=4.29.2
|
|
218
219
|
Requires-Dist: pyyaml>=6.0.1
|
|
219
220
|
Requires-Dist: semver<4,>=3
|
|
220
221
|
Description-Content-Type: text/markdown
|
|
221
222
|
|
|
222
223
|
# flagd Provider for OpenFeature
|
|
223
224
|
|
|
224
|
-
This provider is designed to use flagd's [evaluation protocol](https://github.com/open-feature/schemas/blob/main/protobuf/schema/v1/schema.proto).
|
|
225
|
+
This provider is designed to use flagd's [evaluation protocol](https://github.com/open-feature/schemas/blob/main/protobuf/schema/v1/schema.proto), or locally evaluate flags defined in a flagd [flag definition](https://github.com/open-feature/schemas/blob/main/json/flagd-definitions.json) via the OpenFeature Python SDK.
|
|
225
226
|
|
|
226
227
|
## Installation
|
|
227
228
|
|
|
@@ -231,6 +232,14 @@ pip install openfeature-provider-flagd
|
|
|
231
232
|
|
|
232
233
|
## Configuration and Usage
|
|
233
234
|
|
|
235
|
+
The flagd provider can operate in two modes: [RPC](#remote-resolver-rpc) (evaluation takes place in flagd, via gRPC calls) or [in-process](#in-process-resolver) (evaluation takes place in-process, with the provider getting a ruleset from a compliant sync-source).
|
|
236
|
+
|
|
237
|
+
### Remote resolver (RPC)
|
|
238
|
+
|
|
239
|
+
This is the default mode of operation of the provider.
|
|
240
|
+
In this mode, `FlagdProvider` communicates with [flagd](https://github.com/open-feature/flagd) via the gRPC protocol.
|
|
241
|
+
Flag evaluations take place remotely at the connected flagd instance.
|
|
242
|
+
|
|
234
243
|
Instantiate a new FlagdProvider instance and configure the OpenFeature SDK to use it:
|
|
235
244
|
|
|
236
245
|
```python
|
|
@@ -240,7 +249,11 @@ from openfeature.contrib.provider.flagd import FlagdProvider
|
|
|
240
249
|
api.set_provider(FlagdProvider())
|
|
241
250
|
```
|
|
242
251
|
|
|
243
|
-
|
|
252
|
+
### In-process resolver
|
|
253
|
+
|
|
254
|
+
This mode performs flag evaluations locally (in-process). Flag configurations for evaluation are obtained via gRPC protocol using [sync protobuf schema](https://buf.build/open-feature/flagd/file/main:sync/v1/sync_service.proto) service definition.
|
|
255
|
+
|
|
256
|
+
Consider the following example to create a `FlagdProvider` with in-process evaluations,
|
|
244
257
|
|
|
245
258
|
```python
|
|
246
259
|
from openfeature import api
|
|
@@ -249,20 +262,108 @@ from openfeature.contrib.provider.flagd.config import ResolverType
|
|
|
249
262
|
|
|
250
263
|
api.set_provider(FlagdProvider(
|
|
251
264
|
resolver_type=ResolverType.IN_PROCESS,
|
|
265
|
+
))
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
In the above example, in-process handlers attempt to connect to a sync service on address `localhost:8013` to obtain [flag definitions](https://github.com/open-feature/schemas/blob/main/json/flags.json).
|
|
269
|
+
|
|
270
|
+
<!--
|
|
271
|
+
#### Sync-metadata
|
|
272
|
+
|
|
273
|
+
To support the injection of contextual data configured in flagd for in-process evaluation, the provider exposes a `getSyncMetadata` accessor which provides the most recent value returned by the [GetMetadata RPC](https://buf.build/open-feature/flagd/docs/main:flagd.sync.v1#flagd.sync.v1.FlagSyncService.GetMetadata).
|
|
274
|
+
The value is updated with every (re)connection to the sync implementation.
|
|
275
|
+
This can be used to enrich evaluations with such data.
|
|
276
|
+
If the `in-process` mode is not used, and before the provider is ready, the `getSyncMetadata` returns an empty map.
|
|
277
|
+
-->
|
|
278
|
+
### File mode
|
|
279
|
+
|
|
280
|
+
In-process resolvers can also work in an offline mode.
|
|
281
|
+
To enable this mode, you should provide a valid flag configuration file with the option `offlineFlagSourcePath`.
|
|
282
|
+
|
|
283
|
+
```python
|
|
284
|
+
from openfeature import api
|
|
285
|
+
from openfeature.contrib.provider.flagd import FlagdProvider
|
|
286
|
+
from openfeature.contrib.provider.flagd.config import ResolverType
|
|
287
|
+
|
|
288
|
+
api.set_provider(FlagdProvider(
|
|
289
|
+
resolver_type=ResolverType.FILE,
|
|
252
290
|
offline_flag_source_path="my-flag.json",
|
|
253
291
|
))
|
|
254
292
|
```
|
|
255
293
|
|
|
294
|
+
Provider will attempt to detect file changes using polling.
|
|
295
|
+
Polling happens at 5 second intervals and this is currently unconfigurable.
|
|
296
|
+
This mode is useful for local development, tests and offline applications.
|
|
297
|
+
|
|
256
298
|
### Configuration options
|
|
257
299
|
|
|
258
300
|
The default options can be defined in the FlagdProvider constructor.
|
|
259
301
|
|
|
260
|
-
| Option name
|
|
261
|
-
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
|
|
|
265
|
-
|
|
|
302
|
+
| Option name | Environment variable name | Type & Values | Default | Compatible resolver |
|
|
303
|
+
|--------------------------|--------------------------------|----------------------------|-------------------------------|---------------------|
|
|
304
|
+
| resolver_type | FLAGD_RESOLVER | enum - `rpc`, `in-process` | rpc | |
|
|
305
|
+
| host | FLAGD_HOST | str | localhost | rpc & in-process |
|
|
306
|
+
| port | FLAGD_PORT | int | 8013 (rpc), 8015 (in-process) | rpc & in-process |
|
|
307
|
+
| tls | FLAGD_TLS | bool | false | rpc & in-process |
|
|
308
|
+
| cert_path | FLAGD_SERVER_CERT_PATH | String | null | rpc & in-process |
|
|
309
|
+
| deadline | FLAGD_DEADLINE_MS | int | 500 | rpc & in-process |
|
|
310
|
+
| stream_deadline_ms | FLAGD_STREAM_DEADLINE_MS | int | 600000 | rpc & in-process |
|
|
311
|
+
| keep_alive_time | FLAGD_KEEP_ALIVE_TIME_MS | int | 0 | rpc & in-process |
|
|
312
|
+
| selector | FLAGD_SOURCE_SELECTOR | str | null | in-process |
|
|
313
|
+
| cache_type | FLAGD_CACHE | enum - `lru`, `disabled` | lru | rpc |
|
|
314
|
+
| max_cache_size | FLAGD_MAX_CACHE_SIZE | int | 1000 | rpc |
|
|
315
|
+
| retry_backoff_ms | FLAGD_RETRY_BACKOFF_MS | int | 1000 | rpc |
|
|
316
|
+
| offline_flag_source_path | FLAGD_OFFLINE_FLAG_SOURCE_PATH | str | null | in-process |
|
|
317
|
+
|
|
318
|
+
<!-- not implemented
|
|
319
|
+
| target_uri | FLAGD_TARGET_URI | alternative to host/port, supporting custom name resolution | string | null | rpc & in-process |
|
|
320
|
+
| socket_path | FLAGD_SOCKET_PATH | alternative to host port, unix socket | String | null | rpc & in-process |
|
|
321
|
+
| context_enricher | - | sync-metadata to evaluation context mapping function | function | identity function | in-process |
|
|
322
|
+
| offline_pollIntervalMs | FLAGD_OFFLINE_POLL_MS | poll interval for reading offlineFlagSourcePath | int | 5000 | in-process |
|
|
323
|
+
-->
|
|
324
|
+
|
|
325
|
+
> [!NOTE]
|
|
326
|
+
> Some configurations are only applicable for RPC resolver.
|
|
327
|
+
|
|
328
|
+
<!--
|
|
329
|
+
### Unix socket support
|
|
330
|
+
Unix socket communication with flagd is facilitated by usaging of the linux-native `epoll` library on `linux-x86_64`
|
|
331
|
+
only (ARM support is pending the release of `netty-transport-native-epoll` v5).
|
|
332
|
+
Unix sockets are not supported on other platforms or architectures.
|
|
333
|
+
-->
|
|
334
|
+
|
|
335
|
+
### Reconnection
|
|
336
|
+
|
|
337
|
+
Reconnection is supported by the underlying gRPC connections.
|
|
338
|
+
If the connection to flagd is lost, it will reconnect automatically.
|
|
339
|
+
A failure to connect will result in an [error event](https://openfeature.dev/docs/reference/concepts/events#provider_error) from the provider, though it will attempt to reconnect indefinitely.
|
|
340
|
+
|
|
341
|
+
### Deadlines
|
|
342
|
+
|
|
343
|
+
Deadlines are used to define how long the provider waits to complete initialization or flag evaluations.
|
|
344
|
+
They behave differently based on the resolver type.
|
|
345
|
+
|
|
346
|
+
#### Deadlines with Remote resolver (RPC)
|
|
347
|
+
|
|
348
|
+
If the remote evaluation call is not completed within this deadline, the gRPC call is terminated with the error `DEADLINE_EXCEEDED`
|
|
349
|
+
and the evaluation will default.
|
|
350
|
+
|
|
351
|
+
### TLS
|
|
352
|
+
|
|
353
|
+
TLS is available in situations where flagd is running on another host.
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
You may optionally supply an X.509 certificate in PEM format. Otherwise, the default certificate store will be used.
|
|
357
|
+
|
|
358
|
+
```python
|
|
359
|
+
from openfeature import api
|
|
360
|
+
from openfeature.contrib.provider.flagd import FlagdProvider
|
|
361
|
+
|
|
362
|
+
api.set_provider(FlagdProvider(
|
|
363
|
+
tls=True, # use TLS
|
|
364
|
+
cert_path="etc/cert/ca.crt" # PEM cert
|
|
365
|
+
))
|
|
366
|
+
```
|
|
266
367
|
|
|
267
368
|
## License
|
|
268
369
|
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# flagd Provider for OpenFeature
|
|
2
|
+
|
|
3
|
+
This provider is designed to use flagd's [evaluation protocol](https://github.com/open-feature/schemas/blob/main/protobuf/schema/v1/schema.proto), or locally evaluate flags defined in a flagd [flag definition](https://github.com/open-feature/schemas/blob/main/json/flagd-definitions.json) via the OpenFeature Python SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pip install openfeature-provider-flagd
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration and Usage
|
|
12
|
+
|
|
13
|
+
The flagd provider can operate in two modes: [RPC](#remote-resolver-rpc) (evaluation takes place in flagd, via gRPC calls) or [in-process](#in-process-resolver) (evaluation takes place in-process, with the provider getting a ruleset from a compliant sync-source).
|
|
14
|
+
|
|
15
|
+
### Remote resolver (RPC)
|
|
16
|
+
|
|
17
|
+
This is the default mode of operation of the provider.
|
|
18
|
+
In this mode, `FlagdProvider` communicates with [flagd](https://github.com/open-feature/flagd) via the gRPC protocol.
|
|
19
|
+
Flag evaluations take place remotely at the connected flagd instance.
|
|
20
|
+
|
|
21
|
+
Instantiate a new FlagdProvider instance and configure the OpenFeature SDK to use it:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from openfeature import api
|
|
25
|
+
from openfeature.contrib.provider.flagd import FlagdProvider
|
|
26
|
+
|
|
27
|
+
api.set_provider(FlagdProvider())
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### In-process resolver
|
|
31
|
+
|
|
32
|
+
This mode performs flag evaluations locally (in-process). Flag configurations for evaluation are obtained via gRPC protocol using [sync protobuf schema](https://buf.build/open-feature/flagd/file/main:sync/v1/sync_service.proto) service definition.
|
|
33
|
+
|
|
34
|
+
Consider the following example to create a `FlagdProvider` with in-process evaluations,
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from openfeature import api
|
|
38
|
+
from openfeature.contrib.provider.flagd import FlagdProvider
|
|
39
|
+
from openfeature.contrib.provider.flagd.config import ResolverType
|
|
40
|
+
|
|
41
|
+
api.set_provider(FlagdProvider(
|
|
42
|
+
resolver_type=ResolverType.IN_PROCESS,
|
|
43
|
+
))
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
In the above example, in-process handlers attempt to connect to a sync service on address `localhost:8013` to obtain [flag definitions](https://github.com/open-feature/schemas/blob/main/json/flags.json).
|
|
47
|
+
|
|
48
|
+
<!--
|
|
49
|
+
#### Sync-metadata
|
|
50
|
+
|
|
51
|
+
To support the injection of contextual data configured in flagd for in-process evaluation, the provider exposes a `getSyncMetadata` accessor which provides the most recent value returned by the [GetMetadata RPC](https://buf.build/open-feature/flagd/docs/main:flagd.sync.v1#flagd.sync.v1.FlagSyncService.GetMetadata).
|
|
52
|
+
The value is updated with every (re)connection to the sync implementation.
|
|
53
|
+
This can be used to enrich evaluations with such data.
|
|
54
|
+
If the `in-process` mode is not used, and before the provider is ready, the `getSyncMetadata` returns an empty map.
|
|
55
|
+
-->
|
|
56
|
+
### File mode
|
|
57
|
+
|
|
58
|
+
In-process resolvers can also work in an offline mode.
|
|
59
|
+
To enable this mode, you should provide a valid flag configuration file with the option `offlineFlagSourcePath`.
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from openfeature import api
|
|
63
|
+
from openfeature.contrib.provider.flagd import FlagdProvider
|
|
64
|
+
from openfeature.contrib.provider.flagd.config import ResolverType
|
|
65
|
+
|
|
66
|
+
api.set_provider(FlagdProvider(
|
|
67
|
+
resolver_type=ResolverType.FILE,
|
|
68
|
+
offline_flag_source_path="my-flag.json",
|
|
69
|
+
))
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Provider will attempt to detect file changes using polling.
|
|
73
|
+
Polling happens at 5 second intervals and this is currently unconfigurable.
|
|
74
|
+
This mode is useful for local development, tests and offline applications.
|
|
75
|
+
|
|
76
|
+
### Configuration options
|
|
77
|
+
|
|
78
|
+
The default options can be defined in the FlagdProvider constructor.
|
|
79
|
+
|
|
80
|
+
| Option name | Environment variable name | Type & Values | Default | Compatible resolver |
|
|
81
|
+
|--------------------------|--------------------------------|----------------------------|-------------------------------|---------------------|
|
|
82
|
+
| resolver_type | FLAGD_RESOLVER | enum - `rpc`, `in-process` | rpc | |
|
|
83
|
+
| host | FLAGD_HOST | str | localhost | rpc & in-process |
|
|
84
|
+
| port | FLAGD_PORT | int | 8013 (rpc), 8015 (in-process) | rpc & in-process |
|
|
85
|
+
| tls | FLAGD_TLS | bool | false | rpc & in-process |
|
|
86
|
+
| cert_path | FLAGD_SERVER_CERT_PATH | String | null | rpc & in-process |
|
|
87
|
+
| deadline | FLAGD_DEADLINE_MS | int | 500 | rpc & in-process |
|
|
88
|
+
| stream_deadline_ms | FLAGD_STREAM_DEADLINE_MS | int | 600000 | rpc & in-process |
|
|
89
|
+
| keep_alive_time | FLAGD_KEEP_ALIVE_TIME_MS | int | 0 | rpc & in-process |
|
|
90
|
+
| selector | FLAGD_SOURCE_SELECTOR | str | null | in-process |
|
|
91
|
+
| cache_type | FLAGD_CACHE | enum - `lru`, `disabled` | lru | rpc |
|
|
92
|
+
| max_cache_size | FLAGD_MAX_CACHE_SIZE | int | 1000 | rpc |
|
|
93
|
+
| retry_backoff_ms | FLAGD_RETRY_BACKOFF_MS | int | 1000 | rpc |
|
|
94
|
+
| offline_flag_source_path | FLAGD_OFFLINE_FLAG_SOURCE_PATH | str | null | in-process |
|
|
95
|
+
|
|
96
|
+
<!-- not implemented
|
|
97
|
+
| target_uri | FLAGD_TARGET_URI | alternative to host/port, supporting custom name resolution | string | null | rpc & in-process |
|
|
98
|
+
| socket_path | FLAGD_SOCKET_PATH | alternative to host port, unix socket | String | null | rpc & in-process |
|
|
99
|
+
| context_enricher | - | sync-metadata to evaluation context mapping function | function | identity function | in-process |
|
|
100
|
+
| offline_pollIntervalMs | FLAGD_OFFLINE_POLL_MS | poll interval for reading offlineFlagSourcePath | int | 5000 | in-process |
|
|
101
|
+
-->
|
|
102
|
+
|
|
103
|
+
> [!NOTE]
|
|
104
|
+
> Some configurations are only applicable for RPC resolver.
|
|
105
|
+
|
|
106
|
+
<!--
|
|
107
|
+
### Unix socket support
|
|
108
|
+
Unix socket communication with flagd is facilitated by usaging of the linux-native `epoll` library on `linux-x86_64`
|
|
109
|
+
only (ARM support is pending the release of `netty-transport-native-epoll` v5).
|
|
110
|
+
Unix sockets are not supported on other platforms or architectures.
|
|
111
|
+
-->
|
|
112
|
+
|
|
113
|
+
### Reconnection
|
|
114
|
+
|
|
115
|
+
Reconnection is supported by the underlying gRPC connections.
|
|
116
|
+
If the connection to flagd is lost, it will reconnect automatically.
|
|
117
|
+
A failure to connect will result in an [error event](https://openfeature.dev/docs/reference/concepts/events#provider_error) from the provider, though it will attempt to reconnect indefinitely.
|
|
118
|
+
|
|
119
|
+
### Deadlines
|
|
120
|
+
|
|
121
|
+
Deadlines are used to define how long the provider waits to complete initialization or flag evaluations.
|
|
122
|
+
They behave differently based on the resolver type.
|
|
123
|
+
|
|
124
|
+
#### Deadlines with Remote resolver (RPC)
|
|
125
|
+
|
|
126
|
+
If the remote evaluation call is not completed within this deadline, the gRPC call is terminated with the error `DEADLINE_EXCEEDED`
|
|
127
|
+
and the evaluation will default.
|
|
128
|
+
|
|
129
|
+
### TLS
|
|
130
|
+
|
|
131
|
+
TLS is available in situations where flagd is running on another host.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
You may optionally supply an X.509 certificate in PEM format. Otherwise, the default certificate store will be used.
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from openfeature import api
|
|
138
|
+
from openfeature.contrib.provider.flagd import FlagdProvider
|
|
139
|
+
|
|
140
|
+
api.set_provider(FlagdProvider(
|
|
141
|
+
tls=True, # use TLS
|
|
142
|
+
cert_path="etc/cert/ca.crt" # PEM cert
|
|
143
|
+
))
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
Apache 2.0 - See [LICENSE](./LICENSE) for more information.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# pyproject.toml
|
|
2
|
+
[build-system]
|
|
3
|
+
requires = ["hatchling"]
|
|
4
|
+
build-backend = "hatchling.build"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "openfeature-provider-flagd"
|
|
8
|
+
version = "0.2.1"
|
|
9
|
+
description = "OpenFeature provider for the flagd flag evaluation engine"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
authors = [{ name = "OpenFeature", email = "openfeature-core@groups.io" }]
|
|
12
|
+
license = { file = "LICENSE" }
|
|
13
|
+
classifiers = [
|
|
14
|
+
"License :: OSI Approved :: Apache Software License",
|
|
15
|
+
"Programming Language :: Python",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
]
|
|
18
|
+
keywords = []
|
|
19
|
+
dependencies = [
|
|
20
|
+
"openfeature-sdk>=0.6.0",
|
|
21
|
+
"grpcio>=1.68.1",
|
|
22
|
+
"protobuf>=4.29.2",
|
|
23
|
+
"mmh3>=4.1.0",
|
|
24
|
+
"panzi-json-logic>=1.0.1",
|
|
25
|
+
"semver>=3,<4",
|
|
26
|
+
"pyyaml>=6.0.1",
|
|
27
|
+
"cachebox"
|
|
28
|
+
]
|
|
29
|
+
requires-python = ">=3.9"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/open-feature/python-sdk-contrib"
|
|
33
|
+
|
|
34
|
+
[tool.hatch]
|
|
35
|
+
|
|
36
|
+
[tool.hatch.envs.hatch-test]
|
|
37
|
+
dependencies = [
|
|
38
|
+
"coverage[toml]>=6.5",
|
|
39
|
+
"pytest",
|
|
40
|
+
"pytest-bdd",
|
|
41
|
+
"testcontainers",
|
|
42
|
+
"asserts",
|
|
43
|
+
"grpcio-health-checking==1.70.0",
|
|
44
|
+
]
|
|
45
|
+
pre-install-commands = [
|
|
46
|
+
"hatch build",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.hatch.envs.hatch-test.scripts]
|
|
50
|
+
run = "pytest {args:tests}"
|
|
51
|
+
run-cov = "coverage run -m pytest {args:tests}"
|
|
52
|
+
cov-combine = "coverage combine"
|
|
53
|
+
cov-report = [
|
|
54
|
+
"coverage xml",
|
|
55
|
+
"coverage html",
|
|
56
|
+
"coverage report",
|
|
57
|
+
]
|
|
58
|
+
cov = [
|
|
59
|
+
"test-cov",
|
|
60
|
+
"cov-report",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
[tool.hatch.envs.mypy]
|
|
65
|
+
dependencies = [
|
|
66
|
+
"mypy[faster-cache]>=1.13.0",
|
|
67
|
+
"types-protobuf",
|
|
68
|
+
"types-pyyaml",
|
|
69
|
+
]
|
|
70
|
+
pre-install-commands = [
|
|
71
|
+
"hatch build",
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
[tool.hatch.envs.mypy.scripts]
|
|
75
|
+
run = "mypy"
|
|
76
|
+
|
|
77
|
+
[tool.hatch.build.hooks.protobuf]
|
|
78
|
+
generate_pyi = false
|
|
79
|
+
dependencies = [
|
|
80
|
+
"hatch-protobuf",
|
|
81
|
+
"mypy-protobuf~=3.0",
|
|
82
|
+
]
|
|
83
|
+
proto_paths = [
|
|
84
|
+
".",
|
|
85
|
+
]
|
|
86
|
+
output_path = "src/"
|
|
87
|
+
|
|
88
|
+
[[tool.hatch.build.hooks.protobuf.generators]]
|
|
89
|
+
name = "mypy"
|
|
90
|
+
outputs = ["{proto_path}/{proto_name}_pb2.pyi"]
|
|
91
|
+
|
|
92
|
+
[[tool.hatch.build.hooks.protobuf.generators]]
|
|
93
|
+
name = "mypy_grpc"
|
|
94
|
+
outputs = ["{proto_path}/{proto_name}_pb2_grpc.pyi"]
|
|
95
|
+
|
|
96
|
+
[tool.hatch.build.targets.sdist]
|
|
97
|
+
exclude = [
|
|
98
|
+
".gitignore",
|
|
99
|
+
"/openfeature",
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
[tool.hatch.build.targets.wheel]
|
|
103
|
+
packages = ["src/openfeature"]
|
|
104
|
+
|
|
105
|
+
[tool.coverage.run]
|
|
106
|
+
omit = [
|
|
107
|
+
# exclude generated files
|
|
108
|
+
"src/openfeature/schemas/*",
|
|
109
|
+
"tests/**",
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
[tool.mypy]
|
|
113
|
+
mypy_path = "src"
|
|
114
|
+
files = "src"
|
|
115
|
+
|
|
116
|
+
python_version = "3.9" # should be identical to the minimum supported version
|
|
117
|
+
namespace_packages = true
|
|
118
|
+
explicit_package_bases = true
|
|
119
|
+
local_partial_types = true
|
|
120
|
+
pretty = true
|
|
121
|
+
|
|
122
|
+
strict = true
|
|
123
|
+
disallow_any_generics = false
|
|
124
|
+
|
|
125
|
+
[[tool.mypy.overrides]]
|
|
126
|
+
module = [
|
|
127
|
+
"grpc.*",
|
|
128
|
+
"json_logic.*",
|
|
129
|
+
]
|
|
130
|
+
ignore_missing_imports = true
|
|
131
|
+
|
|
132
|
+
[[tool.mypy.overrides]]
|
|
133
|
+
module = [
|
|
134
|
+
"openfeature.schemas.*"
|
|
135
|
+
]
|
|
136
|
+
warn_unused_ignores = false
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[pytest]
|
|
2
|
+
markers =
|
|
3
|
+
rpc: tests for rpc mode.
|
|
4
|
+
in-process: tests for in-process mode.
|
|
5
|
+
file: tests for file mode.
|
|
6
|
+
unavailable: tests for unavailable providers.
|
|
7
|
+
customCert: Supports custom certs.
|
|
8
|
+
unixsocket: Supports unixsockets.
|
|
9
|
+
targetURI: Supports targetURI.
|
|
10
|
+
grace: Supports grace attempts.
|
|
11
|
+
targeting: Supports targeting.
|
|
12
|
+
fractional: Supports fractional.
|
|
13
|
+
string: Supports string.
|
|
14
|
+
semver: Supports semver.
|
|
15
|
+
reconnect: Supports reconnect.
|
|
16
|
+
events: Supports events.
|
|
17
|
+
sync: Supports sync.
|
|
18
|
+
caching: Supports caching.
|
|
19
|
+
offline: Supports offline.
|
|
20
|
+
os.linux: linux mark.
|
|
21
|
+
stream: Supports streams.
|
|
22
|
+
bdd_features_base_dir = tests/features
|