Metadata-Version: 2.4
Name: redlens
Version: 0.2.0
Summary: Archive any Reddit user's public history into a local SQLite database you own, and analyze it
License-Expression: MIT
Project-URL: Homepage, https://github.com/TheWeiHu/redlens
Project-URL: Issues, https://github.com/TheWeiHu/redlens/issues
Project-URL: Changelog, https://github.com/TheWeiHu/redlens/blob/main/CHANGELOG.md
Keywords: reddit,archive,analytics,sqlite,arctic-shift
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Database
Classifier: Topic :: Internet
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: platformdirs>=4
Requires-Dist: sqlmodel>=0.0.14
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Dynamic: license-file

# redlens

Archive and analyze public Reddit history, locally. Built on
[arctic-shift](https://arctic-shift.photon-reddit.com). Three tables
(users, posts, comments), one derived analytic, one fetch function, one
CLI. Your data stays in a local SQLite file you own.

*The name: a lens on public discussion. Today redlens archives and
examines users; tracking topics across public discussion is where it's
headed.*

## Install

```bash
pip install -e ".[dev]"
```

## Use

```bash
redlens sync KimJongFunk              # pull from arctic
redlens analytics KimJongFunk         # print rollup
redlens analytics KimJongFunk --json  # or as JSON
redlens explore                       # browse the DB in your browser
```

No setup needed — the schema is created (and migrated) automatically on
first use.

No API keys are needed — arctic-shift is a free, open mirror. (Optional
keys for fresh-data sync via Reddit's official API and for AI profile
summaries are coming; the `redlens setup` wizard ships disabled until
they do something.)

## Data

Everything lands in one SQLite file, by default in your per-user data
directory (`~/.local/share/redlens/redlens.db` on Linux,
`~/Library/Application Support/redlens/redlens.db` on macOS).

Point elsewhere with (in order of precedence):

```bash
redlens --db /path/to/other.db sync spez      # 1. the --db flag
export REDLENS_DB=/path/to/other.db           # 2. env var
```

or set it once in `~/.config/redlens/config.toml` (3.):

```toml
[storage]
db = "/path/to/other.db"
```

## Explore

Browse the database in your browser — tables and row counts, schema, sortable
and searchable rows, and a read-only SQL console with preset analyses:

```bash
redlens explore                       # opens the default DB, pops a browser
redlens explore --port 9000 --no-browser
```

The DB is opened read-only, so nothing here can mutate it.

## Layout

```
redlens/     models, db, config, arctic client, ingest, analytics,
                 explore (the DB browser), cli
tests/           pytest, in-memory sqlite, no network
```

## Test

```bash
pytest
```
