Skip to main content Switch to mobile version picsha 0.3.1 Official Python SDK for Picsha AI - Store, Encode, Understand.
pip install picsha==0.3.1 Copy PIP instructions
The official Python client for Picsha AI. Designed specifically for data scientists, computational biologists, and ML engineers.
We recommend using poetry:
pip install picsha Requires Python 3.9 or later.
import picsha # Or set the PICSHA_API_KEY environment variable and call picsha.Client() client = picsha.Client(api_key="sk_your_key_here") # 1. Semantic Search results = client.search( query="fluorescent cancer cell cultures", mode="ai" # Matches on meaning as well as words ) # 2. Get transformed URLs for ML pipelines for asset in results.assets: url = asset.generate_url(width=512, height=512, fit="cover", format="webp") print(url) Uploading
result = client.upload( "./data/sample_01.heic", tags=["assay:123", "fluorescent"], metadata={"experiment": "alpha"}, ) print(result.id) # Analysis runs in the background. Check on it: asset = client.get_asset(result.id) print(asset.status) Files up to 95 MB are sent through the API. Larger files, up to 5 GiB, go straight to storage with a signed URL; the call is the same.
results = client.search( "fluorescent cells", mode="ai", # or "standard": words in names, tags and metadata limit=20, page=1, filters={"type": "image", "metadata": {"experiment": "alpha"}}, ) print(results.total_count, results.has_more) for asset in results.assets: print(asset.id, asset.original_filename, asset.match_score) threshold, min_similarity and sort are optional; the API's defaults apply when you leave them out.
page = client.list_assets(type="image", tag="assay:123", limit=50) for asset in page.assets: print(asset.id, asset.original_filename) Delivery URLs
asset.generate_url(...) builds a URL that resizes and converts the asset on the fly. No request is made until you fetch it.
asset.generate_url(width=512, format="jpeg", quality=80) # https://api.picsha.ai/v1/assets/ /render?w=512&fmt=jpeg&q=80 width, height, format, quality, aspect_ratio, position, radius, background, kernel, watermark and watermark_position are mapped to the API's parameter names. Any other keyword is sent as given, so the API's own names (w, h, fmt, fit, ...) work too.
Resizing, cropping, format conversion and watermarks are public URLs. Generative edits need a signed URL.
For high-throughput workloads, an AsyncClient with the same methods is included out-of-the-box:
import picsha import asyncio async def main(): async with picsha.AsyncClient(api_key="sk_your_key_here") as client: result = await client.search(query="cancer cells", mode="ai") print(f"Found {result.total_count} assets.") asyncio.run(main()) Errors
try: client.get_asset("does-not-exist") except picsha.PicshaAuthError as err: # 401: the key is wrong. 403: the key lacks access. print(err.status_code, err.details) except picsha.PicshaAPIError as err: print(err.status_code, err.details) Development
poetry install poetry run pytest See the notebooks/ directory for a full example.
Programming Language Python :: 3
Release files for picsha 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 17.3 kB
Release files / picsha-0.3.1.tar.gz
Release files / picsha-0.3.1-py3-none-any.whl
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.
None of the files in this release were uploaded with provenance metadata.
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.
Release history Release notifications | RSS feed
Dec 3, 2026 2 release files No provenance
Dec 2, 2026 2 release files No provenance
Jul 9, 2026 2 release files No provenance
May 14, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




