Repository navigation
Conversation
Co-authored-by: Donald Ng <donaldngg@gmail.com>
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.
What
This PR adds two independent enhancements to the mida-python SDK:
propertiesparameter toset_event()to support event metadata (e.g., revenue tracking)pyproject.tomlfor standards-compliant packaging and distributionWhy
Event Properties: Server-side SDKs should support event properties for tracking additional context like revenue, quantity, product IDs, etc. This matches the capabilities of the Node.js and PHP SDKs.
Packaging: The repository had no packaging configuration, requiring users to manually copy
mida.pyand install dependencies. A properpyproject.tomlenables:pip install .from the repositorypip install mida-pythonChanges
Event Properties
set_event(event_name, distinct_id, properties=None)now accepts an optionalpropertiesdictpropertiesfield (matching Node.js/PHP SDK wire format)propertiescontinues to work)tests/test_set_event.pythat verifies both with and without propertiesPackaging
pyproject.tomlwith:setuptools>=61build backendmida-python(placeholder, see notes below)0.1.0(placeholder, see notes below)requestsdependency declaredpy-modules = ["mida"]to package the single-file modulepip install .workflow.gitignorefor Python build artifactsRisk
Low risk - Both changes are backwards compatible:
propertiesparameter continues to work unchangedMerge Conflicts
set_eventdocumentation while PR Fix feature flag cache to be keyed per user #1 updatesis_feature_enableddocumentation. Manual merge will combine both changes..gitignorefiles (no actual conflict, just duplicate adds)These conflicts are expected and resolvable. The patches are functionally independent.
Important Notes
🚨 Placeholders for Donald to confirm before publishing:
Package name: Currently set to
mida-pythoninpyproject.tomlVersion: Currently set to
0.1.0License format warning: The build shows a deprecation warning about
license = { text = "MIT" }license = "MIT"(requires setuptools>=77.0.0 or later)How to Verify
Test event properties:
Tests verify:
propertiesfieldBuild the package:
Should successfully create:
dist/mida_python-0.1.0.tar.gz(source distribution)dist/mida_python-0.1.0-py3-none-any.whl(wheel)Install and test locally:
pip install dist/mida_python-0.1.0-py3-none-any.whl python3 -c "from mida import Mida; m = Mida('test'); print('Import works!')"