Metadata-Version: 2.5
Name: zenx-lite
Version: 0.3.0
Summary: An explicitly composed asyncio scraping runtime
Requires-Python: >=3.15
Requires-Dist: curl-cffi-patch<0.17,>=0.16.4
Requires-Dist: orjson>=3.10
Requires-Dist: parsel>=1.12.1
Requires-Dist: pyyaml<7,>=6
Requires-Dist: structlog<27,>=26.1
Provides-Extra: source
Requires-Dist: websockets<18,>=15; extra == 'source'
Description-Content-Type: text/markdown

# ZenX Lite

ZenX Lite is a Python scraping runtime. Your spiders fetch and parse data. The runtime handles scheduling, HTTP sessions, deduplication, and delivery.

## Quickstart

1. **Create a project with [uv](https://docs.astral.sh/uv/).** ZenX Lite requires Python 3.15 or newer.

   ```bash
   uv init --bare --python 3.15.2 example-scraper
   cd example-scraper
   uv add zenx-lite
   ```

2. **Add the spider.** Create `spiders/` with an empty `__init__.py`. Save this as `spiders/example.py`.

   ```python
   from zenx_lite import Crawler


   class ExampleSpider:
       name = "example"

       async def crawl(self, crawler: Crawler) -> None:
           response = await crawler.request("https://example.com/", timeout=10)
           if response.status != 200:
               raise RuntimeError(f"HTTP {response.status}")
           title = response.xpath("//title/text()").get()
           await crawler.emit(response.url, {"url": response.url, "title": title})
   ```

3. **Set up the application.** Save this as `main.py`.

   ```python
   import sys

   from zenx_lite import App
   from zenx_lite.destinations.jsonl import JSONLines

   from spiders.example import ExampleSpider


   if __name__ == "__main__":
       App(
           project_name="example-scraper",
           spiders=[ExampleSpider()],
           destinations={"stdout": JSONLines(sys.stdout)},
           routes={"example": ("stdout",)},
       ).cli()
   ```

4. **Run one crawl and exit.**

   ```bash
   uv run main.py --spider example --once
   ```

   ```json
   {"url":"https://example.com/","title":"Example Domain"}
   ```

Use `--log-level DEBUG` to increase log verbosity. [Logging options](.agents/skills/zenx-lite/references/crawl-and-runtime.md#logging)

## Recommended project structure

Put the app setup in `main.py` and the crawl logic in `spiders/`.

```text
my-scraper/
├── .gitignore
├── pyproject.toml
├── uv.lock
├── main.py
└── spiders/
    ├── __init__.py
    └── example.py
```

Commit `uv.lock` for reproducible installs. For YAML configuration, register your spider factories explicitly with `run_from_config()` in `main.py`. [Configuration examples](.agents/skills/zenx-lite/references/configuration-and-instances.md#standard-project-structure)
