Skip to content

feat: Add Flipt provider #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 21, 2025
Merged

Conversation

atmask
Copy link
Contributor

@atmask atmask commented Jan 3, 2025

Overview

This PR implements the Flipt provider by wrapping around the OFREP Provider and leveraging Flipt's OFREP api

Discussion Points:

  • Should we support passing the namespace in the constructor this way or just leave it up to users to do it themselves via the generic headers_factory (like they would need to for authentication)

Related Issues

Fixes #89

How to test

Unit Tests: From the base of the package run hatch test

Local Usage: Go to the base of the new packager (i.e. provider/openfeature-provider-flipt), run pip install -e ., and then open a python repl with python3:

from openfeature import api
from openfeature.contrib.provider.flipt import FliptProvider
api.set_provider(FliptProvider(base_url="<flipt instance>", namespace="<your namespace>"))
client = api.get_client()
client.get_boolean_value("<your feature flag key>", True)

@atmask atmask requested a review from a team as a code owner January 3, 2025 21:05
@atmask atmask changed the title [Issue 89] Add Flipt provider feat: Add Flipt provider Jan 3, 2025
@beeme1mr beeme1mr requested a review from markphelps January 3, 2025 21:39
Copy link

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! just curious if this gives end users much over the generic Python OFREP impl? Is the end goal of OFREP to make it easier to implement provider specific sdks or to be 'the' SDK for all providers that support it?

cc @beeme1mr

@beeme1mr
Copy link
Member

I'm fine with the OFREP provider being extended to make it work more seamlessly. It's really up to you and Mark. I believe Flipt also has an SDK that supports in-process evaluation. That would likely be a more performant option.

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.65%. Comparing base (d3e3b94) to head (1bc44e2).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
+ Coverage   94.39%   94.65%   +0.26%     
==========================================
  Files          14       14              
  Lines         749      749              
==========================================
+ Hits          707      709       +2     
+ Misses         42       40       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@atmask
Copy link
Contributor Author

atmask commented Jan 17, 2025

@beeme1mr kk, sounds good. I'll leave that ask up to @markphelps to give direction on. I had thought of wrapping around the existing Python SDK for Flipt but OFREP seemed quicker and easier option to get support out (I'd like to be able to consume this api). I can re-work it but it'll just take some more time to re-write the implementation

@markphelps
Copy link

@atmask lgtm! thank you!! we do have an inprocess evaluator like @beeme1mr mentioned, although I think it would be classified as a client provider in the OF world. the only thing to note is that Flipt added OFREP support in Flipt v1.47.0, so these endpoints wont exist in any versions of Flipt before this

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please registry this provider in the release please manifest and config? Once that's in place, we should be good to release. Thanks!

@atmask
Copy link
Contributor Author

atmask commented Jan 19, 2025

@beeme1mr Yes! Just pushed the manifest & config updates

@atmask atmask force-pushed the provider/flipt-issue89 branch from 6d9e687 to 1bc44e2 Compare January 19, 2025 00:59
@atmask
Copy link
Contributor Author

atmask commented Jan 21, 2025

@beeme1mr What blockers remain for getting this merged and releasing? Is release to pypi automated atm?

@beeme1mr
Copy link
Member

What blockers remain for getting this merged and releasing? Is release to pypi automated atm?

Sorry, the blocker is me. I'll take care of this ASAP.

@beeme1mr beeme1mr merged commit 599a6dd into open-feature:main Jan 21, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Flipt provider
3 participants