Skip to content

Commit d2baca5

Browse files
committed
readme and formatting
1 parent 5ba74da commit d2baca5

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ Please see the [Python integration docs](https://posthog.com/docs/integrations/p
1010
### Testing Locally
1111

1212
1. Run `python3 -m venv env` (creates virtual environment called "env")
13+
* or `uv venv env`
1314
2. Run `source env/bin/activate` (activates the virtual environment)
1415
3. Run `python3 -m pip install -e ".[test]"` (installs the package in develop mode, along with test dependencies)
16+
* or `uv pip install -e ".[test]"`
1517
4. Run `make test`
1618
1. To run a specific test do `pytest -k test_no_api_key`
1719

posthog/client.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,30 @@ def get_os_info():
3939
os_version = ""
4040

4141
# Windows
42-
if sys.platform.startswith('win'):
42+
if sys.platform.startswith("win"):
4343
os_name = "Windows"
44-
if hasattr(platform, 'win32_ver'):
44+
if hasattr(platform, "win32_ver"):
4545
win_version = platform.win32_ver()[0]
4646
if win_version:
4747
os_version = win_version
4848

4949
# macOS/Mac OS X
50-
elif sys.platform == 'darwin':
50+
elif sys.platform == "darwin":
5151
os_name = "Mac OS X"
52-
if hasattr(platform, 'mac_ver'):
52+
if hasattr(platform, "mac_ver"):
5353
mac_version = platform.mac_ver()[0]
5454
if mac_version:
5555
os_version = mac_version
5656

5757
# iOS (unlikely in standard Python but included for completeness)
58-
elif sys.platform == 'ios':
58+
elif sys.platform == "ios":
5959
os_name = "iOS"
6060
# iOS version would need a specific approach
6161

6262
# Linux
63-
elif sys.platform.startswith('linux'):
63+
elif sys.platform.startswith("linux"):
6464
os_name = "Linux"
65-
if hasattr(platform, 'linux_distribution'):
65+
if hasattr(platform, "linux_distribution"):
6666
# Deprecated in Python 3.8+
6767
try:
6868
linux_info = platform.linux_distribution()
@@ -73,30 +73,31 @@ def get_os_info():
7373
# For newer Python versions
7474
try:
7575
import distro
76+
7677
linux_info = distro.info()
77-
if linux_info['version']:
78-
os_version = linux_info['version']
78+
if linux_info["version"]:
79+
os_version = linux_info["version"]
7980
except ImportError:
8081
pass
8182

8283
# FreeBSD
83-
elif sys.platform.startswith('freebsd'):
84+
elif sys.platform.startswith("freebsd"):
8485
os_name = "FreeBSD"
85-
if hasattr(platform, 'release'):
86+
if hasattr(platform, "release"):
8687
os_version = platform.release()
8788

8889
# Other platforms
8990
else:
9091
os_name = sys.platform
91-
if hasattr(platform, 'release'):
92+
if hasattr(platform, "release"):
9293
os_version = platform.release()
9394

9495
return os_name, os_version
9596

9697

9798
def system_context() -> dict[str, any]:
9899
os_name, os_version = get_os_info()
99-
100+
100101
return {
101102
"$python_runtime": platform.python_implementation(),
102103
"$python_version": "%s.%s.%s" % (sys.version_info[:3]),

0 commit comments

Comments
 (0)