arroba
Python implementation of Bluesky PDS and AT Protocol, including data repository, Merkle search tree, and com.atproto.sync XRPC methods.
Arroba is the Spanish word for the @ character (“at sign”).
Install from PyPI with
pip install arroba.
License: This project is placed into the public domain.
Usage
See app.py for the minimal wrapper code needed to run a fully functional PDS based on arroba, for testing with the ATProto federation sandbox.
Environment variables:
APPVIEW_HOST, defaultapi.bsky-sandbox.devBGS_HOST, defaultbgs.bsky-sandbox.devPLC_HOST, defaultplc.bsky-sandbox.devPDS_HOST, where you’re running your PDSREPO_DID, repo user’s DID, defaults to contents ofrepo_didfileREPO_HANDLE, repo user’s domain handle, defaults todid:plc:*.jsonfileREPO_PASSWORD, repo user’s password, defaults to contents ofrepo_passwordfileREPO_PRIVKEY, repo user’s private key in PEM format, defaults to contents ofprivkey.pemfileREPO_TOKEN, static token to use as bothaccessJwtandrefreshJwt, defaults to contents ofrepo_tokenfile. Not required to be an actual JWT.
More docs to come!
Changelog
0.4 - 2023-09-19
Migrate to ATProto repo v3. Specifically, the existing
subscribeRepossequence number is reused as the newrevfield in commits. (Discussion.).Add new
didmodule with utilities to create and resolvedid:plcs and resolvedid:webs.Add new
util.service_jwtfunction that generates ATProto inter-service JWTs.Repo:Add new
signing_key/rotation_keyattributes. Generate store, and load both indatastore_storage.Remove
format_init_commit, migrate existing calls toformat_commit.
Storage:Rename
read_from_seq=>read_blocks_by_seq(and inMemoryStorageandDatastoreStorage), add newread_commits_by_seqmethod.Merge
load_repodid/handlekwargs intodid_or_handle.
XRPCs:
Make
subscribeReposcheck storage for all new commits every time it wakes up.As part of this, replace
xrpc_sync.enqueue_commitwith newsend_new_commitsfunction that takes no parameters.
Drop bundled
app.bsky/com.atprotolexicons, use lexrpc’s instead.
0.3 - 2023-08-29
Big milestone: arroba is successfully federating with the ATProto sandbox! See app.py for the minimal demo code needed to wrap arroba in a fully functional PDS.
Add Google Cloud Datastore implementation of repo storage.
Implement
com.atprotoXRPC methods needed to federate with sandbox, including most ofrepoandsync.Notably, includes
subscribeReposserver side over websocket.
…and much more.
0.2 - 2023-05-18
Implement repo and commit chain in new Repo class, including pluggable
storage. This completes the first pass at all PDS data structures. Next
release will include initial implementations of the
com.atproto.sync.* XRPC methods.
0.1 - 2023-04-30
Initial release! Still very in progress. MST, Walker, and Diff classes are mostly complete and working. Repo, commits, and sync XRPC methods are still in progress.
Release instructions
Here’s how to package, test, and ship a new release.
Run the unit tests.
source local/bin/activate.csh python3 -m unittest discover
Bump the version number in
pyproject.tomlanddocs/conf.py.git grepthe old version number to make sure it only appears in the changelog. Change the current changelog entry inREADME.mdfor this new version from unreleased to the current date.Build the docs. If you added any new modules, add them to the appropriate file(s) in
docs/source/. Then run./docs/build.sh. Check that the generated HTML looks fine by openingdocs/_build/html/index.htmland looking around.git commit -am 'release vX.Y'Upload to test.pypi.org for testing.
python3 -m build setenv ver X.Y twine upload -r pypitest dist/arroba-$ver*
Install from test.pypi.org.
cd /tmp python3 -m venv local source local/bin/activate.csh # make sure we force pip to use the uploaded version pip3 uninstall arroba pip3 install --upgrade pip pip3 install -i https://test.pypi.org/simple --extra-index-url https://pypi.org/simple arroba==$ver deactivate
Smoke test that the code trivially loads and runs.
source local/bin/activate.csh python3 # TODO: test code deactivate
Tag the release in git. In the tag message editor, delete the generated comments at bottom, leave the first line blank (to omit the release “title” in github), put
### Notable changeson the second line, then copy and paste this version’s changelog contents below it.git tag -a v$ver --cleanup=verbatim git push && git push --tags
Click here to draft a new release on GitHub. Enter
vX.Yin the Tag version box. Leave Release title empty. Copy### Notable changesand the changelog contents into the description text box.Upload to pypi.org!
twine upload dist/arroba-$ver*
Wait for the docs to build on Read the Docs, then check that they look ok.
On the Versions page, check that the new version is active, If it’s not, activate it in the Activate a Version section.