# TrendRadar Dependencies: Complete Guide to Python Libraries and Their Use

> Explore TrendRadar Python dependencies like requests, litellm, feedparser, and boto3. Understand core libraries and their specific versions for reproducible builds.

- Repository: [sansan/TrendRadar](https://github.com/sansan0/TrendRadar)
- Tags: best-practices
- Published: 2026-04-22

---

**TrendRadar depends on eleven core Python libraries including `requests` for HTTP, `litellm` for AI integration, `feedparser` for RSS, and `boto3` for AWS services, all pinned to exact versions for reproducible builds.**

TrendRadar is a Python 3.12+ application that combines web crawling, RSS aggregation, AI-powered analysis, and multi-channel notifications. Understanding the **TrendRadar dependencies** is essential for developers who want to install, extend, or troubleshoot the project. This guide breaks down each library, its specific purpose, and how it's implemented in the codebase.

## Core HTTP and Networking Dependencies

### requests (2.33.0)

The **`requests`** library serves as the primary HTTP client across TrendRadar. It's used for fetching web pages, checking version endpoints, and retrieving remote resources.

In [`trendradar/__main__.py`](https://github.com/sansan0/TrendRadar/blob/main/trendradar/__main__.py), `requests` is combined with **`tenacity`** to implement robust retry logic:

```python
from tenacity import retry, wait_exponential, stop_after_attempt
import requests

@retry(wait=wait_exponential(multiplier=1, min=2, max=10), stop=stop_after_attempt(3))
def fetch_url(url: str) -> str:
    response = requests.get(url, timeout=5, headers={"User-Agent": "TrendRadar/6.6.1"})
    response.raise_for_status()
    return response.text

```

### tenacity (8.5.0)

**`tenacity`** provides exponential backoff retry logic for network calls. This is critical for handling transient failures when fetching remote version information or crawling unstable websites.

### websockets (13.1)

The **`websockets`** library enables real-time push notifications when a webhook URL is configured. This is implemented in [`trendradar/notification/dispatcher.py`](https://github.com/sansan0/TrendRadar/blob/main/trendradar/notification/dispatcher.py) for WebSocket-based alert delivery.

## Data Processing and Configuration Dependencies

### PyYAML (6.0.3)

**`PyYAML`** loads YAML configuration files from the `config/*.yaml` directory. The configuration parser uses `yaml.safe_load()` for secure parsing:

```python
import yaml
from pathlib import Path

config_path = Path("config/config.yaml")
config = yaml.safe_load(config_path.read_text(encoding="utf-8"))
print("Configured platforms:", [p["name"] for p in config["PLATFORMS"]])

```

### pytz (2026.1)

**`pytz`** handles timezone conversions, ensuring timestamps are correctly interpreted according to the `TIMEZONE` configuration setting. Centralized timezone utilities are found in [`trendradar/utils/time.py`](https://github.com/sansan0/TrendRadar/blob/main/trendradar/utils/time.py).

### json-repair (0.58.6)

**`json-repair`** fixes malformed JSON returned from LLMs before parsing. This defensive programming is essential in [`trendradar/ai/client.py`](https://github.com/sansan0/TrendRadar/blob/main/trendradar/ai/client.py):

```python
import json_repair

bad_json = '{"name": "TrendRadar", "version": 6.6.1,}'  # trailing comma

fixed = json_repair.repair_json_string(bad_json)
data = json.loads(fixed)
print("Recovered JSON:", data)

```

## AI and Content Analysis Dependencies

### litellm (1.82.6)

**`litellm`** is the unified client for large language model APIs. It supports OpenAI, Anthropic Claude, Google Gemini, and other providers through a consistent interface. This powers TrendRadar's AI analysis and translation pipelines:

```python
import litellm

response = litellm.completion(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Summarize the latest tech news in 2 sentences."}],
    temperature=0.2,
)

print("AI summary:", response.choices[0].message.content)

```

## RSS and Feed Processing Dependencies

### feedparser (6.0.12)

**`feedparser`** parses RSS and Atom feeds for TrendRadar's optional RSS aggregation feature. The implementation in [`trendradar/crawler/rss/fetcher.py`](https://github.com/sansan0/TrendRadar/blob/main/trendradar/crawler/rss/fetcher.py) handles feed normalization:

```python
import feedparser

feed = feedparser.parse("https://hnrss.org/frontpage")
for entry in feed.entries[:5]:
    print(f"- {entry.title} ({entry.published})")

```

## Cloud and Storage Dependencies

### boto3 (1.42.76)

**`boto3`** is the AWS SDK for Python. TrendRadar uses it for optional S3 storage backends and AWS notification integrations (SNS/SQS). The storage layer is implemented in [`trendradar/storage/remote.py`](https://github.com/sansan0/TrendRadar/blob/main/trendradar/storage/remote.py) and the notification dispatcher:

```python
import boto3
from io import BytesIO

s3 = boto3.client("s3")
payload = b"sample news data"
s3.upload_fileobj(BytesIO(payload), Bucket="my-trendradar-bucket", Key="snapshot.txt")
print("Uploaded to S3")

```

## Dependency Declaration Files

TrendRadar declares its dependencies in two locations for maximum compatibility:

| File | Purpose |
|------|---------|
| **[`requirements.txt`](https://github.com/sansan0/TrendRadar/blob/main/requirements.txt)** | Standard pip installation: `pip install -r requirements.txt` |
| **[`pyproject.toml`](https://github.com/sansan0/TrendRadar/blob/main/pyproject.toml)** | Modern Python packaging with `trendradar` CLI entry-point |

Both files specify identical pinned versions, ensuring **reproducible builds** across development and production environments.

## How Dependencies Map to Core Features

| TrendRadar Feature | Primary Dependencies |
|-------------------|----------------------|
| Web crawling & HTTP requests | `requests`, `tenacity` |
| Configuration management | `PyYAML` |
| Timezone handling | `pytz` |
| RSS feed aggregation | `feedparser` |
| AI analysis & translation | `litellm`, `json-repair` |
| Real-time notifications | `websockets` |
| AWS cloud storage | `boto3` |
| MCP protocol support | `fastmcp` |

## Summary

- **TrendRadar dependencies** are declared in both [`requirements.txt`](https://github.com/sansan0/TrendRadar/blob/main/requirements.txt) and [`pyproject.toml`](https://github.com/sansan0/TrendRadar/blob/main/pyproject.toml) with identical pinned versions
- **Core networking**: `requests` (HTTP) + `tenacity` (retries) + `websockets` (real-time)
- **Data processing**: `PyYAML` (config), `pytz` (timezones), `json-repair` (LLM output fixing)
- **Content sources**: `feedparser` (RSS), `fastmcp` (MCP protocol)
- **AI layer**: `litellm` unified LLM client
- **Cloud integration**: `boto3` for AWS services

## Frequently Asked Questions

### What Python version does TrendRadar require?

TrendRadar requires **Python 3.12 or higher**. This is specified in the project metadata and ensures compatibility with modern async features and type hinting used throughout the codebase.

### Can I install TrendRadar without AWS dependencies?

Yes. While `boto3` is listed as a core dependency, AWS functionality is **optional** and only activated when S3 buckets or SNS/SQS are explicitly configured. The application runs fully without AWS credentials for local RSS crawling and AI analysis.

### Why are dependencies pinned to exact versions?

All **TrendRadar dependencies** use exact version pins (e.g., `requests==2.33.0`) to guarantee **reproducible builds**. This prevents breaking changes from upstream updates and ensures consistent behavior across development, CI, and production deployments.