Reprompt
Project description
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
# Install with test dependencies
pip install -e ".[test]"
# Run the complete CI pipeline locally (equivalent to GitHub Actions)
tox -e lint,type,py312,build
Manual Commands
# Testing
pytest # Run unit tests
pytest -m integration # Run integration tests
pytest tests/test_client.py # Run specific test file
# Code Quality
black src tests # Format code
flake8 src # Style checking
pylint src/reprompt # Linting
pyright src # Type checking
# Building
flit build # Build wheel and sdist
Quick Start
from reprompt import RepromptClient
# Read data from Reprompt API (recommended: use context manager)
with RepromptClient(api_key="your-api-key", org_slug="your-org-slug") as client:
# List all batches
batches = client.batches.list_batches()
for batch in batches:
print(f"Batch: {batch.batch_name} - {batch.status}")
# Get batch details
batch = client.batches.get_batch("batch-id")
print(f"Batch status: {batch.status}")
# List jobs from a specific batch
jobs = client.jobs.get_jobs_by_batch_id("batch-id")
for job in jobs:
print(f"Job: {job.place_id} - {job.status}")
# Get a specific job
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)
# List batches in different formats
reprompt batches list --output json # JSON array
reprompt batches list --output jsonl # JSON Lines (one object per line)
reprompt batches list --output csv # CSV format
# List jobs from a batch
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 operationscli_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:
# Install tox if needed
pip install tox
# Run all CI checks (equivalent to GitHub Actions)
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 # Test on current Python version
tox -e integration # Integration tests
tox -e spark # Spark tests
tox -e format # Auto-format with Black
tox -e generate-models # Regenerate OpenAPI models
License
This project uses the same license as the original Microsoft Python package template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reprompt-0.0.12.0.tar.gz.
File metadata
- Download URL: reprompt-0.0.12.0.tar.gz
- Upload date:
- Size: 99.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67fd202758c7409b42028b20467fe67c18152ba3c6651353da52014973b4910b
|
|
| MD5 |
e0c29da2f3f256bad22ee26826e74c4f
|
|
| BLAKE2b-256 |
65a6ab4712065d94d424b98d5e4fe8823eee5b30d26b3998859fb46fe49de4e4
|
File details
Details for the file reprompt-0.0.12.0-py3-none-any.whl.
File metadata
- Download URL: reprompt-0.0.12.0-py3-none-any.whl
- Upload date:
- Size: 34.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d684ddd939567930466e038b637fb3f84624a34f0a5ff9d6a4d3a276105b648
|
|
| MD5 |
a28f891a749c1d011a37fafef29e810f
|
|
| BLAKE2b-256 |
1946b2705d25e44faa182afb0d61be6dd1d62a89e5f1b7bb2c166ac33a110f14
|