|
| 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 | +``` |
0 commit comments