-
Notifications
You must be signed in to change notification settings - Fork 88
Python: Add OpenFeature provider #156
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
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7e267c8
Add OpenFeature provider package
msiebert 5135505
Add missing OpenFeature provider tests and fix provider gaps
msiebert ece5e75
Fix OpenFeature context passthrough to pass attributes as-is
msiebert 124f6b1
Align OpenFeature provider with server provider spec
msiebert a34bf6e
Fix root logger misuse and consolidate duplicate recursive methods
msiebert 001dfab
Fix bool subclass bug in numeric type resolution
msiebert a511391
Merge origin/master into msiebert-openfeature-provider
msiebert 6a32f84
Revert out-of-scope changes from merge conflict resolution
msiebert 571af47
Fix docstrings to match master's reportExposure naming
msiebert e601641
Fix CI: exclude openfeature-provider from root lint and test collection
msiebert 1c40800
Remove report_exposure parameter from OpenFeature provider's get_vari…
msiebert baa48db
Add CI job for OpenFeature provider tests
msiebert 247b539
Add coverage upload for OpenFeature provider CI job
msiebert 3c721d5
Add pytest-cov to OpenFeature provider test dependencies
msiebert 6058162
Address PR review feedback for OpenFeature provider
msiebert b6719df
Fix mixpanel version constraint in OpenFeature provider
msiebert f8553ca
Add simplified class methods for OpenFeature provider
msiebert 90c87e0
Use TARGETING_MATCH reason for successful evaluations and DEFAULT for…
msiebert ac74911
Add release documentation for OpenFeature provider
msiebert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Releasing the OpenFeature Provider | ||
|
|
||
| The OpenFeature provider (`mixpanel-openfeature`) is published to PyPI independently from the core SDK. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Python 3.9+ | ||
| - `build` and `twine` packages: `pip install build twine` | ||
| - A PyPI API token with permission to upload to the `mixpanel-openfeature` project | ||
| - Create one at https://pypi.org/manage/account/token/ | ||
| - For the first upload, you'll need an account-scoped token (project-scoped tokens can only be created after the project exists on PyPI) | ||
|
|
||
| ## Releasing | ||
|
|
||
| 1. Update the version in `pyproject.toml` | ||
|
|
||
| 2. Build the package: | ||
| ```bash | ||
| cd openfeature-provider | ||
| python -m build | ||
| ``` | ||
|
|
||
| 3. Verify the built artifacts look correct: | ||
| ```bash | ||
| ls dist/ | ||
| # Should show: mixpanel_openfeature-<version>-py3-none-any.whl | ||
| # mixpanel_openfeature-<version>.tar.gz | ||
| ``` | ||
|
|
||
| 4. Upload to PyPI: | ||
| ```bash | ||
| python -m twine upload dist/* | ||
| ``` | ||
| Twine will prompt for credentials. Use `__token__` as the username and your API token as the password. Alternatively, configure `~/.pypirc`: | ||
| ```ini | ||
| [pypi] | ||
| username = __token__ | ||
| password = pypi-<your-token> | ||
| ``` | ||
|
|
||
| 5. Verify at https://pypi.org/project/mixpanel-openfeature/ | ||
|
|
||
| ## Versioning | ||
|
|
||
| The OpenFeature provider is versioned independently from the core SDK. The core SDK dependency version is pinned in `pyproject.toml` (`mixpanel>=5.1.0,<6`) — update it when the provider needs features from a newer core SDK release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| [build-system] | ||
| requires = ["setuptools>=61.0", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "mixpanel-openfeature" | ||
| version = "0.1.0" | ||
| description = "OpenFeature provider for the Mixpanel Python SDK" | ||
| license = "Apache-2.0" | ||
| authors = [ | ||
| {name = "Mixpanel, Inc.", email = "dev@mixpanel.com"}, | ||
| ] | ||
| requires-python = ">=3.9" | ||
| dependencies = [ | ||
| "mixpanel>=5.1.0,<6", | ||
| "openfeature-sdk>=0.7.0", | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| test = [ | ||
| "pytest>=8.4.1", | ||
| "pytest-asyncio>=0.23.0", | ||
| "pytest-cov>=6.0", | ||
| ] | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["src"] | ||
|
|
||
| [tool.pytest.ini_options] | ||
| asyncio_mode = "auto" | ||
|
|
||
| # --- Ruff configuration (mirrors main project) --- | ||
|
|
||
| [tool.ruff] | ||
| target-version = "py39" | ||
| line-length = 88 | ||
|
|
||
| [tool.ruff.lint] | ||
| select = ["ALL"] | ||
| ignore = [ | ||
| # --- Rule conflicts --- | ||
| "D203", # conflicts with D211 (no-blank-line-before-class) | ||
| "D213", # conflicts with D212 (multi-line-summary-first-line) | ||
| "COM812", # conflicts with ruff formatter | ||
| "ISC001", # conflicts with ruff formatter | ||
|
|
||
| # --- Type annotations (separate effort) --- | ||
| "ANN", # all annotation rules | ||
|
|
||
| # --- Docstrings (separate effort) --- | ||
| "D100", # undocumented-public-module | ||
| "D101", # undocumented-public-class | ||
| "D102", # undocumented-public-method | ||
| "D103", # undocumented-public-function | ||
| "D104", # undocumented-public-package | ||
| "D105", # undocumented-magic-method | ||
| "D107", # undocumented-public-init | ||
|
|
||
| # --- Boolean arguments (public API) --- | ||
| "FBT", # boolean-type-hint / boolean-default / boolean-positional | ||
|
|
||
| # --- TODO/FIXME enforcement --- | ||
| "TD002", # missing-todo-author | ||
| "TD003", # missing-todo-link | ||
| "FIX001", # line-contains-fixme | ||
| "FIX002", # line-contains-todo | ||
|
|
||
| # --- Exception message style --- | ||
| "EM101", # raw-string-in-exception | ||
| "EM103", # dot-format-in-exception | ||
| "TRY003", # raise-vanilla-args | ||
|
|
||
| # --- Other pragmatic exclusions --- | ||
| "PLR0913", # too-many-arguments | ||
| "PLR0911", # too-many-return-statements (_resolve has many type-check branches) | ||
| "E501", # line-too-long (formatter handles code) | ||
| "FA100", # future-rewritable-type-annotation | ||
| "BLE001", # blind-exception (catching Exception in flag resolution is intentional) | ||
| ] | ||
|
|
||
| [tool.ruff.lint.per-file-ignores] | ||
| "tests/*.py" = [ | ||
| "S101", # assert | ||
| "S105", # hardcoded-password-string (test fixtures) | ||
| "S106", # hardcoded-password-func-arg | ||
| "SLF001", # private-member-access | ||
| "PLR2004", # magic-value-comparison | ||
| "D", # all docstring rules | ||
| "PT018", # pytest-composite-assertion | ||
| "INP001", # implicit-namespace-package (no __init__.py in tests) | ||
| "ARG", # unused arguments (lambda stubs in mocks) | ||
| ] | ||
|
|
||
| [tool.ruff.lint.isort] | ||
| known-first-party = ["mixpanel", "mixpanel_openfeature"] | ||
|
|
||
| [tool.ruff.lint.pydocstyle] | ||
| convention = "google" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from .provider import MixpanelProvider | ||
|
|
||
| __all__ = ["MixpanelProvider"] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.