somewhere — Python SDK
Official Python SDK for the somewhere.tech platform API. Thin wrapper around the REST API at https://api.somewhere.tech/v1.
Install
pip install somewhere
Quick start
from somewhere import Somewhere, SomewhereError
sw = Somewhere(key="smt_...") # or token="eyJ..." for app-user mode
# Create a project
project = sw.projects.create(name="Booking App")
# Run a migration
sw.db.migrate(
"""
CREATE TABLE bookings (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
slot TEXT NOT NULL,
created_at TEXT DEFAULT (datetime('now'))
);
""",
project["id"],
)
# Insert + query
sw.db.query(
"INSERT INTO bookings (name, slot) VALUES (?, ?)",
["Alice", "2026-05-01 18:00"],
project["id"],
)
rows = sw.db.query("SELECT * FROM bookings", [], project["id"])
# Deploy a static site
sw.deploy(
files={"index.html": "<h1>Book a table</h1>"},
project_id=project["id"],
)
print(f"Live at https://{project['subdomain']}.somewhere.tech")
Auth modes
Developer mode — full access, server-side only:
sw = Somewhere(key="smt_...")
App-user mode — app JWT, browser-safe operations only (db, storage, fs, auth.me):
sw = Somewhere(token="eyJ...", project_id="booking-app")
me = sw.auth.me()
rows = sw.db.query("SELECT * FROM bookings WHERE email = ?", [me["user"]["email"]])
Default project:
sw = Somewhere(key="smt_...", project_id="booking-app")
sw.db.query("SELECT * FROM bookings") # uses 'booking-app'
Error handling
Every API error raises a typed SomewhereError:
from somewhere import SomewhereError
try:
sw.email.send(to="user@example.com", subject="Hi", text="Welcome")
except SomewhereError as err:
print(err.code) # "QUOTA_EXCEEDED"
print(err.message) # human-readable
print(err.status_code) # 429
print(err.retry) # True if client should retry
print(err.retry_after_ms) # ms to wait
Method reference
| Namespace | Methods |
|---|---|
sw.projects |
create, list, get, delete, undeploy, archive, unarchive, rename, deploys |
sw.deploy |
sw.deploy(files=..., functions=..., project_id=...), sw.deploy.status(project_id) |
sw.promote |
sw.promote(project_id), sw.promote.rollback(project_id) |
sw.db |
query, migrate, tables, schema |
sw.storage |
put, get, delete, list |
sw.fs |
write, read, delete, move, copy, stat, versions, restore |
sw.auth |
signup, login, logout, me, forgot, reset, users, verify_email, request_verification, delete_account, update_me |
sw.email |
send |
sw.ai |
complete, embed, image, tts, transcribe |
sw.jobs |
create, status, list, cancel, progress |
sw.cron |
create, list, update, delete |
sw.queue |
push |
sw.logs |
write, read |
sw.env |
set, list, delete |
sw.domains |
add, verify, list, delete |
sw.preview |
invite, revoke, viewers |
sw.feedback |
submit, list |
sw.billing |
status, checkout, portal |
sw.usage |
get, summary |
* = stub for not-yet-shipped endpoints; calling returns UNSUPPORTED_FEATURE.
Test
SMT_KEY=smt_... python tests/test_basic.py
License
MIT © somewhere.tech
Metadata
Release files for somewhere-tech 0.5.0
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 |
|---|---|---|---|---|
| somewhere_tech-0.5.0.tar.gz | 28.1 kB | Without provenance | Details for somewhere_tech-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| somewhere_tech-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for somewhere_tech-0.5.0-py3-none-any.whl |
Total release size: 60.8 kB
Release files / somewhere_tech-0.5.0.tar.gz
| Download URL | somewhere_tech-0.5.0.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43725d233334036f5f09f2cbaf91a2031cdcd0a243adcdd373adb24c01c615df
|
|
BLAKE2b-256 checksum How to use checksums |
e6d1a215d04642cf0bf79180ca72733385799b4d2cc6804e2dd4d91fe3f70647
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / somewhere_tech-0.5.0-py3-none-any.whl
| Download URL | somewhere_tech-0.5.0-py3-none-any.whl |
|---|---|
| Size | 32.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a961276c501d91b6900940ce2db7452c5abfde95ff40bac1470ef5b91e8eaad3
|
|
BLAKE2b-256 checksum How to use checksums |
8f27954124cabf37b28964fe4a050757098c24da8eb631adffc90a0daf869568
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for somewhere-tech 0.5.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.
No provenance found
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.