Conversation
Contributor
There was a problem hiding this comment.
PR Summary
Enhanced the send_feature_flags parameter in PostHog Python SDK to support a more declarative configuration object while maintaining backward compatibility with boolean values.
- Added new
SendFeatureFlagsOptionsTypedDict inposthog/types.pyallowing granular control over feature flag evaluation - Implemented support for event-specific person and group properties in
posthog/client.pywithout affecting global state - Extended test coverage in
posthog/test/test_client.pyto verify new features like local evaluation and custom properties - Updated CHANGELOG.md and version.py to 6.2.0 following semantic versioning for the new feature
6 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Pull Request Overview
Enhance the send_feature_flags parameter so it can accept a structured options object for explicit local vs. remote evaluation and per-event properties.
- Add
SendFeatureFlagsOptionsTypedDict and update argument types to support the new object - Refactor
Client.captureto parse boolean or options object and branch into local or remote flag evaluation - Introduce tests covering
only_evaluate_locally=True,False, and default behaviors; bump version to 6.2.0 and update changelog
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| posthog/version.py | Bumped SDK version to 6.2.0 |
| posthog/types.py | Added SendFeatureFlagsOptions TypedDict for granular flag control |
| posthog/args.py | Updated OptionalCaptureArgs to allow boolean or options object |
| posthog/client.py | Refactored capture to parse and apply send_feature_flags options |
| posthog/test/test_client.py | Added tests for new send_feature_flags option behaviors |
| CHANGELOG.md | Documented the enhanced send_feature_flags parameter |
Comments suppressed due to low confidence (3)
posthog/test/test_client.py:755
- [nitpick] Add a test case where
group_propertiesis provided along withonly_evaluate_locally=Trueto verify that local evaluation correctly applies the group-level overrides.
def test_capture_with_send_feature_flags_options_only_evaluate_locally_true(
posthog/args.py:37
- [nitpick] In the docstring for
send_feature_flags, explicitly note that omittingonly_evaluate_locallyin the options object will default to remote evaluation so users clearly understand the fallback behavior.
send_feature_flags: NotRequired[
posthog/version.py:1
- Ensure that the stray hyphen from the previous version line is fully removed so the file only contains the clean
VERSION = "6.2.0"statement.
VERSION = "6.2.0"
haacked
approved these changes
Jul 11, 2025
Contributor
haacked
left a comment
There was a problem hiding this comment.
Nice! Some stylistic suggestions and comment changes, but nothing blocking.
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The current
send_feature_flagsboolean parameter provides limited control over feature flag evaluation behavior. Users couldn't specify evaluation preferences or custom properties per capture event.Solution
Modified
send_feature_flagsto accept either:bool(existing behavior, fully backward compatible)SendFeatureFlagsOptionsobject with granular control:{ "only_evaluate_locally": bool, # Force local vs remote evaluation "person_properties": dict, # Custom properties for this event "group_properties": dict # Custom group properties }Benefits
Usage Examples
This brings the Python SDK in line with the enhanced Node.js SDK functionality from PostHog/posthog-js-lite#566