Python SDK for Rocksky — native bindings to the shared Rust core
Project description
rocksky — Python SDK
Python bindings to the shared Rocksky Rust core (rocksky-sdk) via
UniFFI: AppView reads, AT Protocol PDS
writes (scrobble fan-out, like, follow, shout, now-playing), a local
duplicate-prevention index, and the identity hashes — the same engine behind
every Rocksky SDK (Ruby, Kotlin, Clojure, Erlang/Elixir/Gleam).
Install
pip install rocksky # or: uv add rocksky
The wheel is pure-Python; the ~14 MB native library is fetched from the GitHub release on first import and cached (checksum-verified). For a local checkout, build it once:
./build-core.sh
Quickstart
from rocksky import AppView, Agent, ScrobbleInput, song_hash
# Reads — unauthenticated. Pass a base URL to override https://api.rocksky.app.
av = AppView(None)
print(av.global_stats().scrobbles)
for t in av.top_tracks(10, 0):
print(t.artist, "—", t.title)
# Writes — log in once (session persisted at the given path).
agent = Agent.login_password("session.json", "alice.bsky.social", "app-password", None, None)
out = agent.scrobble(ScrobbleInput(
title="Chaser", artist="Calibro 35",
album="Jazzploitation", album_artist="Calibro 35", duration_ms=182320,
))
print(out.scrobble_uri) # also artist_uri / album_uri / song_uri
API
Reads — AppView(base=None)
profile(actor), scrobbles(actor, limit, offset), songs(actor, limit, offset),
top_tracks(limit, offset), top_artists(limit, offset), global_stats().
Pass a base URL to AppView(...) to target a custom AppView.
Writes — Agent
Agent.login_password(session_path, identifier, password, appview=None, dedup_path=None)
returns an agent. Then:
scrobble(ScrobbleInput)→ScrobbleResult— writes artist + album + song + scrobble, skipping any that already exist (with a dedup store).create_song(SongInput),create_album(AlbumInput),create_artist(ArtistInput)like(uri, cid),unlike(uri),follow(did),unfollow(did)shout(subject_uri, subject_cid, message),reply_shout(...)set_now_playing(NowPlayingInput),clear_now_playing()refresh_session(),did(),profile()sync_repo()— mirror the repo into the local dedup index (needsdedup_path)
Identity hashes
song_hash(title, artist, album), album_hash(album, album_artist),
artist_hash(album_artist) — lowercase-hex SHA-256, identical to the server and
every other Rocksky SDK.
Example
python examples/native_core.py
License
MIT.
Project details
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 rocksky-0.4.0.tar.gz.
File metadata
- Download URL: rocksky-0.4.0.tar.gz
- Upload date:
- Size: 61.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73b02e4d7dd07b5006198658edcbdc046b4833d7095b5026f043eaf55fa5c37a
|
|
| MD5 |
afd34c08f81ddb186c40e7c5116c7773
|
|
| BLAKE2b-256 |
ec2352085ebc7f8335c9a54da8fbd7415cdbe2073fde4cf0658ce7a13222ed46
|
File details
Details for the file rocksky-0.4.0-py3-none-any.whl.
File metadata
- Download URL: rocksky-0.4.0-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9109dbcefd17af9011a4f90fa30786b1f87a2e2250435d1ffc79d016de46d9bf
|
|
| MD5 |
a6a0fd51a6c90cc7b9a7225481e3a3af
|
|
| BLAKE2b-256 |
8b2da52c1dfb1a8639577e6a5f0fdb6a23947681b622e2829a214eb8a3cd0b47
|