Skip to content

chore: replace pydantic models with stdlib dataclasses - #195

Open
tylerjroach wants to merge 1 commit into
masterfrom
tal/remove-pydantic
Open

chore: replace pydantic models with stdlib dataclasses#195
tylerjroach wants to merge 1 commit into
masterfrom
tal/remove-pydantic

Conversation

@tylerjroach

Copy link
Copy Markdown
Contributor

Summary

  • replace Pydantic feature-flag models with standard-library dataclasses and lenient from_dict parsers
  • remove the Pydantic dependency and update uv.lock
  • fix OpenFeature configuration examples and update repository guidance

Closes #190.

Testing

  • ruff format --check .
  • ruff check .
  • pytest --cov --cov-branch --cov-report=term-missing (387 passed)
  • pytest --cov --cov-branch --cov-report=term-missing openfeature-provider/tests/ (52 passed)
  • uv lock --check

Removes the pydantic dependency (issue #190). Feature-flag types in
mixpanel/flags/types.py are now stdlib dataclasses with from_dict
parsers that keep the previous lenient extra-key behavior. Also drops
pydantic from uv.lock, updates repo docs, and fixes README examples
that passed a non-existent token= kwarg to the config classes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@tylerjroach
tylerjroach requested review from a team and ketanmixpanel September 2, 2026 15:39
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The new parsers preserve required nested feature-flag construction, ignore forward-compatible extra fields, and the provider call sites consistently use the replacement dataclass APIs.

Important Files Changed

Filename Overview
mixpanel/flags/types.py Replaces Pydantic DTOs with dataclasses and explicit parsers while preserving nested model construction and fallback-copy behavior.
mixpanel/flags/local_feature_flags.py Switches local definitions to dataclass parsing and uses deepcopy when applying rollout-specific variant splits.
mixpanel/flags/remote_feature_flags.py Switches remote flag responses from Pydantic validation to the new parser.
pyproject.toml Removes the Pydantic runtime dependency and updates related lint guidance.
uv.lock Removes Pydantic and its transitive packages without changing the investigated advisory-bearing dependencies.

Reviews (1): Last reviewed commit: "chore: replace pydantic models with stdl..." | Re-trigger Greptile

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.39%. Comparing base (a4f669a) to head (8d1c84a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #195      +/-   ##
==========================================
+ Coverage   96.33%   96.39%   +0.06%     
==========================================
  Files          15       15              
  Lines        2838     2888      +50     
  Branches      176      176              
==========================================
+ Hits         2734     2784      +50     
  Misses         67       67              
  Partials       37       37              
Flag Coverage Δ
openfeature-provider 51.24% <72.05%> (+0.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Consider dropping the pydantic dependency

2 participants