-
Notifications
You must be signed in to change notification settings - Fork 32
remove 'import posthog' #255
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&r 8000 dquo;, 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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Updates import statements throughout the codebase to use specific function imports instead of the global posthog
package import, improving maintainability and preventing circular dependencies.
- Modifies
posthog/sentry/posthog_integration.py
to import specific functions (capture
,host
) instead of the globalposthog
package - Updates
posthog/scopes.py
to directly importcapture_exception
rather than accessing it throughposthog.capture_exception
- Removes
sed
commands from Makefile that were previously handlingposthog
/posthoganalytics
import swapping - Bumps version to 4.6.2 to reflect the import statement cleanup
5 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile
rm -rf posthog | ||
python setup_analytics.py sdist bdist_wheel | ||
twine upload dist/* | ||
mkdir posthog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Removing and recreating 'posthog' directory between operations could lead to issues if twine upload fails. Consider moving directory operations after successful upload.
@@ -39,7 +39,7 @@ def new_context(fresh=False): | |||
raise ValueError("Something went wrong") | |||
|
|||
""" | |||
import posthog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be cool if we can have ruff forbid this in future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. ChatGPT is down right now and I'm having trouble googling for the right rule. Will double back
CHANGELOG.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh.. @daibhin i updated setup instructions in the readme
you need to run a command to setup the precommit hooks and then ruff will autorun on commit for you
Follow on from #254
That PR had the intended effect of replacing
import posthog
withimport posthoganalytics
. I failed to realise that everywhereposthog.{method_name}
was called also needed replacing. Going to try this simpler approach of never importing the entire package