Metadata-Version: 2.4
Name: hlrun
Version: 0.0.4
Requires-Dist: tomli>=1.1.0 ; python_full_version < '3.11'
Requires-Dist: pyo3-stubgen>=0.3 ; extra == 'dev'
Provides-Extra: dev
License-File: LICENSE
Summary: hlrun
Author-email: lerogo <lerogohl@gmail.com>
License-Expression: BSD-3-Clause
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# hlrun

Python package with a Rust native extension ([maturin](https://www.maturin.rs/) + [PyO3](https://pyo3.rs/)).

- **Rust** — performance-critical primitives (streaming inspection of huge JSON/JSONL files).
- **Python** — task workflows (notifications & image uploads).

## Install

```bash
maturin develop    # build the Rust extension
```

## Usage

```bash
hlrun json count data.jsonl        # number of records
hlrun json schema data.json        # inferred structure (sampled)
hlrun amap send --title Hi --text ok  # send a markdown message
hlrun amap upload photo.png        # upload an image, print its URL
hlrun config show                  # show loaded config files
hlrun config set my.toml           # install my.toml to ~/.hlrun/config.toml
```

```python
from hlrun.lib._hlrun import bigjson
from hlrun.work.amap import notice, image

bigjson.count("big.json")               # record count
bigjson.schema("big.jsonl", sample=50)  # inferred structure
bigjson.load("big.json")                # parse fully, like json.load

it = bigjson.iter_records("big.jsonl")  # constant-memory streaming
for rec in it:
    pct = it.bytes_read / it.total_bytes  # progress, e.g. for a progress bar
    ...

notice.send_dd_msg("标题", "**正文**")
image.pic_path_to_url("photo.png")
```

## Configuration

Secrets are never hardcoded. Config is merged from three sources (later wins):

1. `~/.hlrun/config.toml`
2. `<project>/.hlrun/config.toml` (found by walking up from the CWD)
3. `HLRUN_*` environment variables, e.g. `HLRUN_WORK__AMAP__DINGTALK__SECRET`

Copy `.hlrun/config.example.toml` to `.hlrun/config.toml` and fill in values.

## Type stubs

The `.pyi` files under `src/hlrun/lib/_hlrun/` are auto-generated — do not edit
by hand. Regenerate after rebuilding when a `#[pyfunction]` signature changes:

```bash
maturin develop
# needs: pip install -e ".[dev]"
python scripts/gen_stubs.py
```

