Metadata-Version: 2.4
Name: zerodep
Version: 0.3.0
Summary: Zero-dependency, single-file Python implementations of popular libraries
Author: Peng Ding
License-Expression: MIT
Project-URL: Documentation, https://zerodep.readthedocs.io
Project-URL: Repository, https://github.com/Oaklight/zerodep
Project-URL: Issues, https://github.com/Oaklight/zerodep/issues
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
Requires-Dist: pytest-benchmark>=4.0.0; extra == "test"
Provides-Extra: bench-aes
Requires-Dist: pycryptodome>=3.20.0; extra == "bench-aes"
Provides-Extra: bench-qr
Requires-Dist: qrcode>=7.0; extra == "bench-qr"
Requires-Dist: Pillow>=10.0.0; extra == "bench-qr"
Provides-Extra: bench-http
Requires-Dist: httpx>=0.27.0; extra == "bench-http"
Provides-Extra: bench-dotenv
Requires-Dist: python-dotenv>=1.0.0; extra == "bench-dotenv"
Provides-Extra: bench-yaml
Requires-Dist: PyYAML>=6.0; extra == "bench-yaml"
Provides-Extra: bench-jsonc
Requires-Dist: commentjson>=0.9.0; extra == "bench-jsonc"
Provides-Extra: bench-structlog
Requires-Dist: structlog>=24.0.0; extra == "bench-structlog"
Provides-Extra: bench-retry
Requires-Dist: tenacity>=8.0.0; extra == "bench-retry"
Provides-Extra: bench-toon
Requires-Dist: toon-format>=0.1.0; extra == "bench-toon"
Provides-Extra: bench-tabulate
Requires-Dist: tabulate>=0.9.0; extra == "bench-tabulate"
Provides-Extra: bench-soup
Requires-Dist: beautifulsoup4>=4.12.0; extra == "bench-soup"
Provides-Extra: bench-validate
Requires-Dist: pydantic>=2.0.0; extra == "bench-validate"
Provides-Extra: bench-sse
Requires-Dist: httpx-sse>=0.4.0; extra == "bench-sse"
Requires-Dist: httpx>=0.27.0; extra == "bench-sse"
Provides-Extra: bench-markdown
Requires-Dist: mistune>=3.0.0; extra == "bench-markdown"
Provides-Extra: bench-diff
Requires-Dist: unidiff>=0.7.0; extra == "bench-diff"
Provides-Extra: bench-scheduler
Requires-Dist: APScheduler>=3.10.0; extra == "bench-scheduler"
Requires-Dist: schedule>=1.2.0; extra == "bench-scheduler"
Requires-Dist: croniter>=1.3.0; extra == "bench-scheduler"
Provides-Extra: bench-search
Requires-Dist: rank-bm25>=0.2.2; extra == "bench-search"
Provides-Extra: bench-frontmatter
Requires-Dist: python-frontmatter>=1.1.0; extra == "bench-frontmatter"
Provides-Extra: bench-config
Requires-Dist: python-decouple>=3.8; extra == "bench-config"
Provides-Extra: bench-cache
Requires-Dist: cachetools>=5.0.0; extra == "bench-cache"
Provides-Extra: bench-xml
Requires-Dist: xmltodict>=0.13.0; extra == "bench-xml"
Provides-Extra: bench-jsonrpc
Requires-Dist: jsonrpcserver>=5.0.0; extra == "bench-jsonrpc"
Provides-Extra: bench-a2a
Requires-Dist: a2a-protocol>=0.1.0; extra == "bench-a2a"
Provides-Extra: bench-acp
Requires-Dist: agent-client-protocol>=0.9.0; extra == "bench-acp"
Provides-Extra: dev
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: ty>=0.0.24; extra == "dev"
Requires-Dist: build>=1.2.2.post1; extra == "dev"
Requires-Dist: twine>=6.1.0; extra == "dev"
Requires-Dist: zerodep[bench-a2a,bench-acp,bench-aes,bench-cache,bench-config,bench-diff,bench-dotenv,bench-frontmatter,bench-http,bench-jsonc,bench-jsonrpc,bench-markdown,bench-qr,bench-retry,bench-scheduler,bench-search,bench-soup,bench-sse,bench-structlog,bench-tabulate,bench-toon,bench-validate,bench-xml,bench-yaml,test]; extra == "dev"

# zerodep

[![PyPI](https://img.shields.io/pypi/v/zerodep?color=green)](https://pypi.org/project/zerodep/)
[![GitHub Release](https://img.shields.io/github/v/release/Oaklight/zerodep?color=green)](https://github.com/Oaklight/zerodep/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Python](https://img.shields.io/pypi/pyversions/zerodep?color=green)](https://pypi.org/project/zerodep/)
[![CI](https://img.shields.io/github/actions/workflow/status/Oaklight/zerodep/ci.yml?label=CI)](https://github.com/Oaklight/zerodep/actions/workflows/ci.yml)
[![Docs](https://img.shields.io/readthedocs/zerodep)](https://zerodep.readthedocs.io)

Zero-dependency, single-file Python implementations of popular libraries — stdlib only, Python 3.10+.

零依赖、单文件的 Python 常用库实现 —— 仅使用标准库，支持 Python 3.10+。

[English Docs](https://zerodep.readthedocs.io/en/) | [中文文档](https://zerodep.readthedocs.io/zh-cn/)

## Quick Start

```bash
pip install zerodep          # install the CLI
zerodep add yaml retry       # copy modules into your project
```

```python
from yaml import load, dump

data = load("name: Alice\nage: 30")
print(data)  # {'name': 'Alice', 'age': 30}
```

Each module is a **self-contained single `.py` file** — copy it into your project and import. No `pip install` needed at runtime.

## Modules

**Agent Protocols**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `jsonrpc/` | JSON-RPC 2.0 protocol: data types, dispatcher, async transport | `jsonrpcserver` |
| `a2a/` | Google A2A protocol: JSON-RPC 2.0, SSE streaming, task management | `a2a-python` |
| `acp/` | Anthropic ACP protocol: JSON-RPC 2.0 over stdio, async client/agent | `acp-python` |
| `skills/` | Agent Skills runtime: parse, discover, manage, select skills | — |

**Web & Networking**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `httpclient/` | Sync + async REST client with connection pooling, proxy, and auth | `httpx` |
| `sse/` | Server-Sent Events client with auto-reconnect | `httpx-sse` |

**Data Formats**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `xml/` | XML ↔ dict converter with fault-tolerant parsing and LLM tag extraction | `xmltodict` |
| `yaml/` | YAML parser and serializer (common subset) | `PyYAML` |
| `jsonc/` | JSONC parser (JSON with comments and trailing commas) | `commentjson` |
| `toon/` | TOON (Token-Oriented Object Notation) encoder/decoder | `toon_format` |
| `frontmatter/` | Frontmatter parser and serializer (YAML/TOML/JSON) | `python-frontmatter` |

**Data Validation**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `validate/` | Runtime TypedDict/dataclass validator with JSON Schema generation | `pydantic` |

**Text & Markup**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `markdown/` | Markdown → HTML renderer (CommonMark subset + GFM tables) | `mistune` |
| `soup/` | HTML parser with BeautifulSoup-like API (find, select, CSS selectors) | `beautifulsoup4` |
| `diff/` | Unified diff parser, patch apply/reverse, three-way merge | `unidiff` |

**Search & Retrieval**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `search/` | BM25/BM25+/BM25L/BM25F + TF-IDF full-text search with Bayesian calibration | `rank-bm25` |

**Configuration**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `dotenv/` | .env file parser (load_dotenv, dotenv_values) | `python-dotenv` |
| `config/` | Unified config loader (env vars, .env, JSON/YAML/TOML/INI) | `python-decouple` |

**CLI & Terminal**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `ansi/` | ANSI terminal styling: colors, attributes, detection, strip/visible_len | — |
| `tabulate/` | Table formatting with multiple output styles | `tabulate` |
| `prompt/` | Interactive CLI prompts (confirm, select, text) | `questionary` |

**Security**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `aes/` | AES encryption: ECB, CBC, CTR, GCM modes (pure Python + OpenSSL via ctypes) | `pycryptodome` |

**Infrastructure & Tools**

| Module | Description | Benchmark Against |
|--------|-------------|-------------------|
| `cache/` | In-memory cache with TTL, LRU/LFU eviction, sync + async decorators | — |
| `retry/` | Retry decorator with configurable backoff strategies | `tenacity` |
| `scheduler/` | In-process task scheduler with cron, interval, one-shot triggers | `APScheduler` |
| `structlog/` | Structured logging with pretty console output | `structlog` |
| `runner/` | Structured subprocess execution with timeout escalation | — |
| `vcs/` | Git/Hg/Jujutsu CLI wrapper (diff, status, log, blame) | — |
| `filelock/` | Cross-platform advisory file lock (fcntl/msvcrt) | — |
| `qr/` | QR Code generation with terminal rendering | `qrcode` |

## Documentation

- **English**: [zerodep.readthedocs.io/en/](https://zerodep.readthedocs.io/en/)
- **中文**: [zerodep.readthedocs.io/zh-cn/](https://zerodep.readthedocs.io/zh-cn/)

## License

[MIT](LICENSE)
