Package: psychonaut
PROGRESS REPORTFinish pydantic validation for reference typesWhat is this?An async python sdk for Bluesky.I used to do a pretty absurd amount of experiments with twitter's api. But musk
has decided to turn that platform into a pay-for-play version of LinkedIn
and banished all the tinkerers. So, now I'm here.It has a bit of a weird structure. You basically do things like,asyncwithget_simple_client_session()assess:posts:GetPostsResp=awaitGetPostsReq(uris=[...]).do_xrpc(sess)...which feels backwards from the expected,asyncwithget_simple_client_session()assess:posts:GetPostsResp=awaitsess.do_xrpc(GetPostsReq(uris=[...]))or even,asyncwithget_simple_client_session()assess:posts:GetPostsResp=awaitsess.get_posts(uris=[...])It's kinda an artifact of the way I did code generation but I kinda like it
and fuck it S-expressions worked so there is a (completely nonsensical)
precedence.And, just to clarify, every request and response gets validated against the lexicon schema,
which is nice (although reference types are still a WIP). Moreover, the
generated code is auto-complete/copilot friendly. And, in theory, you could overridedo_xrpcto do clever things like caching, instead of hacking each particular api call.But mostly I'm lazy so this is how it is.Should I use this?Almost certainly not. Right now it's a bucket of slop. I offer no
guarantees about the stability of the API, the correctness of the
implementation, or the quality of the documentation.If you want to use it, go ahead.Every single api call exists with Pydantic models for requests and responses
(but with a few outstanding validations missing).It's still unstable but I've been using it pretty regularly.# In your venv or mamba env or whateverpipinstallpsychonautto use it as a library. This also installs thepsychonautcommand line tool.psychonaut--help# Temporary loginexportBSKY_USERNAME=yourusernameexportBSKY_PASSWORD=yourpassword# Permanent login (~/.psychonaut.json)psychonautsave-loginyourusernamepsychonautpoast"hey look, an annoying cron job"But definitely be mindful of the version because I'm going to break your code.Alternatively, just usepipxpipxinstallpsychonautexportBSKY_USERNAME=yourusernameexportBSKY_PASSWORD=yourpassword

psychonautpoast"hell yea, pipx"FirehoseEXTREMELY EXPERIMENTAL AND STILL NOT FINISHEDrepos-firehose-streamsaves the raw messages for subsequent replay so you
can at least collect now and i'll get the json emit / validation working
later.# Stream the firehosepsychonautrepos-firehose-streamstream_dir# Stream the firehose but print to stdout toopsychonautrepos-firehose-stream--teestream_dir# Replay serializedpsychonautrepos-firehose-replaystream_dir# Replay serialized filepsychonautrepos-firehose-replaystream_dir/your_stream.b64-linesHow is this made?Initially, this was a collaboration between theatproto repo,
me, and my friend ChatGPT (using GPT-4). I had been toying around with this
automaticlanga<->langbtranspiler inlangchain.
My original goal was to jointly build that while making my python client from theatprotorepo. However, the fine folks at OpenAI didn't give me
GPT-4 API access, and GPT-3 isn't quite good enough to do the job. So instead,
this was me testing the fences "manually" (with ChatGPT). And now it'sjustme.This also means this project was a bit...like theft? IDK.Question of the generative hour: where is the boundary?See Also (for pythonistas)arrobalexrpcatprotools