vybekiit 0.7.26 → 0.7.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +3891 -1301
- package/dist/global-skills/aws-cdk/SKILL.md +19 -5
- package/dist/global-skills/aws-cdk/references/fast-deployments.md +191 -0
- package/dist/global-skills/aws-cdk/references/troubleshooting-deployment.md +16 -0
- package/dist/global-skills/aws-cloudformation/SKILL.md +16 -26
- package/dist/global-skills/aws-cloudformation/references/check-cloudformation-template-compliance.script.md +7 -3
- package/dist/global-skills/aws-cloudformation/references/cloudformation-language-server.md +177 -0
- package/dist/global-skills/aws-cloudformation/references/cloudformation-pre-deploy-validation.script.md +8 -2
- package/dist/global-skills/aws-cloudformation/references/persist-template-context.script.md +5 -8
- package/dist/global-skills/aws-cloudformation/references/retrieve-template-context.script.md +1 -1
- package/dist/global-skills/aws-cloudformation/references/security-considerations.md +51 -0
- package/dist/global-skills/aws-cloudformation/references/troubleshoot-failed-stack.script.md +138 -0
- package/dist/global-skills/aws-cloudformation/references/{validate-cloudformation-template.script.md → validate-with-cfn-lint.script.md} +15 -27
- package/dist/global-skills/aws-cloudformation/references/validate-with-cloudformation-validate.script.md +181 -0
- package/dist/global-skills/aws-cloudformation/references/validation-tool-selection.md +44 -0
- package/dist/global-skills/aws-serverless/SKILL.md +9 -1
- package/dist/global-skills/aws-serverless/references/architecture.md +3 -1
- package/dist/global-skills/aws-serverless/references/lambda.md +3 -1
- package/dist/global-skills/aws-serverless/references/orchestration.md +1 -0
- package/dist/global-skills/better-auth-best-practices/SKILL.md +18 -8
- package/dist/global-skills/eas-app-stores/SKILL.md +31 -15
- package/dist/global-skills/eas-app-stores/agents/openai.yaml +2 -2
- package/dist/global-skills/eas-app-stores/references/ios-app-store.md +37 -32
- package/dist/global-skills/eas-app-stores/references/native-ios.md +167 -0
- package/dist/global-skills/eas-app-stores/references/play-store.md +3 -7
- package/dist/global-skills/eas-app-stores/references/testflight.md +39 -35
- package/dist/global-skills/eas-simulator/SKILL.md +48 -26
- package/dist/global-skills/eas-simulator/references/controllers.md +32 -3
- package/dist/global-skills/eas-simulator/references/run-your-app.md +34 -4
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -4
- package/dist/global-skills/eas-update/SKILL.md +146 -0
- package/dist/global-skills/eas-update/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-animation/RECIPES.md +2 -2
- package/dist/global-skills/expo-animation/SKILL.md +9 -2
- package/dist/global-skills/expo-brownfield/SKILL.md +18 -11
- package/dist/global-skills/expo-brownfield/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-brownfield/references/brownfield-integrated.md +94 -69
- package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +40 -42
- package/dist/global-skills/expo-brownfield/references/comparison.md +5 -5
- package/dist/global-skills/expo-brownfield/references/feature-integration.md +163 -0
- package/dist/global-skills/expo-brownfield/references/troubleshooting.md +17 -17
- package/dist/global-skills/expo-brownfield/references/version-compatibility.md +40 -0
- package/dist/global-skills/expo-data-fetching/SKILL.md +27 -6
- package/dist/global-skills/expo-design-system/SKILL.md +27 -7
- package/dist/global-skills/expo-design-system/references/audit.md +7 -2
- package/dist/global-skills/expo-design-system/references/native-slop.md +74 -0
- package/dist/global-skills/expo-examples/SKILL.md +0 -1
- package/dist/global-skills/expo-examples/references/catalog.md +1 -1
- package/dist/global-skills/expo-migrate-module/SKILL.md +21 -10
- package/dist/global-skills/expo-migrate-module/references/compatibility.md +80 -23
- package/dist/global-skills/expo-migrate-module/references/migration-map.md +162 -11
- package/dist/global-skills/expo-native-ui/SKILL.md +25 -16
- package/dist/global-skills/expo-native-ui/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-native-ui/references/controls.md +5 -46
- package/dist/global-skills/expo-native-ui/references/icons.md +21 -2
- package/dist/global-skills/expo-native-ui/references/media.md +15 -20
- package/dist/global-skills/expo-native-ui/references/visual-effects.md +12 -11
- package/dist/global-skills/expo-overview/SKILL.md +17 -12
- package/dist/global-skills/expo-router/SKILL.md +5 -3
- package/dist/global-skills/expo-router/references/tabs.md +5 -5
- package/dist/global-skills/expo-upgrade/SKILL.md +3 -1
- package/dist/global-skills/expo-web-to-native/references/false-friends.md +2 -2
- package/dist/global-skills/expo-web-to-native/references/native-patterns.md +1 -1
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +13 -16
- package/dist/global-skills/firebase-ai-logic-basics/references/ios_setup.md +4 -5
- package/dist/global-skills/firebase-ai-logic-basics/references/usage_patterns_android.md +4 -4
- package/dist/global-skills/firebase-ai-logic-basics/references/usage_patterns_web.md +3 -3
- package/dist/global-skills/firebase-auth-basics/SKILL.md +11 -6
- package/dist/global-skills/firebase-auth-basics/references/client_sdk_android.md +4 -5
- package/dist/global-skills/firebase-auth-basics/references/client_sdk_web.md +3 -3
- package/dist/global-skills/firebase-auth-basics/references/flutter_setup.md +24 -25
- package/dist/global-skills/firebase-auth-basics/references/security_rules.md +4 -2
- package/dist/global-skills/firebase-crashlytics/references/android_setup.md +7 -4
- package/dist/global-skills/firebase-crashlytics/references/ios_setup.md +2 -3
- package/dist/global-skills/firebase-data-connect/SKILL.md +2 -1
- package/dist/global-skills/firebase-data-connect/examples.md +4 -4
- package/dist/global-skills/firebase-data-connect/reference/config.md +5 -4
- package/dist/global-skills/firebase-data-connect/reference/realtime.md +1 -2
- package/dist/global-skills/firebase-data-connect/reference/sdk_flutter.md +2 -2
- package/dist/global-skills/firebase-data-connect/reference/sdk_ios.md +2 -2
- package/dist/global-skills/firebase-data-connect/reference/sdk_web.md +17 -6
- package/dist/global-skills/firebase-data-connect/reference/security.md +5 -5
- package/dist/global-skills/firebase-data-connect/templates.md +2 -1
- package/dist/global-skills/firebase-firestore/SKILL.md +20 -8
- package/dist/global-skills/firebase-firestore/references/enterprise/android_sdk_usage.md +5 -4
- package/dist/global-skills/firebase-firestore/references/enterprise/data_model.md +12 -3
- package/dist/global-skills/firebase-firestore/references/enterprise/indexes.md +16 -18
- package/dist/global-skills/firebase-firestore/references/enterprise/provisioning.md +1 -1
- package/dist/global-skills/firebase-firestore/references/enterprise/python_sdk_usage.md +5 -1
- package/dist/global-skills/firebase-firestore/references/enterprise/web_sdk_usage.md +7 -7
- package/dist/global-skills/firebase-firestore/references/standard/android_sdk_usage.md +5 -5
- package/dist/global-skills/firebase-firestore/references/standard/flutter_setup.md +4 -4
- package/dist/global-skills/firebase-firestore/references/standard/indexes.md +16 -18
- package/dist/global-skills/firebase-firestore/references/standard/provisioning.md +1 -1
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +0 -5
- package/dist/global-skills/firebase-remote-config-basics/references/android_setup.md +36 -8
- package/dist/global-skills/firebase-remote-config-basics/references/ios_setup.md +1 -7
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +17 -6
- package/dist/global-skills/{firebase-firestore/references/standard/security_rules.md → firestore-rules-creation/SKILL.md} +24 -13
- package/dist/global-skills/grow-my-customers/SKILL.md +23 -0
- package/dist/global-skills/instrument-feature-flags/SKILL.md +25 -25
- package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +141 -285
- package/dist/global-skills/instrument-feature-flags/references/android.md +6 -15
- package/dist/global-skills/instrument-feature-flags/references/api.md +4 -11
- package/dist/global-skills/instrument-feature-flags/references/best-practices.md +1 -13
- package/dist/global-skills/instrument-feature-flags/references/django.md +14 -27
- package/dist/global-skills/instrument-feature-flags/references/dotnet.md +20 -79
- package/dist/global-skills/instrument-feature-flags/references/elixir.md +1 -9
- package/dist/global-skills/instrument-feature-flags/references/flask.md +13 -13
- package/dist/global-skills/instrument-feature-flags/references/flutter.md +3 -24
- package/dist/global-skills/instrument-feature-flags/references/go.md +3 -15
- package/dist/global-skills/instrument-feature-flags/references/ios.md +4 -17
- package/dist/global-skills/instrument-feature-flags/references/java.md +5 -13
- package/dist/global-skills/instrument-feature-flags/references/laravel.md +13 -17
- package/dist/global-skills/instrument-feature-flags/references/next-js.md +25 -32
- package/dist/global-skills/instrument-feature-flags/references/nodejs.md +8 -15
- package/dist/global-skills/instrument-feature-flags/references/php.md +1 -15
- package/dist/global-skills/instrument-feature-flags/references/python.md +2 -15
- package/dist/global-skills/instrument-feature-flags/references/react-native.md +13 -15
- package/dist/global-skills/instrument-feature-flags/references/react.md +17 -21
- package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +37 -83
- package/dist/global-skills/instrument-feature-flags/references/ruby.md +2 -15
- package/dist/global-skills/instrument-feature-flags/references/rust.md +13 -25
- package/dist/global-skills/instrument-feature-flags/references/usage.md +14 -63
- package/dist/global-skills/instrument-feature-flags/references/web.md +9 -14
- package/dist/global-skills/instrument-product-analytics/SKILL.md +29 -29
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-static.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-view-transitions.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +3 -1
- package/dist/global-skills/instrument-product-analytics/references/android.md +72 -107
- package/dist/global-skills/instrument-product-analytics/references/angular.md +26 -28
- package/dist/global-skills/instrument-product-analytics/references/astro.md +13 -24
- package/dist/global-skills/instrument-product-analytics/references/configuration.md +45 -63
- package/dist/global-skills/instrument-product-analytics/references/django.md +14 -27
- package/dist/global-skills/instrument-product-analytics/references/dotnet.md +20 -79
- package/dist/global-skills/instrument-product-analytics/references/elixir.md +47 -49
- package/dist/global-skills/instrument-product-analytics/references/flask.md +13 -13
- package/dist/global-skills/instrument-product-analytics/references/flutter.md +60 -90
- package/dist/global-skills/instrument-product-analytics/references/go.md +17 -56
- package/dist/global-skills/instrument-product-analytics/references/identify-users.md +15 -15
- package/dist/global-skills/instrument-product-analytics/references/ios.md +11 -15
- package/dist/global-skills/instrument-product-analytics/references/laravel.md +13 -17
- package/dist/global-skills/instrument-product-analytics/references/next-js.md +25 -32
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +13 -27
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +14 -28
- package/dist/global-skills/instrument-product-analytics/references/php.md +33 -84
- package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +229 -9
- package/dist/global-skills/instrument-product-analytics/references/python.md +415 -106
- package/dist/global-skills/instrument-product-analytics/references/react-native.md +161 -155
- package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +12 -33
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +15 -33
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +12 -33
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +26 -41
- package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +37 -83
- package/dist/global-skills/instrument-product-analytics/references/ruby.md +48 -108
- package/dist/global-skills/instrument-product-analytics/references/svelte.md +18 -24
- package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +17 -19
- package/dist/global-skills/instrument-product-analytics/references/usage.md +14 -63
- package/dist/global-skills/instrument-product-analytics/references/vue-js.md +29 -28
- package/dist/global-skills/manifest.json +8 -2
- package/dist/global-skills/mongodb-search-and-ai/SKILL.md +28 -37
- package/dist/global-skills/mongodb-search-and-ai/references/automated-embedding.md +438 -0
- package/dist/global-skills/mongodb-search-and-ai/references/hybrid-search.md +60 -4
- package/dist/global-skills/mongodb-search-and-ai/references/vector-search.md +46 -108
- package/dist/global-skills/neon/SKILL.md +207 -213
- package/dist/global-skills/neon/references/auth.md +12 -0
- package/dist/global-skills/neon/references/claimable-neon.md +10 -14
- package/dist/global-skills/neon/references/function-triggers.md +53 -0
- package/dist/global-skills/neon/references/logs-loki.md +61 -0
- package/dist/global-skills/neon/references/parse-env.md +32 -0
- package/dist/global-skills/neon/references/sdk.md +7 -0
- package/dist/global-skills/neon-ai-gateway/SKILL.md +14 -16
- package/dist/global-skills/neon-auth/SKILL.md +155 -0
- package/dist/global-skills/neon-auth/references/managed-auth.md +173 -0
- package/dist/global-skills/neon-auth/references/self-managed.md +25 -0
- package/dist/global-skills/neon-functions/SKILL.md +159 -84
- package/dist/global-skills/neon-functions/references/ai-sdk.md +4 -6
- package/dist/global-skills/neon-functions/references/function-triggers.md +249 -0
- package/dist/global-skills/neon-functions/references/mastra-studio.md +3 -3
- package/dist/global-skills/neon-functions/references/mcp.md +1 -1
- package/dist/global-skills/neon-functions/references/production-hardening.md +340 -0
- package/dist/global-skills/neon-functions/references/sse.md +8 -5
- package/dist/global-skills/neon-object-storage/SKILL.md +10 -11
- package/dist/global-skills/neon-postgres/SKILL.md +120 -17
- package/dist/global-skills/neon-postgres/references/full-text-search.md +99 -0
- package/dist/global-skills/neon-postgres/references/hybrid-search.md +90 -0
- package/dist/global-skills/neon-postgres/references/lakebase-search-drizzle.md +172 -0
- package/dist/global-skills/neon-postgres/references/vector-search.md +137 -0
- package/dist/global-skills/neon-postgres-branches/SKILL.md +3 -3
- package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +1 -1
- package/dist/global-skills/onboarding/SKILL.md +8 -6
- package/dist/global-skills/resend/SKILL.md +4 -2
- package/dist/global-skills/resend/references/broadcasts.md +6 -1
- package/dist/global-skills/resend/references/receiving.md +29 -10
- package/dist/global-skills/resend/references/sending/email-management.md +14 -4
- package/dist/global-skills/resend/references/topics.md +9 -6
- package/dist/global-skills/resend/references/usage.md +117 -0
- package/dist/global-skills/resend/references/webhooks.md +59 -2
- package/dist/global-skills/stripe-best-practices/SKILL.md +35 -29
- package/dist/global-skills/stripe-best-practices/references/billing.md +9 -2
- package/dist/global-skills/stripe-best-practices/references/payments.md +4 -2
- package/dist/global-skills/stripe-best-practices/references/security.md +3 -1
- package/dist/global-skills/stripe-best-practices/references/tax.md +39 -20
- package/dist/global-skills/supabase/SKILL.md +6 -0
- package/dist/global-skills/use-railway/SKILL.md +42 -22
- package/dist/global-skills/use-railway/references/analyze-db.md +7 -6
- package/dist/global-skills/use-railway/references/cloud-agents.md +70 -0
- package/dist/global-skills/use-railway/references/configure.md +17 -2
- package/dist/global-skills/use-railway/references/databases.md +107 -0
- package/dist/global-skills/use-railway/references/deploy.md +5 -5
- package/dist/global-skills/use-railway/references/feature-flags.md +25 -13
- package/dist/global-skills/use-railway/references/iac.md +66 -77
- package/dist/global-skills/use-railway/references/operate.md +26 -3
- package/dist/global-skills/use-railway/references/request.md +31 -23
- package/dist/global-skills/use-railway/references/setup.md +16 -5
- package/dist/global-skills/use-railway/references/tracing.md +261 -0
- package/dist/global-skills/use-railway/references/usage.md +52 -0
- package/dist/global-skills/validate-my-idea/SKILL.md +54 -0
- package/dist/global-skills/{feedback → vybekiit-feedback}/SKILL.md +16 -12
- package/dist/global-skills/watch-my-app/SKILL.md +53 -0
- package/dist/global-skills/workers-best-practices/SKILL.md +36 -103
- package/dist/global-skills/workers-best-practices/references/configuration.md +139 -0
- package/dist/global-skills/workers-best-practices/references/platform-apis.md +51 -0
- package/dist/global-skills/workers-best-practices/references/{rules.md → runtime-patterns.md} +13 -137
- package/dist/global-skills/wrangler/SKILL.md +48 -901
- package/dist/global-skills/xcode-project-setup/scripts/xcode_spm_setup/Sources/main.swift +19 -15
- package/package.json +9 -8
- package/dist/global-skills/expo-native-ui/references/animations.md +0 -220
- package/dist/global-skills/firebase-firestore/references/enterprise/security_rules.md +0 -577
- package/dist/global-skills/workers-best-practices/references/review.md +0 -174
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# PostHog Python SDK
|
|
4
4
|
|
|
5
|
-
**SDK Version:** 7.
|
|
5
|
+
**SDK Version:** 7.60.0
|
|
6
6
|
|
|
7
7
|
Integrate PostHog into any python application.
|
|
8
8
|
|
|
@@ -13,6 +13,7 @@ Integrate PostHog into any python application.
|
|
|
13
13
|
- Capture
|
|
14
14
|
- Error Tracking
|
|
15
15
|
- Feature flags
|
|
16
|
+
- Tracing
|
|
16
17
|
- Contexts
|
|
17
18
|
- Events
|
|
18
19
|
- Client management
|
|
@@ -41,7 +42,7 @@ Initialize a new PostHog client instance.
|
|
|
41
42
|
- **`flush_interval`** (`float`) - Maximum seconds a background consumer waits before flushing a partial batch.
|
|
42
43
|
- **`gzip`** (`bool`) - Whether to gzip event upload payloads.
|
|
43
44
|
- **`max_retries`** (`int`) - Number of upload retries. Values below 0 are treated as 0.
|
|
44
|
-
- **`sync_mode`** (`bool`) - If True, send each event synchronously instead of using background worker threads.
|
|
45
|
+
- **`sync_mode`** (`bool`) - If True, send each event synchronously instead of using background worker threads. This blocks the calling thread; in asyncio applications such as FastAPI, use ``AsyncPosthog`` instead.
|
|
45
46
|
- **`timeout`** (`int`) - HTTP request timeout in seconds for event uploads.
|
|
46
47
|
- **`thread`** (`int`) - Number of background consumer threads.
|
|
47
48
|
- **`poll_interval`** (`int`) - Seconds between local feature flag definition refreshes.
|
|
@@ -76,8 +77,10 @@ Initialize a new PostHog client instance.
|
|
|
76
77
|
- **`secret_key`** (`any`) - A Personal API Key or Project Secret API Key, used to authenticate local feature flag evaluation, remote config payloads, and decrypted flag payloads. Example:: posthog.Client(project_api_key, secret_key="phx_...")
|
|
77
78
|
- **`metrics?`** (`dict`)
|
|
78
79
|
- **`enable_full_ai_capture`** (`bool`) - Route PostHog AI wrapper events through the dedicated AI capture endpoint and capture full AI content: skips string truncation and passes media (base64/data URIs) through unredacted. ``privacy_mode`` always wins. Defaults to False.
|
|
80
|
+
- **`capture_trace_context`** (`bool`) - When OpenTelemetry is installed and a valid span is active at capture time, add its trace and span IDs as ``$trace_id`` and ``$span_id`` properties to events captured with ``capture()`` and ``capture_ai()``, so they can be correlated with backend traces. Explicit ``$trace_id``/``$span_id`` values passed in ``properties`` win. Exception events (``capture_exception``) always attach these IDs regardless of this setting. Defaults to False.
|
|
79
81
|
- **`_use_ai_lane`** (`bool`)
|
|
80
82
|
- **`_enable_multimodal_capture`** (`bool`)
|
|
83
|
+
- **`traces?`** (`dict`) - Config dict for distributed tracing: ``service_name``, ``service_version``, ``environment``, ``resource_attributes``, ``flush_interval`` (5 s), ``max_queue_size`` (2048), ``max_export_batch_size`` (512), ``max_live_spans`` (10000), ``max_span_age`` (3600 s), ``max_attributes_per_span`` (128), ``max_events_per_span`` (128), ``max_attribute_value_length`` (8192). ``before_span_send`` is a callable, or a list run in order, that receives each finished span as a dict (``trace_id``, ``span_id`` and ``parent_span_id`` are read-only) and returns it, edited, or ``None`` to drop it; a hook that raises drops the span. Tracing is off until this is provided. Spans export on a background timer even with ``sync_mode``; serverless handlers should call ``flush()`` before returning. Defaults to None.
|
|
81
84
|
|
|
82
85
|
### Returns
|
|
83
86
|
|
|
@@ -320,7 +323,7 @@ Evaluate all feature flags for a user in a single call and return a :class:`Feat
|
|
|
320
323
|
- **`group_properties?`** (`dict[str, dict[str, Any]]`) - Group properties keyed by group type.
|
|
321
324
|
- **`only_evaluate_locally`** (`bool`) - If True, never fall back to remote evaluation — flags that can't be evaluated locally are simply omitted from the snapshot.
|
|
322
325
|
- **`disable_geoip?`** (`bool`) - Whether to disable GeoIP lookup.
|
|
323
|
-
- **`flag_keys?`** (`list[str]`) - Optional list
|
|
326
|
+
- **`flag_keys?`** (`list[str]`) - Optional list that scopes local evaluation, the underlying ``/flags`` request, and the returned snapshot. When omitted or ``None``, all flags are evaluated. An empty list returns an empty snapshot without evaluating flags. A requested key absent from loaded local definitions is included in one remote fallback per ``evaluate_flags`` call unless ``only_evaluate_locally`` is True. If the server also does not know the key, it is omitted from the snapshot.
|
|
324
327
|
- **`device_id?`** (`str`) - Optional device ID override. If not provided, falls back to the context device_id (which may be set via tracing headers). Used by experience-continuity flags to match users across distinct_id changes.
|
|
325
328
|
|
|
326
329
|
### Returns
|
|
@@ -479,6 +482,58 @@ if enabled_variant == 'variant-key': # replace 'variant-key' with the key of you
|
|
|
479
482
|
|
|
480
483
|
---
|
|
481
484
|
|
|
485
|
+
#### get_feature_flag_evaluation_runtime()
|
|
486
|
+
|
|
487
|
+
**Release Tag:** public
|
|
488
|
+
|
|
489
|
+
Return where a locally loaded feature flag is meant to be evaluated.
|
|
490
|
+
|
|
491
|
+
### Parameters
|
|
492
|
+
|
|
493
|
+
- **`key?`** (`str`) - The feature flag key.
|
|
494
|
+
|
|
495
|
+
### Returns
|
|
496
|
+
|
|
497
|
+
- `Optional[FeatureFlagEvaluationRuntime]`
|
|
498
|
+
|
|
499
|
+
### Examples
|
|
500
|
+
|
|
501
|
+
```python
|
|
502
|
+
from posthog import FeatureFlagEvaluationRuntime
|
|
503
|
+
|
|
504
|
+
runtime = posthog.get_feature_flag_evaluation_runtime("my-flag")
|
|
505
|
+
if runtime is FeatureFlagEvaluationRuntime.SERVER:
|
|
506
|
+
...
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
#### get_feature_flag_keys_by_evaluation_runtime()
|
|
512
|
+
|
|
513
|
+
**Release Tag:** public
|
|
514
|
+
|
|
515
|
+
Return the keys of locally loaded flags that a runtime can evaluate. A flag set to ``FeatureFlagEvaluationRuntime.ALL`` suits either runtime, so it is returned for ``CLIENT`` and for ``SERVER``, and asking for ``ALL`` returns every loaded flag. Use this to decide which flags to hand to a browser when a backend serves flags to its own frontend.
|
|
516
|
+
|
|
517
|
+
### Parameters
|
|
518
|
+
|
|
519
|
+
- **`evaluation_runtime?`** (`FeatureFlagEvaluationRuntime`) - The runtime to match, as a ``FeatureFlagEvaluationRuntime`` or its string value.
|
|
520
|
+
|
|
521
|
+
### Returns
|
|
522
|
+
|
|
523
|
+
- `list[str]`
|
|
524
|
+
|
|
525
|
+
### Examples
|
|
526
|
+
|
|
527
|
+
```python
|
|
528
|
+
from posthog import FeatureFlagEvaluationRuntime
|
|
529
|
+
|
|
530
|
+
client_keys = posthog.get_feature_flag_keys_by_evaluation_runtime(
|
|
531
|
+
FeatureFlagEvaluationRuntime.CLIENT
|
|
532
|
+
)
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
482
537
|
#### get_feature_flag_payload()
|
|
483
538
|
|
|
484
539
|
**Release Tag:** public
|
|
@@ -547,7 +602,7 @@ result = posthog.get_feature_flags_and_payloads('<distinct_id>')
|
|
|
547
602
|
|
|
548
603
|
**Release Tag:** public
|
|
549
604
|
|
|
550
|
-
Get feature flag payloads for a user.
|
|
605
|
+
Get feature flag payloads for a user, preserving valid serialized JSON.
|
|
551
606
|
|
|
552
607
|
### Parameters
|
|
553
608
|
|
|
@@ -561,7 +616,7 @@ Get feature flag payloads for a user.
|
|
|
561
616
|
|
|
562
617
|
### Returns
|
|
563
618
|
|
|
564
|
-
- `dict[str, str]`
|
|
619
|
+
- `dict[str, Optional[str]]`
|
|
565
620
|
|
|
566
621
|
### Examples
|
|
567
622
|
|
|
@@ -665,7 +720,7 @@ Force a flush from the internal queue to the server. Do not use directly, call `
|
|
|
665
720
|
|
|
666
721
|
### Parameters
|
|
667
722
|
|
|
668
|
-
- **`timeout_seconds?`** (`float`) - Maximum seconds to wait for the queue to flush. Defaults to 10 seconds. Pass ``None`` to wait indefinitely.
|
|
723
|
+
- **`timeout_seconds?`** (`float`) - Maximum seconds to wait for the queue to flush. Defaults to 10 seconds. Pass ``None`` to wait indefinitely. Queued spans are sent at the same time, within the same
|
|
669
724
|
|
|
670
725
|
### Returns
|
|
671
726
|
|
|
@@ -736,7 +791,7 @@ posthog.join()
|
|
|
736
791
|
|
|
737
792
|
**Release Tag:** public
|
|
738
793
|
|
|
739
|
-
Flush all messages and cleanly shutdown the client. Call this before the process ends in serverless environments to avoid data loss. Normally this method blocks until queued events have been attempted and cleanup finishes. Failed or undrainable events may be dropped and reported through logging or ``on_error``; returning does not guarantee server receipt. Lifecycle cleanup is attempted once, and cleanup failures are logged without retry. When called directly from an SDK callback such as ``on_error``, shutdown is deferred to avoid blocking the worker that invoked the callback. If the callback must coordinate a blocking shutdown, have it signal an application-owned thread and return before that thread calls shutdown. Do not wait inside the callback for another thread or task that calls a lifecycle method.
|
|
794
|
+
Flush all messages and cleanly shutdown the client. Call this before the process ends in serverless environments to avoid data loss. Normally this method blocks until queued events have been attempted and cleanup finishes. Failed or undrainable events may be dropped and reported through logging or ``on_error``; returning does not guarantee server receipt. Queued spans get one final flush of up to 30 s (plus a request already in flight); any it cannot send are discarded with a warning, as are spans still open. Lifecycle cleanup is attempted once, and cleanup failures are logged without retry. When called directly from an SDK callback such as ``on_error``, shutdown is deferred to avoid blocking the worker that invoked the callback. If the callback must coordinate a blocking shutdown, have it signal an application-owned thread and return before that thread calls shutdown. Do not wait inside the callback for another thread or task that calls a lifecycle method.
|
|
740
795
|
|
|
741
796
|
### Returns
|
|
742
797
|
|
|
@@ -750,6 +805,61 @@ posthog.shutdown()
|
|
|
750
805
|
|
|
751
806
|
---
|
|
752
807
|
|
|
808
|
+
### Tracing methods
|
|
809
|
+
|
|
810
|
+
#### get_active_span()
|
|
811
|
+
|
|
812
|
+
**Release Tag:** public
|
|
813
|
+
|
|
814
|
+
The span that is active in the current context, or ``None``. Alpha. Only entering a span (``with posthog.start_span(...) as span:``) makes it active; a span started manually is not. Use it to propagate the trace to the next service: ``span.traceparent()`` is the header value.
|
|
815
|
+
|
|
816
|
+
### Returns
|
|
817
|
+
|
|
818
|
+
- `Optional[Span]`
|
|
819
|
+
|
|
820
|
+
### Examples
|
|
821
|
+
|
|
822
|
+
```python
|
|
823
|
+
span = posthog.get_active_span()
|
|
824
|
+
if span is not None:
|
|
825
|
+
headers["traceparent"] = span.traceparent()
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
---
|
|
829
|
+
|
|
830
|
+
#### start_span()
|
|
831
|
+
|
|
832
|
+
**Release Tag:** public
|
|
833
|
+
|
|
834
|
+
Start a span for distributed tracing. Alpha. Returns a span handle. Use it as a context manager to make it the active span for the block and end it on exit (recording a raised exception on the way out); or call ``end()`` yourself for a span that cannot wrap a block. Spans started inside the block nest under it automatically. Always returns a usable handle, even when tracing is off, so calling code never branches.
|
|
835
|
+
|
|
836
|
+
### Parameters
|
|
837
|
+
|
|
838
|
+
- **`name?`** (`str`) - A low-cardinality operation name, e.g. ``GET /users/:id``. Variable values belong in attributes, not the name.
|
|
839
|
+
- **`kind?`** (`str`) - ``internal`` (default), ``server``, ``client``, ``producer`` or ``consumer``.
|
|
840
|
+
- **`attributes?`** (`Mapping[str, Any]`) - Initial attributes.
|
|
841
|
+
- **`parent`** (`Span`) - A span handle, or an inbound W3C ``traceparent`` header value to continue a remote trace. Defaults to the active span. A forked child starts with no active span; pass the parent span to continue a trace across a fork.
|
|
842
|
+
- **`tracestate?`** (`str`) - The inbound ``tracestate`` header accompanying a ``traceparent`` string ``parent``; preserved and propagated.
|
|
843
|
+
- **`start_time`** (`datetime`) - A ``datetime`` or epoch seconds, to backdate the span.
|
|
844
|
+
|
|
845
|
+
### Returns
|
|
846
|
+
|
|
847
|
+
- `Span`
|
|
848
|
+
|
|
849
|
+
### Examples
|
|
850
|
+
|
|
851
|
+
```python
|
|
852
|
+
posthog = Posthog("<ph_project_api_key>", traces={"service_name": "checkout-api"})
|
|
853
|
+
|
|
854
|
+
with posthog.start_span("POST /checkout", parent=request.headers.get("traceparent")) as span:
|
|
855
|
+
span.set_attribute("plan", user.plan)
|
|
856
|
+
with posthog.start_span("db.query", kind="client"):
|
|
857
|
+
...
|
|
858
|
+
outgoing_headers = {"traceparent": span.traceparent()}
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
---
|
|
862
|
+
|
|
753
863
|
### Contexts methods
|
|
754
864
|
|
|
755
865
|
#### get_tags()
|
|
@@ -1166,9 +1276,9 @@ Evaluate all feature flags for a user in a single call and return a :class:`Feat
|
|
|
1166
1276
|
- **`groups?`** (`Mapping[str, Union[str, int]]`) - Mapping of group type to group key.
|
|
1167
1277
|
- **`person_properties?`** (`dict[str, Any]`) - Person properties to use for evaluation.
|
|
1168
1278
|
- **`group_properties?`** (`dict[str, dict[str, Any]]`) - Group properties keyed by group type.
|
|
1169
|
-
- **`only_evaluate_locally`** (`bool`) - If ``True``, never fall back to remote evaluation.
|
|
1279
|
+
- **`only_evaluate_locally`** (`bool`) - If ``True``, never fall back to remote evaluation and omit flags that cannot be evaluated locally.
|
|
1170
1280
|
- **`disable_geoip?`** (`bool`) - Whether to disable GeoIP lookup.
|
|
1171
|
-
- **`flag_keys?`** (`list[str]`) - Optional list
|
|
1281
|
+
- **`flag_keys?`** (`list[str]`) - Optional list that scopes local evaluation, the underlying ``/flags`` request, and the returned snapshot. When omitted or ``None``, all flags are evaluated. An empty list returns an empty snapshot without evaluating flags. A requested key absent from loaded local definitions is included in one remote fallback per ``evaluate_flags`` call unless ``only_evaluate_locally`` is ``True``. If the server also does not know the key, it is omitted from the snapshot.
|
|
1172
1282
|
- **`device_id?`** (`str`) - Optional device ID override. If not provided, falls back to the context device_id (which may be set via tracing headers). Used by experience-continuity flags to match users across distinct_id changes.
|
|
1173
1283
|
|
|
1174
1284
|
### Returns
|
|
@@ -1344,6 +1454,60 @@ if enabled_variant == 'variant-key':
|
|
|
1344
1454
|
|
|
1345
1455
|
---
|
|
1346
1456
|
|
|
1457
|
+
#### get_feature_flag_evaluation_runtime()
|
|
1458
|
+
|
|
1459
|
+
**Release Tag:** public
|
|
1460
|
+
|
|
1461
|
+
Return where a locally loaded feature flag is meant to be evaluated.
|
|
1462
|
+
|
|
1463
|
+
**Notes:**
|
|
1464
|
+
|
|
1465
|
+
Reads the `evaluation_runtime` each flag definition carries, so no extra request is made. Returns `None` when local evaluation has not loaded a definition for this key. A definition that carries no runtime reports `FeatureFlagEvaluationRuntime.ALL`, the default PostHog applies.
|
|
1466
|
+
|
|
1467
|
+
### Parameters
|
|
1468
|
+
|
|
1469
|
+
- **`key?`** (`str`)
|
|
1470
|
+
|
|
1471
|
+
### Returns
|
|
1472
|
+
|
|
1473
|
+
- `Optional[FeatureFlagEvaluationRuntime]`
|
|
1474
|
+
|
|
1475
|
+
### Examples
|
|
1476
|
+
|
|
1477
|
+
```python
|
|
1478
|
+
from posthog import FeatureFlagEvaluationRuntime, get_feature_flag_evaluation_runtime
|
|
1479
|
+
runtime = get_feature_flag_evaluation_runtime("my-flag")
|
|
1480
|
+
```
|
|
1481
|
+
|
|
1482
|
+
---
|
|
1483
|
+
|
|
1484
|
+
#### get_feature_flag_keys_by_evaluation_runtime()
|
|
1485
|
+
|
|
1486
|
+
**Release Tag:** public
|
|
1487
|
+
|
|
1488
|
+
Return the keys of locally loaded flags that a runtime can evaluate.
|
|
1489
|
+
|
|
1490
|
+
**Notes:**
|
|
1491
|
+
|
|
1492
|
+
A flag set to `FeatureFlagEvaluationRuntime.ALL` suits either runtime, so it is returned for `CLIENT` and for `SERVER`. Use this to decide which flags to hand to a browser when a backend serves flags to its own frontend.
|
|
1493
|
+
|
|
1494
|
+
### Parameters
|
|
1495
|
+
|
|
1496
|
+
- **`evaluation_runtime?`** (`FeatureFlagEvaluationRuntime`)
|
|
1497
|
+
|
|
1498
|
+
### Returns
|
|
1499
|
+
|
|
1500
|
+
- `list[str]`
|
|
1501
|
+
|
|
1502
|
+
### Examples
|
|
1503
|
+
|
|
1504
|
+
```python
|
|
1505
|
+
from posthog import FeatureFlagEvaluationRuntime, get_feature_flag_keys_by_evaluation_runtime
|
|
1506
|
+
client_keys = get_feature_flag_keys_by_evaluation_runtime(FeatureFlagEvaluationRuntime.CLIENT)
|
|
1507
|
+
```
|
|
1508
|
+
|
|
1509
|
+
---
|
|
1510
|
+
|
|
1347
1511
|
#### get_feature_flag_payload()
|
|
1348
1512
|
|
|
1349
1513
|
**Release Tag:** public
|
|
@@ -1451,6 +1615,62 @@ shutdown()
|
|
|
1451
1615
|
|
|
1452
1616
|
---
|
|
1453
1617
|
|
|
1618
|
+
### Tracing methods
|
|
1619
|
+
|
|
1620
|
+
#### get_active_span()
|
|
1621
|
+
|
|
1622
|
+
**Release Tag:** public
|
|
1623
|
+
|
|
1624
|
+
The span that is active in the current context, or ``None``. Alpha. Only entering a span (``with posthog.start_span(...) as span:``) makes it active; a span started manually is not. Use it to propagate the trace to the next service: ``span.traceparent()`` is the header value.
|
|
1625
|
+
|
|
1626
|
+
### Returns
|
|
1627
|
+
|
|
1628
|
+
- `Optional[Span]`
|
|
1629
|
+
|
|
1630
|
+
### Examples
|
|
1631
|
+
|
|
1632
|
+
```python
|
|
1633
|
+
span = posthog.get_active_span()
|
|
1634
|
+
if span is not None:
|
|
1635
|
+
headers["traceparent"] = span.traceparent()
|
|
1636
|
+
```
|
|
1637
|
+
|
|
1638
|
+
---
|
|
1639
|
+
|
|
1640
|
+
#### start_span()
|
|
1641
|
+
|
|
1642
|
+
**Release Tag:** public
|
|
1643
|
+
|
|
1644
|
+
Start a span for distributed tracing. Alpha. Returns a span handle. Use it as a context manager to make it the active span for the block and end it on exit (recording a raised exception on the way out); or call ``end()`` yourself for a span that cannot wrap a block. Spans started inside the block nest under it automatically. Always returns a usable handle, even when tracing is off, so calling code never branches.
|
|
1645
|
+
|
|
1646
|
+
### Parameters
|
|
1647
|
+
|
|
1648
|
+
- **`name?`** (`str`) - A low-cardinality operation name, e.g. ``GET /users/:id``. Variable values belong in attributes, not the name.
|
|
1649
|
+
- **`kind?`** (`str`) - ``internal`` (default), ``server``, ``client``, ``producer`` or ``consumer``.
|
|
1650
|
+
- **`attributes?`** (`Mapping[str, Any]`) - Initial attributes.
|
|
1651
|
+
- **`parent`** (`Span`) - A span handle, or an inbound W3C ``traceparent`` header value to continue a remote trace. Defaults to the active span.
|
|
1652
|
+
- **`tracestate?`** (`str`) - The inbound ``tracestate`` header accompanying a ``traceparent`` string ``parent``; preserved and propagated.
|
|
1653
|
+
- **`start_time`** (`datetime`) - A ``datetime`` or epoch seconds, to backdate the span.
|
|
1654
|
+
|
|
1655
|
+
### Returns
|
|
1656
|
+
|
|
1657
|
+
- `Span`
|
|
1658
|
+
|
|
1659
|
+
### Examples
|
|
1660
|
+
|
|
1661
|
+
```python
|
|
1662
|
+
import posthog
|
|
1663
|
+
posthog.traces = {"service_name": "checkout-api"}
|
|
1664
|
+
|
|
1665
|
+
with posthog.start_span("POST /checkout", parent=request.headers.get("traceparent")) as span:
|
|
1666
|
+
span.set_attribute("plan", user.plan)
|
|
1667
|
+
with posthog.start_span("db.query", kind="client"):
|
|
1668
|
+
...
|
|
1669
|
+
outgoing_headers = {"traceparent": span.traceparent()}
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
---
|
|
1673
|
+
|
|
1454
1674
|
### Other methods
|
|
1455
1675
|
|
|
1456
1676
|
#### get_feature_flag_result()
|