8000 feat: Remove deprecated `monotonic` lib by rafaeelaudibert · Pull Request #231 · PostHog/posthog-python · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Remove deprecated monotonic lib #231

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

Merged
merged 2 commits into from
Apr 29, 2025
Merged

Conversation

rafaeelaudibert
Copy link
Member

This library has been long-deprecated (2021). We can use time.monotonic instead which has been available since Python 3.3

Closes #230

@rafaeelaudibert rafaeelaudibert requested review from skoob13 and a team April 29, 2025 13:42
This library has been long-deprecated (2021). We can use `time.monotonic` instead which has been available since Python 3.3

Closes #230
Copy link
Contributor
@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR replaces the deprecated 'monotonic' library with Python's built-in 'time.monotonic()' function, removing a dependency on an unmaintained package.

  • Removed 'monotonic' dependency and replaced with built-in 'time.monotonic()' in /posthog/consumer.py
  • Updated python-dateutil requirement from >2.1 to >=2.2 in /setup.py and /setup_analytics.py
  • Potential compatibility issue: /setup_analytics.py claims Python 2.6-3.2 support but time.monotonic() requires Python 3.3+
  • Duplicate package structure between /setup.py and /setup_analytics.py needs consolidation

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Member
@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

lib docs say "On Python 3.3 or newer, monotonic will be an alias of time.monotonic from the standard library. On older versions, it will fall back to an equivalent implementation:"

so this feels super safe

@rafaeelaudibert rafaeelaudibert changed the title feat: Remove deprecated lib feat: Remove deprecated monotonic lib Apr 29, 2025
@rafaeelaudibert
Copy link
Member Author

I'm not super certain on release procedures for posthog-python, but I've followed #221 example. I'll manually release once merged - this could probably happen automatically

@daibhin
Copy link
Contributor
daibhin commented Apr 29, 2025

@rafaeelaudibert yep, once you have the changelog etc included it's just a manual action after merge

@rafaeelaudibert
Copy link
Member Author

@daibhin Nice! I've created #232 to make this slightly more streamlined too - automatic release

@@ -1,3 +1,7 @@
## 4.0.1 – 2025-04-29

1. Remove deprecated `monotonic` library. Use Python's core `time.monotonic` function instead
Copy link
Member

Choose a reason for hiding this comment

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

is it worth mentioning that now we require python min. 3.3? do we document this somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

CI runs on Python 3.9+ so this SHOULD be ok, but I can make this more explicit

Copy link
Member Author
@rafaeelaudibert rafaeelaudibert Apr 29, 2025

Choose a reason for hiding this comment

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

Ok, and only Python 3.9+ are actually maintained (security releases). I'll note that everywhere, but will consider this part of this patch version - no need for a major/minor (we've just released v4 anyway)

@rafaeelaudibert rafaeelaudibert merged commit 7aea6b7 into master Apr 29, 2025
6 checks passed
@rafaeelaudibert rafaeelaudibert deleted the remove-monotonic-lib branch April 29, 2025 14:15
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.

Removing monotonic dependency
4 participants
0