Skip to content

Commit 7aea6b7

Browse files
feat: Remove deprecated monotonic lib (#231)
1 parent 7bb7c90 commit 7aea6b7

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 4.0.1 – 2025-04-29
2+
3+
1. Remove deprecated `monotonic` library. Use Python's core `time.monotonic` function instead
4+
2. Clarify Python 3.9+ is required
5+
16
## 4.0.0 - 2025-04-24
27

38
1. Added new method `get_feature_flag_result` which returns a `FeatureFlagResult` object. This object breaks down the result of a feature flag into its enabled state, variant, and payload. The benefit of this method is it allows you to retrieve the result of a feature flag and its payload in a single API call. You can call `get_value` on the result to get the value of the feature flag, which is the same value returned by `get_feature_flag` (aka the string `variant` if the flag is a multivariate flag or the `boolean` value if the flag is a boolean flag).

posthog/consumer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import json
22
import logging
3+
import time
34
from threading import Thread
45

56
import backoff
6-
import monotonic
77

88
from posthog.request import APIError, DatetimeSerializer, batch_post
99

@@ -96,11 +96,11 @@ def next(self):
9696
queue = self.queue
9797
items = []
9898

99-
start_time = monotonic.monotonic()
99+
start_time = time.monotonic()
100100
total_size = 0
101101

102102
while len(items) < self.flush_at:
103-
elapsed = monotonic.monotonic() - start_time
103+
elapsed = time.monotonic() - start_time
104104
if elapsed >= self.flush_interval:
105105
break
106106
try:

posthog/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "4.0.0"
1+
VERSION = "4.0.1"
22

33
if __name__ == "__main__":
44
print(VERSION, end="") # noqa: T201

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212

1313
long_description = """
1414
PostHog is developer-friendly, self-hosted product analytics. posthog-python is the python package.
15+
16+
This package requires Python 3.9 or higher.
1517
"""
1618

1719
install_requires = [
1820
"requests>=2.7,<3.0",
1921
"six>=1.5",
20-
"monotonic>=1.5",
22+
"python-dateutil>=2.2",
2123
"backoff>=1.10.0",
22-
"python-dateutil>2.1",
2324
"distro>=1.5.0", # Required for Linux OS detection in Python 3.9+
2425
]
2526

setup_analytics.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212

1313
long_description = """
1414
PostHog is developer-friendly, self-hosted product analytics. posthog-python is the python package.
15+
16+
This package requires Python 3.9 or higher.
1517
"""
1618

1719
install_requires = [
1820
"requests>=2.7,<3.0",
1921
"six>=1.5",
20-
"monotonic>=1.5",
22+
"python-dateutil>=2.2",
2123
"backoff>=1.10.0",
22-
"python-dateutil>2.1",
2324
"distro>=1.5.0", # Required for Linux OS detection in Python 3.9+
2425
]
2526

@@ -58,19 +59,10 @@
5859
"License :: OSI Approved :: MIT License",
5960
"Operating System :: OS Independent",
6061
"Programming Language :: Python",
61-
"Programming Language :: Python :: 2",
62-
"Programming Language :: Python :: 2.6",
63-
"Programming Language :: Python :: 2.7",
64-
"Programming Language :: Python :: 3",
65-
"Programming Language :: Python :: 3.2",
66-
"Programming Language :: Python :: 3.3",
67-
"Programming Language :: Python :: 3.4",
68-
"Programming Language :: Python :: 3.5",
69-
"Programming Language :: Python :: 3.6",
70-
"Programming Language :: Python :: 3.7",
71-
"Programming Language :: Python :: 3.8",
7262
"Programming Language :: Python :: 3.9",
7363
"Programming Language :: Python :: 3.10",
7464
"Programming Language :: Python :: 3.11",
65+
"Programming Language :: Python :: 3.12",
66+
"Programming Language :: Python :: 3.13",
7567
],
7668
)

0 commit comments

Comments
 (0)