Skip to main content

SnapIR

snapir is a python toolkit to (repeatedly) create snapshots from web search settings. This includes topic and query creation, acquisition of rankings, web pages and (synthetic) relevance judgments, ultimately building the foundation for dynamic test collections with in time relevance judgments.

Getting Started

pip install git+https://github.com/irgroup/snapir.git

Optional LLM generation dependency

topics generate, queries generate, and judgments generate require topic-gen, which is not distributed on PyPI. Install it separately in the same Python environment as SnapIR:

pip install "topic-gen @ git+https://github.com/irgroup/topic-gen.git"

For a uv-managed project, use uv add "topic-gen @ git+https://github.com/irgroup/topic-gen.git". Other commands and CLI help work without this dependency.

Commands

SnapIR
│
├── topics
│   ├── fetch-debates       Collect source debates from Eurotopics
│   ├── generate            Generate topics from debates
│   └── select              Add a topic and its queries to a curated set
│
├── queries
│   └── generate            Generate queries for topics
│
├── serps
│   └── fetch               Fetch search results for queries
│
├── documents
│   ├── scrape              Capture documents referenced by SERPs
│   ├── extract-text        Extract missing text from saved captures (incl. PDFs)
│   ├── review              Interactively inspect screenshots
│   └── clear               Remove flagged captures so the next scrape retries them
│
├── judgments
│   ├── generate            Generate LLM relevance judgments
│   ├── create-questions    Generate the SoSci question pool
│   └── questionnaire       Build a questionnaire, screenshots, and manifest
│
└── export
    ├── rankings            Export rankings as a table
    ├── answers             Export human annotations
    ├── qrels               Aggregate human assessments into TREC qrels
    ├── snapshot            Assemble a distributable temporal collection
    └── verify              Check queries → SERPs → captures → text

Configuration

Set via environment variables:

Variable Used by
SNAPIR_LLM_MODEL, SNAPIR_LLM_BASE_URL, SNAPIR_LLM_API_KEY topics generate, queries generate, judgments generate (OpenAI-compatible endpoint; gemini* models use Google GenAI, install with uv sync --extra gemini)
SNAPIR_LLM_TEMPERATURE (default 1), SNAPIR_LLM_CONCURRENCY (default 1) as above
SERPAPI_API_KEY serps fetch
BROWSER_PROFILE_DIR (default data/.browser_profile), EXTENSION_DIR (default data/extensions/idcac) documents scrape
SOSCI_EXPORT_URL default for export answers --sosci

Scheduled runs

workflows/ has example Prefect flows that grow the topic pool and take a daily snapshot, together with a prefect.yaml and a Docker setup with a server and worker. See workflows/README.md.

Example

uv run snapir topics fetch-debates --output data/debates

uv run snapir topics generate --debates data/debates/debates.json --output data/topics.jsonl --prompt data/topic-emerging-v5.yaml 

uv run snapir queries generate --debates data/debates/debates.json --topics data/topics.jsonl --output data/queries.jsonl --prompt data/queries-v5.yaml

uv run snapir topics select --queries data/queries.jsonl --topics data/topics.jsonl --output-topics data/topics-selected.jsonl --output-queries data/queries-selected.jsonl --topic-id 8719997c0e34fc72dd343b0ac7ea04dc

uv run snapir serps fetch --queries data/queries-selected.jsonl --query-id 4f17e83eaac64e08cce86d6db356c5a5 --output data/serps

uv run snapir documents scrape --serps data/serps/2026-10-26_queries-selected --output data/docs

uv run snapir documents extract-text --documents data/docs/2026-10-26

uv run snapir documents review --documents data/docs/2026-10-26 --serps data/serps/2026-10-26_queries-selected 

uv run snapir documents clear --documents data/docs/2026-10-26 --dry-run

uv run snapir export rankings --serps data/serps --output data/exports/rankings.csv

uv run snapir judgments generate --serps data/serps/2026-10-26_queries-selected --documents data/docs/2026-10-26 --topics data/topics-selected.jsonl --output data/judgments/llm

uv run snapir judgments create-questions --output data/sosci

uv run snapir judgments questionnaire --serps data/serps/2026-10-26_queries-selected --documents data/docs/2026-10-26 --topics data/topics-selected.jsonl --query-id 4f17e83eaac64e08cce86d6db356c5a5 --template data/sosci/questions-relevance.xml --template data/sosci/questions-rationale.xml --template data/sosci/questions-attention.xml --questionnaire data/sosci/questionaire.xml --train data/sosci/train.xml --output data/questionnaires

uv run snapir export answers --manifest data/questionnaires/T1-IN1 --output data/judgments/answers.csv

uv run snapir export qrels --answers data/judgments/answers-clean.csv --output data/judgments/qrels.txt

uv run snapir export snapshot --serps data/serps --documents data/docs --topics data/topics-selected.jsonl --queries data/queries-selected.jsonl --qrels data/judgments/qrels.txt --output data/exports/snapshot

uv run snapir export verify --queries data/queries-selected.jsonl --serps data/serps/2026-10-26_queries-selected --documents data/docs

Metadata

Release files for snapir 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snapir 0.1.0
File Size Uploaded Provenance Actions
snapir-0.1.0.tar.gz 411.0 kB With provenance Details for snapir-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snapir 0.1.0
File Interpreter ABI Platform Actions
snapir-0.1.0-py3-none-any.whl Python 3 none any Details for snapir-0.1.0-py3-none-any.whl

Total release size: 492.9 kB

Release files / snapir-0.1.0.tar.gz

Download URL snapir-0.1.0.tar.gz
Size 411.0 kB
Tags Source
SHA-256 checksum
How to use checksums
30f2b1c38762588760323f4be4d83a4e1ba3357365c73414bd8ca1ef13573931
BLAKE2b-256 checksum
How to use checksums
03b9e9a115142279a473efd2ce1c89e21f275b5845a1890ce48142fbca012d27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / snapir-0.1.0-py3-none-any.whl

Download URL snapir-0.1.0-py3-none-any.whl
Size 81.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0306c28e8747a9d6b2d6931f1b47f83b9c97689e27d0caa0865b36bc9abaa2d2
BLAKE2b-256 checksum
How to use checksums
ad218f6d8f4a3760ef711e8b3acf9955bdd46b0bd7e14a0b26cff0d626bbf252
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for snapir 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for snapir-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page