Reprompt Python SDK
A modern, type-safe Python client for the Reprompt Place Enrichment API. This read-only SDK provides access to jobs and batches data with full async support, parallel processing, and automatic request/response validation.
Installation
pip install reprompt
Development
Quick Start
pip install -e ".[test]"
tox -e lint,type,py312,build
Manual Commands
pytest
pytest -m integration
pytest tests/test_client.py
black src tests
flake8 src
pylint src/reprompt
pyright src
flit build
Quick Start
from reprompt import RepromptClient
with RepromptClient(api_key="your-api-key", org_slug="your-org-slug") as client:
batches = client.batches.list_batches()
for batch in batches:
print(f"Batch: {batch.batch_name} - {batch.status}")
batch = client.batches.get_batch("batch-id")
print(f"Batch status: {batch.status}")
jobs = client.jobs.get_jobs_by_batch_id("batch-id")
for job in jobs:
print(f"Job: {job.place_id} - {job.status}")
job = client.jobs.get_job("place-id")
print(f"Job status: {job.status}")
API Reference
Jobs (Read-Only)
client.jobs.get_jobs_by_batch_id(batch_id) - Iterator over jobs in a batch (auto-paginated)
client.jobs.get_job(place_id) - Get specific job details
Batches (Read-Only)
client.batches.list_batches(query=None) - Iterator over all batches (auto-paginated)
client.batches.get_batch(batch_id) - Get batch details
Client
RepromptClient(api_key, org_slug, base_url="https://api.repromptai.com/v1", timeout=30.0, readonly=True)
Models & Error Handling
Key Models: BatchJob, PlaceJobResult, JobListResponse, PaginatedBatchesResponse
Errors: Import RepromptAPIError for API error handling. Client raises ValueError for config errors.
Legacy: Use init(api_key, org_slug, debug=False) for backward compatibility.
CLI
Set credentials: export REPROMPT_API_KEY="key" export REPROMPT_ORG_SLUG="org"
Jobs: reprompt jobs {list,get} [options]
Batches: reprompt batches {list,get} [options]
Output: --output {pretty,json,jsonl,csv} (default: pretty)
reprompt batches list --output json
reprompt batches list --output jsonl
reprompt batches list --output csv
reprompt jobs list --batch-id batch_123 --output csv
Examples
See the examples/ directory for complete working examples:
list_batches_example.ipynb: Jupyter notebook showing batch operations
cli_test.sh: CLI usage examples
Built with httpx, Pydantic v2, and auto-generated OpenAPI models.
Contributing
- Fork the repository
- Create a feature branch
- Make changes and add tests
- Run tests:
python -m pytest tests/
- Submit a pull request
Development Tooling
This project is based on the Microsoft Python Package Template, which provides a modern Python development setup with automated CI/CD, testing, and code quality tools.
Build System
- Flit: Modern PEP 517 build backend for pure Python packages
- pyproject.toml: Single source of truth for all project metadata and tool configuration (PEP 621)
- Tox: Test automation across Python versions (3.10, 3.11, 3.12)
Code Quality Tools
- Black: Opinionated code formatter (120 char line length)
- Flake8: Style guide enforcement with flake8-bugbear plugin
- Pylint: Static code analysis for errors and code smells
- Pyright: Microsoft's type checker for Python
- Bandit: Security vulnerability scanner
Testing
- Pytest: Test framework with coverage reporting
- pytest-cov: Coverage plugin with 20% minimum threshold
- pytest-mock: Mock object library
- Test markers:
unit, integration, spark, slow
CI/CD
- GitHub Actions: Automated validation and publishing workflows
- Pre-commit hooks: Local checks before committing
- Matrix testing across multiple Python versions
Quick CI Command
Run the complete CI pipeline locally with a single command:
pip install tox
tox -e lint,type,py312,build
This runs:
- lint: Black formatting check, Flake8 style check, Pylint analysis
- type: Pyright type checking
- py312: Unit tests with pytest on Python 3.12
- build: Package build with Flit
Individual Tox Environments
tox -e py
tox -e integration
tox -e spark
tox -e format
tox -e generate-models
License
This project uses the same license as the original Microsoft Python package template.