Skip to content

Commit 6a8d667

Browse files
authored
Merge pull request #29 from Zipstack/feat/UN-3232-FEAT_implement_backoff_retry_mechanism
UN-3232 [FEAT] Implement back-off retry mechanism with deadline-aware timeout budgeting
2 parents d166fe2 + d0f66bd commit 6a8d667

8 files changed

Lines changed: 787 additions & 268 deletions

File tree

CONTRIBUTING.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Contributing
2+
3+
Guide for setting up a local development environment and running tests.
4+
5+
## Prerequisites
6+
7+
- Python 3.12+
8+
- [uv](https://docs.astral.sh/uv/) (recommended) or `pip`
9+
10+
## Setup
11+
12+
```bash
13+
git clone https://github.com/Zipstack/llm-whisperer-python-client.git
14+
cd llm-whisperer-python-client
15+
16+
# Create a virtual environment and install all dependencies
17+
uv sync --group dev --group test
18+
19+
# Either prefix commands with `uv run` (used throughout this guide),
20+
# or activate the venv manually:
21+
# source .venv/bin/activate # Linux / macOS
22+
# .venv\Scripts\activate # Windows
23+
```
24+
25+
If you prefer pip:
26+
27+
```bash
28+
python -m venv .venv
29+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
30+
pip install -e ".[dev,test]"
31+
```
32+
33+
## Environment variables
34+
35+
The project uses [`pytest-dotenv`](https://pypi.org/project/pytest-dotenv/) to auto-load environment variables from a `.env` file in the project root.
36+
37+
```bash
38+
cp sample.env .env
39+
```
40+
41+
Edit `.env` and fill in your API key:
42+
43+
| Variable | Description | Required for |
44+
|---|---|---|
45+
| `LLMWHISPERER_BASE_URL_V2` | API base URL (v2) | Integration tests |
46+
| `LLMWHISPERER_API_KEY` | Your LLMWhisperer API key | Integration tests |
47+
| `LLMWHISPERER_LOG_LEVEL` | Log level (`DEBUG`, `INFO`, etc.) | Optional |
48+
49+
Unit tests are fully mocked and do **not** require a `.env` file or API key.
50+
51+
## Running tests
52+
53+
### Unit tests (no API key needed)
54+
55+
```bash
56+
uv run pytest tests/unit/ -v
57+
```
58+
59+
### Integration tests (requires valid `.env`)
60+
61+
```bash
62+
uv run pytest tests/integration/ -v
63+
```
64+
65+
### All tests
66+
67+
```bash
68+
uv run pytest -v
69+
```
70+
71+
### Via tox
72+
73+
```bash
74+
uv run tox
75+
```
76+
77+
This runs tests under Python 3.12 using `uv sync --group test` to install dependencies.
78+
79+
### Via poe
80+
81+
```bash
82+
uv run poe test
83+
```
84+
85+
## Linting and formatting
86+
87+
The project uses [ruff](https://docs.astral.sh/ruff/) for linting and formatting (configured in `pyproject.toml`).
88+
89+
```bash
90+
# Lint
91+
uv run ruff check src/ tests/
92+
93+
# Auto-fix lint issues
94+
uv run ruff check --fix src/ tests/
95+
96+
# Format
97+
uv run ruff format src/ tests/
98+
```
99+
100+
## Project structure
101+
102+
```
103+
src/unstract/llmwhisperer/
104+
__init__.py # Package version
105+
client_v2.py # Main client (LLMWhispererClientV2)
106+
utils.py # Utility helpers
107+
108+
tests/
109+
conftest.py # Shared fixtures
110+
unit/ # Mocked tests (no network calls)
111+
integration/ # Tests against the live API
112+
test_data/ # Sample files used by tests
113+
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ classifiers = [
1818
"Topic :: Software Development :: Libraries :: Python Modules",
1919
]
2020
requires-python = ">=3.12"
21-
dependencies = ["requests>=2"]
21+
dependencies = ["requests>=2", "tenacity>=8.0"]
2222

2323
[dependency-groups]
2424
test = [

0 commit comments

Comments
 (0)