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 |
SNAPIR_ROBOTS_USER_AGENT (default SnapIR) — robots.txt group to obey; disable the check with --ignore-robots |
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| snapir-0.1.1.tar.gz | 416.9 kB | With provenance | Details for snapir-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| snapir-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for snapir-0.1.1-py3-none-any.whl |
Total release size: 498.3 kB
Release files / snapir-0.1.1.tar.gz
| Download URL | snapir-0.1.1.tar.gz |
|---|---|
| Size | 416.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e63444d864f80a93b198b3b820f4fa50d4a6ca420b0329654fededbb9466931
|
|
BLAKE2b-256 checksum How to use checksums |
954aa3c1c86c318e4eb2c3adac7e94eb8e8a24c06e5c2cc88bed3f502f8f700f
|
| 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 logRelease files / snapir-0.1.1-py3-none-any.whl
| Download URL | snapir-0.1.1-py3-none-any.whl |
|---|---|
| Size | 81.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d080ed70c696ef95197786e572e54754c92b21b64f0bbab08f90c7978031b55d
|
|
BLAKE2b-256 checksum How to use checksums |
4fc92d5570b1fec06824cf9dfa90bb74e1e2698218320e31454ebd18fe52bbb8
|
| 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 logSecurity for snapir 0.1.1
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.
Attestation for snapir-0.1.1.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 logA 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.