- Python 99.7%
- Just 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
/ pr-review (push) Has been skipped
/ gitleaks (push) Successful in 17s
/ pr-review (release) Has been skipped
/ gitleaks (release) Successful in 14s
/ checks (push) Successful in 3m41s
/ publish (push) Has been skipped
/ checks (release) Successful in 3m54s
/ deploy-docs (release) Has been skipped
/ publish (release) Successful in 27s
/ deploy-docs (push) Successful in 1m9s
|
||
| .forgejo/workflows | ||
| docs | ||
| src/longwei | ||
| tests | ||
| .editorconfig | ||
| .gitignore | ||
| .gitleaks.toml | ||
| .pre-commit-config.yaml | ||
| .pylintrc | ||
| .python-version | ||
| AGENTS.md | ||
| AI-DECLARATION.md | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| docs_hooks.py | ||
| justfile | ||
| LICENSE.md | ||
| mkdocs.yml | ||
| noxfile.py | ||
| pylock.toml | ||
| pyproject.toml | ||
| README.md | ||
| Release-Notes.md | ||
| Release-Notes.md.template | ||
| ruff.toml | ||
| Security-Audit-Detail.md | ||
| Security-Audit.md | ||
| uv.lock | ||
longwei
Longwei is a minimal Python implementation of the ActivityPub client REST API used by Mastodon, Pleroma, GotoSocial, and snac. This implementation makes use of asyncio where appropriate. It is intended to be used as a library by other applications. No standalone functionality is provided.
All targeted Mastodon v1/v2 API endpoints are now implemented, covering accounts, timelines, statuses, notifications, lists, filters, polls, reports, discovery, and instance management. Admin, push notification, and proof endpoints are intentionally out of scope. Longwei is used by Fedinesia, Feed2Fedi, and FenLiu and Zhongli.
Quick start
pip install longwei
import asyncio
from longwei import APClient
async def main():
async with await APClient.create(
instance="mastodon.social",
access_token="your_token",
) as ap:
status = await ap.post_status("Hello, fediverse!")
print(status.url)
asyncio.run(main())
API References
Status
longwei is a fork of minimal_activitypub. It is not a drop-in replacement.
See the Upgrading guide for full migration instructions.
longwei 2.0 introduced additional breaking changes: the client= parameter has been removed from
APClient and all auth methods, and the underlying HTTP library has changed from httpx to httpx2.
See the upgrade guide for details.
Contributing
Issues and pull requests are welcome.
longwei is using pre-commit for code quality checks and uv for dependency management. Please install and use both pre-commit and uv if you'd like to contribute.
Documentation
The live documentation is at https://longwei.marvin8.zone/latest/
Built with MkDocs and the Material theme. To build and serve locally:
uv sync --group docs
mkdocs serve
Development
This project uses uv for dependency management and virtual environments. To set up the development environment:
# Create and activate virtual environment
uv venv
source .venv/bin/activate
# Install all dependencies including development and documentation groups
uv sync --all-groups
# Run tests
uv run nox
For more details on the development workflow, check the noxfile.py and .forgejo/ configuration files.
Licensing
longwei is licenced with the GNU Affero General Public License v3.0
Supporting longwei
There are a number of ways you can support longwei:
- Create an issue with problems or ideas you have with/for longwei
- You can buy me a coffee.
- You can send me small change in Monero to the address below:
Monero donation address
8ADQkCya3orL178dADn4bnKuF1JuVGEG97HPRgmXgmZ2cZFSkWU9M2v7BssEGeTRNN2V5p6bSyHa83nrdu1XffDX3cnjKVu