From 1eb6f4c6558f3dd20cb2389f9650a6476ca20fcb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:43:38 +0000 Subject: [PATCH 01/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.7.3 (#384) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 666f2852..9e04ef55 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.2 + rev: v0.7.3 hooks: - id: ruff args: [--fix] From 6cd570f64cb50473e0a046d5928e114157598d78 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:24:06 +0000 Subject: [PATCH 02/27] chore(deps): update codecov/codecov-action action to v5 (#386) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07b74547..572dcd12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.0 with: flags: unittests # optional name: coverage # optional From 3d77f2410751646380f58a77cad0fd5851da30b5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:15:19 +0000 Subject: [PATCH 03/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.7.4 (#387) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e04ef55..6258c8e4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.3 + rev: v0.7.4 hooks: - id: ruff args: [--fix] From e72e329a2acda0a0399ef2faa04c9b7f3b29bb65 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:19:38 +0000 Subject: [PATCH 04/27] chore(deps): update codecov/codecov-action action to v5.0.2 (#388) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 572dcd12..b045f349 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.0.0 + uses: codecov/codecov-action@v5.0.2 with: flags: unittests # optional name: coverage # optional From 3fb7cbc3ddcc9016ed51e890d9648f1f96284170 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:18:49 +0000 Subject: [PATCH 05/27] chore(deps): update codecov/codecov-action action to v5.0.3 (#390) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b045f349..8e1af8c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.0.2 + uses: codecov/codecov-action@v5.0.3 with: flags: unittests # optional name: coverage # optional From 9759bfaa21ed6d6e5e84c5559304db9a49b61884 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 05:11:05 +0000 Subject: [PATCH 06/27] chore(deps): update codecov/codecov-action action to v5.0.4 (#391) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e1af8c6..d4ba4f43 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.0.3 + uses: codecov/codecov-action@v5.0.4 with: flags: unittests # optional name: coverage # optional From a652004fde72cb1dcf730f146db36d686589b642 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 16:49:21 +0000 Subject: [PATCH 07/27] chore(deps): update codecov/codecov-action action to v5.0.5 (#392) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4ba4f43..45a2ca90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.0.4 + uses: codecov/codecov-action@v5.0.5 with: flags: unittests # optional name: coverage # optional From 24970b5d0915f533d88e4cd0fb54bea8cd28cab0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 23:17:46 +0000 Subject: [PATCH 08/27] chore(deps): update codecov/codecov-action action to v5.0.6 (#393) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45a2ca90..0dec1cdb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.0.5 + uses: codecov/codecov-action@v5.0.6 with: flags: unittests # optional name: coverage # optional From f024a6f3407b3e3ce8ea16a80982a7642c9f2f20 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 04:42:17 +0000 Subject: [PATCH 09/27] chore(deps): update codecov/codecov-action action to v5.0.7 (#394) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dec1cdb..a61b870c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.0.6 + uses: codecov/codecov-action@v5.0.7 with: flags: unittests # optional name: coverage # optional From 9b97130908c5ec07580d66e0f2aad9adf1607f53 Mon Sep 17 00:00:00 2001 From: Lukas Reining Date: Sun, 24 Nov 2024 17:54:42 +0100 Subject: [PATCH 10/27] feat: implement transaction context (#389) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: implement transaction context Signed-off-by: Lukas Reining * fix: lint issues Signed-off-by: Lukas Reining * feat: add tests for context merging Signed-off-by: Lukas Reining * feat: fix pre-commit checks Signed-off-by: Lukas Reining * feat: use elipsis instead of pass Signed-off-by: Lukas Reining * Update openfeature/transaction_context/no_op_transaction_context_propagator.py Co-authored-by: Anton GrΓΌbel Signed-off-by: Lukas Reining * feat: pr feedback Signed-off-by: Lukas Reining --------- Signed-off-by: Lukas Reining Co-authored-by: Anton GrΓΌbel --- README.md | 101 +++++++++- openfeature/api.py | 28 +++ openfeature/client.py | 3 +- openfeature/transaction_context/__init__.py | 11 ++ ...text_var_transaction_context_propagator.py | 18 ++ .../no_op_transaction_context_propagator.py | 12 ++ .../transaction_context_propagator.py | 11 ++ pyproject.toml | 1 + tests/test_client.py | 47 +++++ tests/test_transaction_context.py | 175 ++++++++++++++++++ 10 files changed, 396 insertions(+), 11 deletions(-) create mode 100644 openfeature/transaction_context/__init__.py create mode 100644 openfeature/transaction_context/context_var_transaction_context_propagator.py create mode 100644 openfeature/transaction_context/no_op_transaction_context_propagator.py create mode 100644 openfeature/transaction_context/transaction_context_propagator.py create mode 100644 tests/test_transaction_context.py diff --git a/README.md b/README.md index 909ee20e..7653bc0a 100644 --- a/README.md +++ b/README.md @@ -99,16 +99,17 @@ print("Value: " + str(flag_value)) ## 🌟 Features -| Status | Features | Description | -| ------ | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| βœ… | [Providers](#providers) | Integrate with a commercial, open source, or in-house feature management tool. | -| βœ… | [Targeting](#targeting) | Contextually-aware flag evaluation using [evaluation context](https://openfeature.dev/docs/reference/concepts/evaluation-context). | -| βœ… | [Hooks](#hooks) | Add functionality to various stages of the flag evaluation life-cycle. | -| βœ… | [Logging](#logging) | Integrate with popular logging packages. | -| βœ… | [Domains](#domains) | Logically bind clients with providers. | -| βœ… | [Eventing](#eventing) | React to state changes in the provider or flag management system. | -| βœ… | [Shutdown](#shutdown) | Gracefully clean up a provider during application shutdown. | -| βœ… | [Extending](#extending) | Extend OpenFeature with custom providers and hooks. | +| Status | Features | Description | +|--------|---------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| βœ… | [Providers](#providers) | Integrate with a commercial, open source, or in-house feature management tool. | +| βœ… | [Targeting](#targeting) | Contextually-aware flag evaluation using [evaluation context](https://openfeature.dev/docs/reference/concepts/evaluation-context). | +| βœ… | [Hooks](#hooks) | Add functionality to various stages of the flag evaluation life-cycle. | +| βœ… | [Logging](#logging) | Integrate with popular logging packages. | +| βœ… | [Domains](#domains) | Logically bind clients with providers. | +| βœ… | [Eventing](#eventing) | React to state changes in the provider or flag management system. | +| βœ… | [Shutdown](#shutdown) | Gracefully clean up a provider during application shutdown. | +| βœ… | [Transaction Context Propagation](#transaction-context-propagation) | Set a specific [evaluation context](/docs/reference/concepts/evaluation-context) for a transaction (e.g. an HTTP request or a thread) | +| βœ… | [Extending](#extending) | Extend OpenFeature with custom providers and hooks. | Implemented: βœ… | In-progress: ⚠️ | Not implemented yet: ❌ @@ -235,6 +236,86 @@ def on_provider_ready(event_details: EventDetails): client.add_handler(ProviderEvent.PROVIDER_READY, on_provider_ready) ``` +### Transaction Context Propagation + +Transaction context is a container for transaction-specific evaluation context (e.g. user id, user agent, IP). +Transaction context can be set where specific data is available (e.g. an auth service or request handler) and by using the transaction context propagator it will automatically be applied to all flag evaluations within a transaction (e.g. a request or thread). + +You can implement a different transaction context propagator by implementing the `TransactionContextPropagator` class exported by the OpenFeature SDK. +In most cases you can use `ContextVarsTransactionContextPropagator` as it works for `threads` and `asyncio` using [Context Variables](https://peps.python.org/pep-0567/). + +The following example shows a **multithreaded** Flask application using transaction context propagation to propagate the request ip and user id into request scoped transaction context. + +```python +from flask import Flask, request +from openfeature import api +from openfeature.evaluation_context import EvaluationContext +from openfeature.transaction_context import ContextVarsTransactionContextPropagator + +# Initialize the Flask app +app = Flask(__name__) + +# Set the transaction context propagator +api.set_transaction_context_propagator(ContextVarsTransactionContextPropagator()) + +# Middleware to set the transaction context +# You can call api.set_transaction_context anywhere you have information, +# you want to have available in the code-paths below the current one. +@app.before_request +def set_request_transaction_context(): + ip = request.headers.get("X-Forwarded-For", request.remote_addr) + user_id = request.headers.get("User-Id") # Assuming we're getting the user ID from a header + evaluation_context = EvaluationContext(targeting_key=user_id, attributes={"ipAddress": ip}) + api.set_transaction_context(evaluation_context) + +def create_response() -> str: + # This method can be anywhere in our code. + # The feature flag evaluation will automatically contain the transaction context merged with other context + new_response = api.get_client().get_string_value("response-message", "Hello User!") + return f"Message from server: {new_response}" + +# Example route where we use the transaction context +@app.route('/greeting') +def some_endpoint(): + return create_response() +``` + +This also works for asyncio based implementations e.g. FastApi as seen in the following example: + +```python +from fastapi import FastAPI, Request +from openfeature import api +from openfeature.evaluation_context import EvaluationContext +from openfeature.transaction_context import ContextVarsTransactionContextPropagator + +# Initialize the FastAPI app +app = FastAPI() + +# Set the transaction context propagator +api.set_transaction_context_propagator(ContextVarsTransactionContextPropagator()) + +# Middleware to set the transaction context +@app.middleware("http") +async def set_request_transaction_context(request: Request, call_next): + ip = request.headers.get("X-Forwarded-For", request.client.host) + user_id = request.headers.get("User-Id") # Assuming we're getting the user ID from a header + evaluation_context = EvaluationContext(targeting_key=user_id, attributes={"ipAddress": ip}) + api.set_transaction_context(evaluation_context) + response = await call_next(request) + return response + +def create_response() -> str: + # This method can be located anywhere in our code. + # The feature flag evaluation will automatically include the transaction context merged with other context. + new_response = api.get_client().get_string_value("response-message", "Hello User!") + return f"Message from server: {new_response}" + +# Example route where we use the transaction context +@app.get('/greeting') +async def some_endpoint(): + return create_response() +``` + ### Shutdown The OpenFeature API provides a shutdown function to perform a cleanup of all registered providers. This should only be called when your application is in the process of shutting down. diff --git a/openfeature/api.py b/openfeature/api.py index c95d10ac..c7d29c48 100644 --- a/openfeature/api.py +++ b/openfeature/api.py @@ -12,6 +12,10 @@ from openfeature.provider import FeatureProvider from openfeature.provider._registry import provider_registry from openfeature.provider.metadata import Metadata +from openfeature.transaction_context import TransactionContextPropagator +from openfeature.transaction_context.no_op_transaction_context_propagator import ( + NoOpTransactionContextPropagator, +) __all__ = [ "get_client", @@ -20,6 +24,9 @@ "get_provider_metadata", "get_evaluation_context", "set_evaluation_context", + "set_transaction_context_propagator", + "get_transaction_context", + "set_transaction_context", "add_hooks", "clear_hooks", "get_hooks", @@ -29,6 +36,9 @@ ] _evaluation_context = EvaluationContext() +_evaluation_transaction_context_propagator: TransactionContextPropagator = ( + NoOpTransactionContextPropagator() +) _hooks: typing.List[Hook] = [] @@ -68,6 +78,24 @@ def set_evaluation_context(evaluation_context: EvaluationContext) -> None: _evaluation_context = evaluation_context +def set_transaction_context_propagator( + transaction_context_propagator: TransactionContextPropagator, +) -> None: + global _evaluation_transaction_context_propagator + _evaluation_transaction_context_propagator = transaction_context_propagator + + +def get_transaction_context() -> EvaluationContext: + return _evaluation_transaction_context_propagator.get_transaction_context() + + +def set_transaction_context(evaluation_context: EvaluationContext) -> None: + global _evaluation_transaction_context_propagator + _evaluation_transaction_context_propagator.set_transaction_context( + evaluation_context + ) + + def add_hooks(hooks: typing.List[Hook]) -> None: global _hooks _hooks = _hooks + hooks diff --git a/openfeature/client.py b/openfeature/client.py index 9e4518ec..1edfca63 100644 --- a/openfeature/client.py +++ b/openfeature/client.py @@ -335,9 +335,10 @@ def evaluate_flag_details( # noqa: PLR0915 ) invocation_context = invocation_context.merge(ctx2=evaluation_context) - # Requirement 3.2.2 merge: API.context->client.context->invocation.context + # Requirement 3.2.2 merge: API.context->transaction.context->client.context->invocation.context merged_context = ( api.get_evaluation_context() + .merge(api.get_transaction_context()) .merge(self.context) .merge(invocation_context) ) diff --git a/openfeature/transaction_context/__init__.py b/openfeature/transaction_context/__init__.py new file mode 100644 index 00000000..e97fd36f --- /dev/null +++ b/openfeature/transaction_context/__init__.py @@ -0,0 +1,11 @@ +from openfeature.transaction_context.context_var_transaction_context_propagator import ( + ContextVarsTransactionContextPropagator, +) +from openfeature.transaction_context.transaction_context_propagator import ( + TransactionContextPropagator, +) + +__all__ = [ + "TransactionContextPropagator", + "ContextVarsTransactionContextPropagator", +] diff --git a/openfeature/transaction_context/context_var_transaction_context_propagator.py b/openfeature/transaction_context/context_var_transaction_context_propagator.py new file mode 100644 index 00000000..1abc04fa --- /dev/null +++ b/openfeature/transaction_context/context_var_transaction_context_propagator.py @@ -0,0 +1,18 @@ +from contextvars import ContextVar + +from openfeature.evaluation_context import EvaluationContext +from openfeature.transaction_context.transaction_context_propagator import ( + TransactionContextPropagator, +) + + +class ContextVarsTransactionContextPropagator(TransactionContextPropagator): + _transaction_context_var: ContextVar[EvaluationContext] = ContextVar( + "transaction_context", default=EvaluationContext() + ) + + def get_transaction_context(self) -> EvaluationContext: + return self._transaction_context_var.get() + + def set_transaction_context(self, transaction_context: EvaluationContext) -> None: + self._transaction_context_var.set(transaction_context) diff --git a/openfeature/transaction_context/no_op_transaction_context_propagator.py b/openfeature/transaction_context/no_op_transaction_context_propagator.py new file mode 100644 index 00000000..22a5a3f1 --- /dev/null +++ b/openfeature/transaction_context/no_op_transaction_context_propagator.py @@ -0,0 +1,12 @@ +from openfeature.evaluation_context import EvaluationContext +from openfeature.transaction_context.transaction_context_propagator import ( + TransactionContextPropagator, +) + + +class NoOpTransactionContextPropagator(TransactionContextPropagator): + def get_transaction_context(self) -> EvaluationContext: + return EvaluationContext() + + def set_transaction_context(self, transaction_context: EvaluationContext) -> None: + pass diff --git a/openfeature/transaction_context/transaction_context_propagator.py b/openfeature/transaction_context/transaction_context_propagator.py new file mode 100644 index 00000000..9a54367b --- /dev/null +++ b/openfeature/transaction_context/transaction_context_propagator.py @@ -0,0 +1,11 @@ +import typing + +from openfeature.evaluation_context import EvaluationContext + + +class TransactionContextPropagator(typing.Protocol): + def get_transaction_context(self) -> EvaluationContext: ... + + def set_transaction_context( + self, transaction_context: EvaluationContext + ) -> None: ... diff --git a/pyproject.toml b/pyproject.toml index 40887d9d..6d37bd88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ "behave", "coverage[toml]>=6.5", "pytest", + "pytest-asyncio" ] [tool.hatch.envs.default.scripts] diff --git a/tests/test_client.py b/tests/test_client.py index b51c460c..7f0ca461 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -5,8 +5,10 @@ import pytest +from openfeature import api from openfeature.api import add_hooks, clear_hooks, get_client, set_provider from openfeature.client import OpenFeatureClient +from openfeature.evaluation_context import EvaluationContext from openfeature.event import EventDetails, ProviderEvent, ProviderEventDetails from openfeature.exception import ErrorCode, OpenFeatureError from openfeature.flag_evaluation import FlagResolutionDetails, Reason @@ -14,6 +16,7 @@ from openfeature.provider import FeatureProvider, ProviderStatus from openfeature.provider.in_memory_provider import InMemoryFlag, InMemoryProvider from openfeature.provider.no_op_provider import NoOpProvider +from openfeature.transaction_context import ContextVarsTransactionContextPropagator @pytest.mark.parametrize( @@ -384,3 +387,47 @@ def emit_events_task(): f2 = executor.submit(emit_events_task) f1.result() f2.result() + + +def test_client_should_merge_contexts(): + api.clear_hooks() + api.set_transaction_context_propagator(ContextVarsTransactionContextPropagator()) + + provider = NoOpProvider() + provider.resolve_boolean_details = MagicMock(wraps=provider.resolve_boolean_details) + api.set_provider(provider) + + # Global evaluation context + global_context = EvaluationContext( + targeting_key="global", attributes={"global_attr": "global_value"} + ) + api.set_evaluation_context(global_context) + + # Transaction context + transaction_context = EvaluationContext( + targeting_key="transaction", + attributes={"transaction_attr": "transaction_value"}, + ) + api.set_transaction_context(transaction_context) + + # Client-specific context + client_context = EvaluationContext( + targeting_key="client", attributes={"client_attr": "client_value"} + ) + client = OpenFeatureClient(domain=None, version=None, context=client_context) + + # Invocation-specific context + invocation_context = EvaluationContext( + targeting_key="invocation", attributes={"invocation_attr": "invocation_value"} + ) + client.get_boolean_details("flag", False, invocation_context) + + # Retrieve the call arguments + args, kwargs = provider.resolve_boolean_details.call_args + flag_key, default_value, context = args + + assert context.targeting_key == "invocation" # Last one in the merge chain + assert context.attributes["global_attr"] == "global_value" + assert context.attributes["transaction_attr"] == "transaction_value" + assert context.attributes["client_attr"] == "client_value" + assert context.attributes["invocation_attr"] == "invocation_value" diff --git a/tests/test_transaction_context.py b/tests/test_transaction_context.py new file mode 100644 index 00000000..1da57c28 --- /dev/null +++ b/tests/test_transaction_context.py @@ -0,0 +1,175 @@ +import asyncio +import threading +from unittest.mock import MagicMock + +import pytest + +from openfeature.api import ( + get_transaction_context, + set_transaction_context, + set_transaction_context_propagator, +) +from openfeature.evaluation_context import EvaluationContext +from openfeature.transaction_context import ( + ContextVarsTransactionContextPropagator, + TransactionContextPropagator, +) +from openfeature.transaction_context.no_op_transaction_context_propagator import ( + NoOpTransactionContextPropagator, +) + + +# Test cases +def test_should_return_default_evaluation_context_with_noop_propagator(): + # Given + set_transaction_context_propagator(NoOpTransactionContextPropagator()) + + # When + context = get_transaction_context() + + # Then + assert isinstance(context, EvaluationContext) + assert context.attributes == {} + + +def test_should_set_and_get_custom_transaction_context(): + # Given + set_transaction_context_propagator(ContextVarsTransactionContextPropagator()) + evaluation_context = EvaluationContext("custom_key", {"attr1": "val1"}) + + # When + set_transaction_context(evaluation_context) + + # Then + context = get_transaction_context() + assert context.targeting_key == "custom_key" + assert context.attributes == {"attr1": "val1"} + + +def test_should_override_propagator_and_reset_context(): + # Given + custom_propagator = MagicMock(spec=TransactionContextPropagator) + default_context = EvaluationContext() + + set_transaction_context_propagator(custom_propagator) + + # When + set_transaction_context_propagator(NoOpTransactionContextPropagator()) + + # Then + assert get_transaction_context() == default_context + + +def test_should_call_set_transaction_context_on_propagator(): + # Given + custom_propagator = MagicMock(spec=TransactionContextPropagator) + evaluation_context = EvaluationContext("custom_key", {"attr1": "val1"}) + set_transaction_context_propagator(custom_propagator) + + # When + set_transaction_context(evaluation_context) + + # Then + custom_propagator.set_transaction_context.assert_called_with(evaluation_context) + + +def test_should_return_default_context_with_noop_propagator_set(): + # Given + noop_propagator = NoOpTransactionContextPropagator() + + set_transaction_context_propagator(noop_propagator) + + # When + context = get_transaction_context() + + # Then + assert context == EvaluationContext() + + +def test_should_propagate_event_when_context_set(): + # Given + custom_propagator = ContextVarsTransactionContextPropagator() + set_transaction_context_propagator(custom_propagator) + evaluation_context = EvaluationContext("custom_key", {"attr1": "val1"}) + + # When + set_transaction_context(evaluation_context) + + # Then + assert ( + custom_propagator._transaction_context_var.get().targeting_key == "custom_key" + ) + assert custom_propagator._transaction_context_var.get().attributes == { + "attr1": "val1" + } + + +def test_context_vars_transaction_context_propagator_multiple_threads(): + # Given + context_var_propagator = ContextVarsTransactionContextPropagator() + set_transaction_context_propagator(context_var_propagator) + + number_of_threads = 3 + barrier = threading.Barrier(number_of_threads) + + def thread_func(context_value, result_list, index): + context = EvaluationContext( + f"context_{context_value}", {"thread": context_value} + ) + set_transaction_context(context) + barrier.wait() + result_list[index] = get_transaction_context() + + results = [None] * number_of_threads + threads = [] + + # When + for i in range(3): + thread = threading.Thread(target=thread_func, args=(i, results, i)) + threads.append(thread) + thread.start() + + for thread in threads: + thread.join() + + # Then + for i in range(3): + assert results[i].targeting_key == f"context_{i}" + assert results[i].attributes == {"thread": i} + + +@pytest.mark.asyncio +async def test_context_vars_transaction_context_propagator_asyncio(): + # Given + context_var_propagator = ContextVarsTransactionContextPropagator() + set_transaction_context_propagator(context_var_propagator) + + number_of_tasks = 3 + event = asyncio.Event() + ready_count = 0 + + async def async_func(context_value, results, index): + nonlocal ready_count + context = EvaluationContext( + f"context_{context_value}", {"async": context_value} + ) + set_transaction_context(context) + + ready_count += 1 # Increment the ready count + if ready_count == number_of_tasks: + event.set() # Set the event when all tasks are ready + + await event.wait() # Wait for the event to be set + results[index] = get_transaction_context() + + # Placeholder for results + results = [None] * number_of_tasks + + # When + tasks = [async_func(i, results, i) for i in range(number_of_tasks)] + await asyncio.gather(*tasks) + + # Then + for i in range(number_of_tasks): + assert results[i].targeting_key == f"context_{i}" + assert results[i].attributes == {"async": i} From 398dcb04a0cdbc4935c1978451fb478f0dad0c77 Mon Sep 17 00:00:00 2001 From: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com> Date: Mon, 25 Nov 2024 03:39:03 -0500 Subject: [PATCH 11/27] chore(main): release 0.7.3 (#382) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ README.md | 8 ++++---- openfeature/version.py | 2 +- pyproject.toml | 2 +- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 00c7bc2e..449ac20d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{".":"0.7.2"} \ No newline at end of file +{".":"0.7.3"} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 785f284d..bb1297ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [0.7.3](https://github.com/open-feature/python-sdk/compare/v0.7.2...v0.7.3) (2024-11-24) + + +### ✨ New Features + +* implement transaction context ([#389](https://github.com/open-feature/python-sdk/issues/389)) ([9b97130](https://github.com/open-feature/python-sdk/commit/9b97130908c5ec07580d66e0f2aad9adf1607f53)) + + +### 🧹 Chore + +* **deps:** update codecov/codecov-action action to v5 ([#386](https://github.com/open-feature/python-sdk/issues/386)) ([6cd570f](https://github.com/open-feature/python-sdk/commit/6cd570f64cb50473e0a046d5928e114157598d78)) +* **deps:** update codecov/codecov-action action to v5.0.2 ([#388](https://github.com/open-feature/python-sdk/issues/388)) ([e72e329](https://github.com/open-feature/python-sdk/commit/e72e329a2acda0a0399ef2faa04c9b7f3b29bb65)) +* **deps:** update codecov/codecov-action action to v5.0.3 ([#390](https://github.com/open-feature/python-sdk/issues/390)) ([3fb7cbc](https://github.com/open-feature/python-sdk/commit/3fb7cbc3ddcc9016ed51e890d9648f1f96284170)) +* **deps:** update codecov/codecov-action action to v5.0.4 ([#391](https://github.com/open-feature/python-sdk/issues/391)) ([9759bfa](https://github.com/open-feature/python-sdk/commit/9759bfaa21ed6d6e5e84c5559304db9a49b61884)) +* **deps:** update codecov/codecov-action action to v5.0.5 ([#392](https://github.com/open-feature/python-sdk/issues/392)) ([a652004](https://github.com/open-feature/python-sdk/commit/a652004fde72cb1dcf730f146db36d686589b642)) +* **deps:** update codecov/codecov-action action to v5.0.6 ([#393](https://github.com/open-feature/python-sdk/issues/393)) ([24970b5](https://github.com/open-feature/python-sdk/commit/24970b5d0915f533d88e4cd0fb54bea8cd28cab0)) +* **deps:** update codecov/codecov-action action to v5.0.7 ([#394](https://github.com/open-feature/python-sdk/issues/394)) ([f024a6f](https://github.com/open-feature/python-sdk/commit/f024a6f3407b3e3ce8ea16a80982a7642c9f2f20)) +* **deps:** update pre-commit hook astral-sh/ruff-pre-commit to v0.7.2 ([#381](https://github.com/open-feature/python-sdk/issues/381)) ([2d8fadf](https://github.com/open-feature/python-sdk/commit/2d8fadf40afb98e2915b645278358fca367447d7)) +* **deps:** update pre-commit hook astral-sh/ruff-pre-commit to v0.7.3 ([#384](https://github.com/open-feature/python-sdk/issues/384)) ([1eb6f4c](https://github.com/open-feature/python-sdk/commit/1eb6f4c6558f3dd20cb2389f9650a6476ca20fcb)) +* **deps:** update pre-commit hook astral-sh/ruff-pre-commit to v0.7.4 ([#387](https://github.com/open-feature/python-sdk/issues/387)) ([3d77f24](https://github.com/open-feature/python-sdk/commit/3d77f2410751646380f58a77cad0fd5851da30b5)) + ## [0.7.2](https://github.com/open-feature/python-sdk/compare/v0.7.1...v0.7.2) (2024-10-24) diff --git a/README.md b/README.md index 7653bc0a..689706a9 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ - - Latest version + + Latest version @@ -60,13 +60,13 @@ #### Pip install ```bash -pip install openfeature-sdk==0.7.2 +pip install openfeature-sdk==0.7.3 ``` #### requirements.txt ```bash -openfeature-sdk==0.7.2 +openfeature-sdk==0.7.3 ``` ```python diff --git a/openfeature/version.py b/openfeature/version.py index bc8c296f..4910b9ec 100644 --- a/openfeature/version.py +++ b/openfeature/version.py @@ -1 +1 @@ -__version__ = "0.7.2" +__version__ = "0.7.3" diff --git a/pyproject.toml b/pyproject.toml index 6d37bd88..49b667f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "openfeature_sdk" -version = "0.7.2" +version = "0.7.3" description = "Standardizing Feature Flagging for Everyone" readme = "README.md" authors = [{ name = "OpenFeature", email = "openfeature-core@groups.io" }] From 70acd1dd42ee1257a91b8fe23a50ae42e7cf7698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Gr=C3=BCbel?= Date: Mon, 25 Nov 2024 10:02:32 +0100 Subject: [PATCH 12/27] build: pin pypi release GHA to v1.11 (#396) pin pypi release GHA to v1.11 Signed-off-by: gruebel --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 51720d14..2ceec4eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,4 +54,5 @@ jobs: run: hatch build - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + # pinning till fixed https://github.com/pypa/gh-action-pypi-publish/issues/300 + uses: pypa/gh-action-pypi-publish@release/v1.11 From cd737a9a6aeb6ff64050f759749aab96e73a8c34 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 09:26:52 +0000 Subject: [PATCH 13/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.8.0 (#395) * chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.8.0 * fix ruff issues Signed-off-by: gruebel --------- Signed-off-by: gruebel Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: gruebel --- .pre-commit-config.yaml | 2 +- openfeature/api.py | 20 +++++++++---------- openfeature/event.py | 2 +- openfeature/exception.py | 12 +++++------ openfeature/flag_evaluation.py | 6 +++--- openfeature/hook/__init__.py | 2 +- openfeature/provider/__init__.py | 2 +- openfeature/transaction_context/__init__.py | 2 +- ...text_var_transaction_context_propagator.py | 12 ++++++++--- 9 files changed, 33 insertions(+), 27 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6258c8e4..c2b32957 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.4 + rev: v0.8.0 hooks: - id: ruff args: [--fix] diff --git a/openfeature/api.py b/openfeature/api.py index c7d29c48..4460b695 100644 --- a/openfeature/api.py +++ b/openfeature/api.py @@ -18,21 +18,21 @@ ) __all__ = [ - "get_client", - "set_provider", + "add_handler", + "add_hooks", + "clear_hooks", "clear_providers", - "get_provider_metadata", + "get_client", "get_evaluation_context", - "set_evaluation_context", - "set_transaction_context_propagator", + "get_hooks", + "get_provider_metadata", "get_transaction_context", + "remove_handler", + "set_evaluation_context", + "set_provider", "set_transaction_context", - "add_hooks", - "clear_hooks", - "get_hooks", + "set_transaction_context_propagator", "shutdown", - "add_handler", - "remove_handler", ] _evaluation_context = EvaluationContext() diff --git a/openfeature/event.py b/openfeature/event.py index e41a3704..23210771 100644 --- a/openfeature/event.py +++ b/openfeature/event.py @@ -6,7 +6,7 @@ from openfeature.exception import ErrorCode -__all__ = ["ProviderEvent", "ProviderEventDetails", "EventDetails", "EventHandler"] +__all__ = ["EventDetails", "EventHandler", "ProviderEvent", "ProviderEventDetails"] class ProviderEvent(Enum): diff --git a/openfeature/exception.py b/openfeature/exception.py index 3ae54a56..0576ec17 100644 --- a/openfeature/exception.py +++ b/openfeature/exception.py @@ -5,16 +5,16 @@ from enum import Enum __all__ = [ - "OpenFeatureError", - "ProviderNotReadyError", - "ProviderFatalError", + "ErrorCode", "FlagNotFoundError", "GeneralError", + "InvalidContextError", + "OpenFeatureError", "ParseError", - "TypeMismatchError", + "ProviderFatalError", + "ProviderNotReadyError", "TargetingKeyMissingError", - "InvalidContextError", - "ErrorCode", + "TypeMismatchError", ] diff --git a/openfeature/flag_evaluation.py b/openfeature/flag_evaluation.py index db9cea1b..1f83fd1b 100644 --- a/openfeature/flag_evaluation.py +++ b/openfeature/flag_evaluation.py @@ -12,12 +12,12 @@ __all__ = [ - "FlagType", - "Reason", - "FlagMetadata", "FlagEvaluationDetails", "FlagEvaluationOptions", + "FlagMetadata", "FlagResolutionDetails", + "FlagType", + "Reason", ] diff --git a/openfeature/hook/__init__.py b/openfeature/hook/__init__.py index e98301fa..77190dc0 100644 --- a/openfeature/hook/__init__.py +++ b/openfeature/hook/__init__.py @@ -12,7 +12,7 @@ from openfeature.client import ClientMetadata from openfeature.provider.metadata import Metadata -__all__ = ["HookType", "HookContext", "HookHints", "Hook"] +__all__ = ["Hook", "HookContext", "HookHints", "HookType"] class HookType(Enum): diff --git a/openfeature/provider/__init__.py b/openfeature/provider/__init__.py index 8927551e..b390f928 100644 --- a/openfeature/provider/__init__.py +++ b/openfeature/provider/__init__.py @@ -11,7 +11,7 @@ from .metadata import Metadata -__all__ = ["AbstractProvider", "ProviderStatus", "FeatureProvider", "Metadata"] +__all__ = ["AbstractProvider", "FeatureProvider", "Metadata", "ProviderStatus"] class ProviderStatus(Enum): diff --git a/openfeature/transaction_context/__init__.py b/openfeature/transaction_context/__init__.py index e97fd36f..ca711cbf 100644 --- a/openfeature/transaction_context/__init__.py +++ b/openfeature/transaction_context/__init__.py @@ -6,6 +6,6 @@ ) __all__ = [ - "TransactionContextPropagator", "ContextVarsTransactionContextPropagator", + "TransactionContextPropagator", ] diff --git a/openfeature/transaction_context/context_var_transaction_context_propagator.py b/openfeature/transaction_context/context_var_transaction_context_propagator.py index 1abc04fa..5ffdae00 100644 --- a/openfeature/transaction_context/context_var_transaction_context_propagator.py +++ b/openfeature/transaction_context/context_var_transaction_context_propagator.py @@ -1,4 +1,5 @@ from contextvars import ContextVar +from typing import Optional from openfeature.evaluation_context import EvaluationContext from openfeature.transaction_context.transaction_context_propagator import ( @@ -7,12 +8,17 @@ class ContextVarsTransactionContextPropagator(TransactionContextPropagator): - _transaction_context_var: ContextVar[EvaluationContext] = ContextVar( - "transaction_context", default=EvaluationContext() + _transaction_context_var: ContextVar[Optional[EvaluationContext]] = ContextVar( + "transaction_context", default=None ) def get_transaction_context(self) -> EvaluationContext: - return self._transaction_context_var.get() + context = self._transaction_context_var.get() + if context is None: + context = EvaluationContext() + self._transaction_context_var.set(context) + + return context def set_transaction_context(self, transaction_context: EvaluationContext) -> None: self._transaction_context_var.set(transaction_context) From e6ada0f4131f382b2063811edd03d65c981188a2 Mon Sep 17 00:00:00 2001 From: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com> Date: Mon, 25 Nov 2024 04:29:26 -0500 Subject: [PATCH 14/27] chore(main): release 0.7.4 (#397) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ README.md | 8 ++++---- openfeature/version.py | 2 +- pyproject.toml | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 449ac20d..967ffcc2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{".":"0.7.3"} \ No newline at end of file +{".":"0.7.4"} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bb1297ac..2f734242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.7.4](https://github.com/open-feature/python-sdk/compare/v0.7.3...v0.7.4) (2024-11-25) + + +### 🧹 Chore + +* **deps:** update pre-commit hook astral-sh/ruff-pre-commit to v0.8.0 ([#395](https://github.com/open-feature/python-sdk/issues/395)) ([cd737a9](https://github.com/open-feature/python-sdk/commit/cd737a9a6aeb6ff64050f759749aab96e73a8c34)) + ## [0.7.3](https://github.com/open-feature/python-sdk/compare/v0.7.2...v0.7.3) (2024-11-24) diff --git a/README.md b/README.md index 689706a9..8c078fab 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ - - Latest version + + Latest version @@ -60,13 +60,13 @@ #### Pip install ```bash -pip install openfeature-sdk==0.7.3 +pip install openfeature-sdk==0.7.4 ``` #### requirements.txt ```bash -openfeature-sdk==0.7.3 +openfeature-sdk==0.7.4 ``` ```python diff --git a/openfeature/version.py b/openfeature/version.py index 4910b9ec..ed9d4d87 100644 --- a/openfeature/version.py +++ b/openfeature/version.py @@ -1 +1 @@ -__version__ = "0.7.3" +__version__ = "0.7.4" diff --git a/pyproject.toml b/pyproject.toml index 49b667f7..394947a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "openfeature_sdk" -version = "0.7.3" +version = "0.7.4" description = "Standardizing Feature Flagging for Everyone" readme = "README.md" authors = [{ name = "OpenFeature", email = "openfeature-core@groups.io" }] From 043385a8369e253a5e0ad1e184e980f8e8d7e5c7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 06:52:17 +0000 Subject: [PATCH 15/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.8.1 (#398) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c2b32957..df503cc8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.0 + rev: v0.8.1 hooks: - id: ruff args: [--fix] From 2b6e210bc9dda72335e646fc60cde79b5bdd76c1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:23:45 +0000 Subject: [PATCH 16/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.8.2 (#400) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index df503cc8..fc187941 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.1 + rev: v0.8.2 hooks: - id: ruff args: [--fix] From 0459330cb91e9b28a15bdd380aec4c56c3b5d8df Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 19:02:20 +0000 Subject: [PATCH 17/27] chore(deps): update codecov/codecov-action action to v5.1.0 (#401) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a61b870c..22316b7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.0.7 + uses: codecov/codecov-action@v5.1.0 with: flags: unittests # optional name: coverage # optional From a6907d610e6dde1eecef56f25f3cc6a569b6eee4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:01:03 +0000 Subject: [PATCH 18/27] chore(deps): update codecov/codecov-action action to v5.1.1 (#402) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22316b7f..4e02584d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.1.0 + uses: codecov/codecov-action@v5.1.1 with: flags: unittests # optional name: coverage # optional From 01ec388d2d93fc87a4f2eca856cf507cbee35785 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:49:40 +0000 Subject: [PATCH 19/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.8.3 (#404) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc187941..2c18a06d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.2 + rev: v0.8.3 hooks: - id: ruff args: [--fix] From 1c564804afad474151489d695af7fa0409a768c6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:30:13 +0000 Subject: [PATCH 20/27] chore(deps): update codecov/codecov-action action to v5.1.2 (#405) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e02584d..353ab536 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - if: matrix.python-version == '3.11' name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.1.1 + uses: codecov/codecov-action@v5.1.2 with: flags: unittests # optional name: coverage # optional From 3296d3b229d41c7f879adfb7ab36e19de36617e4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:12:10 +0000 Subject: [PATCH 21/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.8.4 (#406) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2c18a06d..f767c98e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.3 + rev: v0.8.4 hooks: - id: ruff args: [--fix] From 89d6997b1fe04df82e0873de7e7a1ea1aca2b071 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 10:26:40 +0000 Subject: [PATCH 22/27] chore(deps): update pre-commit hook pre-commit/mirrors-mypy to v1.14.0 (#407) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f767c98e..458db420 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: check-merge-conflict - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.13.0 + rev: v1.14.0 hooks: - id: mypy files: openfeature From 26bc9642270f9371170ce8ab2d9b938a0fca187e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:03:00 +0100 Subject: [PATCH 23/27] chore(config): migrate renovate config (#408) chore(config): migrate config renovate.json Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- renovate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index f29e38c2..6c501126 100644 --- a/renovate.json +++ b/renovate.json @@ -1,7 +1,7 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ - "config:base" + "config:recommended" ], "semanticCommits": "enabled", "pep621": { From 2c1840c87d00177d87b93135a38a7df98a9f6c0b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:39:55 +0000 Subject: [PATCH 24/27] chore(deps): update pre-commit hook pre-commit/mirrors-mypy to v1.14.1 (#409) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 458db420..5e0eac00 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: check-merge-conflict - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.0 + rev: v1.14.1 hooks: - id: mypy files: openfeature From 7f9d422497a6d8392eee18ccfd12050eef7a2338 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 02:33:20 +0000 Subject: [PATCH 25/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.8.6 (#410) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5e0eac00..1231991d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.4 + rev: v0.8.6 hooks: - id: ruff args: [--fix] From bc6e3332157788ec3f8037f68b9087e26a4634b5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 19:23:15 +0000 Subject: [PATCH 26/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.9.0 (#411) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1231991d..919ac1aa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.0 hooks: - id: ruff args: [--fix] From cbace6a24c3fa091242aedd4f7c2e8de4332e463 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 21:24:06 +0000 Subject: [PATCH 27/27] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.9.1 (#412) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 919ac1aa..f27a82dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_stages: [commit] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.0 + rev: v0.9.1 hooks: - id: ruff args: [--fix]