Skip to content

Commit 1d6788b

Browse files
fixes
1 parent c094f1c commit 1d6788b

File tree

2 files changed

+91
-2
lines changed

2 files changed

+91
-2
lines changed

DEVELOPMENT.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Development Guide
2+
3+
This document explains how to set up the superclient library for local development.
4+
5+
## Local Installation
6+
7+
### Step 1: Clone the Repository
8+
9+
```bash
10+
git clone https://github.com/superstreamlabs/superclient-python.git
11+
cd superclient-python
12+
```
13+
14+
### Step 2: Create a Virtual Environment (Recommended)
15+
16+
```bash
17+
python -m venv venv
18+
source venv/bin/activate # On Windows: venv\Scripts\activate
19+
```
20+
21+
### Step 3: Install in Development Mode
22+
23+
```bash
24+
pip install -e .
25+
```
26+
27+
This installs the package in "editable" mode, which means:
28+
- Changes to the source code are immediately reflected without reinstalling
29+
- The package is installed in your Python environment
30+
- You can import and use the package normally
31+
32+
### Step 4: Enable Automatic Loading
33+
34+
To test the automatic loading functionality:
35+
36+
```bash
37+
python -m superclient install_pth
38+
```
39+
40+
This installs the `.pth` file that enables automatic loading when Python starts.
41+
42+
## Development Workflow
43+
44+
### Making Changes
45+
46+
1. Edit the source code in the `superclient/` directory
47+
2. Changes are immediately available (no reinstallation needed)
48+
3. Test your changes by running examples or your own code
49+
50+
### Running Examples
51+
52+
```bash
53+
# Run a kafka-python example
54+
python examples/kafkapy/apache.py
55+
56+
# Run an aiokafka example
57+
python examples/aiokafka/apache.py
58+
59+
# Run a confluent-kafka example
60+
python examples/confluent_kafka/apache.py
61+
```
62+
63+
## Uninstallation
64+
65+
### Step 1: Remove the .pth File (if installed)
66+
67+
```bash
68+
# Find and remove the .pth file
69+
find /path/to/your/venv/lib/python*/site-packages -name "superclient-init.pth" -delete
70+
```
71+
72+
Or manually remove it from your site-packages directory.
73+
74+
### Step 2: Uninstall the Package
75+
76+
```bash
77+
pip uninstall superclient
78+
```
79+
80+
### Step 3: Clean Up Build Artifacts
81+
82+
```bash
83+
# Remove build directories
84+
rm -rf build/ dist/ superclient.egg-info/
85+
86+
# Remove any cached Python files
87+
find . -name "*.pyc" -delete
88+
find . -name "__pycache__" -type d -exec rm -rf {} +
89+
```

superclient/agent/tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Heartbeat(threading.Thread):
8282

8383
def __init__(self):
8484
super().__init__(name="superstream-heartbeat", daemon=True)
85-
self._stop = threading.Event()
85+
self._stop_event = threading.Event()
8686

8787
@classmethod
8888
def ensure(cls):
@@ -107,7 +107,7 @@ def unregister_tracker(cls, tracker_id: str):
107107

108108
def run(self):
109109
"""Main heartbeat loop."""
110-
while not self._stop.is_set():
110+
while not self._stop_event.is_set():
111111
now = time.time()
112112
with self._track_lock:
113113
trackers = list(self._trackers.values())

0 commit comments

Comments
 (0)