Fix deprecated Posthog API Key initialization#91
Conversation
edublancas
left a comment
There was a problem hiding this comment.
let's look up in which posthog package version this was applied, and put it here:
Line 18 in 3fdc748
also, the docs are failing because we're missing this: https://github.com/ploomber/jupysql/blob/6f83dbec7659124efe00c8ab1c3838b404fc0f3f/.readthedocs.yml#L24

the CI is also failing, I think because the Python versions are too old. let's only test with 3.10, 3.11 and 3.12
setup.py
Outdated
| REQUIRES = [ | ||
| "pyyaml", | ||
| "posthog", | ||
| "posthog<3.0", |
There was a problem hiding this comment.
the pin should be the other way around: >x.y.z
your previous changes were fine but we need to pin to ensure that the new version also forces a posthog upgrade
|
@edublancas before I saw your review I went back and pinned the version instead of making the changes (since I saw the tests were failing due to PH not supporting python 3.8) If you're okay with removing the python 3.8 tests then I'll bring back the original changes and apply your notes |
|
im ok removing old python versions |
|
Tests are failing due to failed mocks. Updating them now |
|
@edublancas please review again when you get the chance |
| self._posthog_client = posthog.Posthog( | ||
| api_key, host="https://us.i.posthog.com" | ||
| ) | ||
| except Exception as e: |
There was a problem hiding this comment.
this isn't a good way to handle an incompatibilty, instead we can raise an error telling users they must upgrade posthog or downgrade ploomber-core
Describe your changes
posthog.project_api_key = self.api_keysince its deprecatedposthog.Posthog(api_key, host='https://us.i.posthog.com')and changed thelog_apifunction to use this clientIssue number
Fixes support issue: https://ploomber-io.slack.com/archives/C08QNPDF15J/p1752779413170409
Checklist before requesting a review
pkgmt format📚 Documentation preview 📚: https://ploomber-core--91.org.readthedocs.build/en/91/