Skip to content
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

Add $set and $set_once support #23

Merged
merged 10 commits into from
May 7, 2021
Merged

Add $set and $set_once support #23

merged 10 commits into from
May 7, 2021

Conversation

paolodamico
Copy link
Contributor

@paolodamico paolodamico commented Feb 8, 2021

Adds $set and $set_once support to the library. Related to PostHog/posthog#2684.

Further, makes things easier to test & run locally. Using setup.py test is deprecated, and so is test_requires. Thus, I changed the test file names and added support for pytest so we can still test things. I didn't change any CI configuration, which hopefully gives confidence that the new and old testing methods are on par.

If you're okay with this change, I can "upgrade" ci.yaml as well.

@paolodamico paolodamico requested a review from macobo February 8, 2021 10:20
@paolodamico
Copy link
Contributor Author

First time taking a stab at this library, so a thorough review would be appreciated.

@paolodamico
Copy link
Contributor Author

Ping @macobo should we move this forward?

@yakkomajuri
Copy link
Contributor

If we're doing $set_once, shouldn't we also do $set?

@paolodamico paolodamico requested a review from timgl April 2, 2021 17:55
@Twixes
Copy link
Member

Twixes commented Apr 16, 2021

Definitely agree with support set the same way.

@neilkakkar neilkakkar changed the title Add $set_once support Add $set and $set_once support May 6, 2021
@@ -125,7 +185,7 @@ def test_basic_page(self):

def test_basic_page_distinct_uuid(self):
client = self.client
distinct_id = uuid4()
distinct_id = str(uuid4())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this worked before O.o

Comment on lines +74 to +81
def set_once():
posthog.set_once(
options.distinct_id,
properties=json_hash(options.traits),
context=json_hash(options.context),
)


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit, but might be good to add "set" here for completion as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, makes sense

@mariusandra
Copy link
Contributor

Can you please still fix the black error... and then feel free to merge it into master :).

@neilkakkar neilkakkar merged commit 49d0821 into master May 7, 2021
@neilkakkar neilkakkar deleted the set_once branch May 7, 2021 10:25
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.

5 participants