Skip to main content

longwei

Docs Repo CI Downloads uv_secure gitleaks AI Declaration pysentry complexipy Codestyle Version Wheel License: AGPL-3.0-or-later

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

longwei-2.1.1.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

longwei-2.1.1-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

Details for the file longwei-2.1.1.tar.gz.

File metadata

  • Download URL: longwei-2.1.1.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for longwei-2.1.1.tar.gz
Algorithm Hash digest
SHA256 07db2402b328b95e9459d1eaf4722767c2dbda7f9d771fc22082f7af3b15c212
MD5 1035fd9032caf9242aaefb1e30996578
BLAKE2b-256 c3ae7674e9af124597882515b6f1916833b28cb3fcea3fb4ca686f2177537b20

See more details on using hashes here.

File details

Details for the file longwei-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: longwei-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 59.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for longwei-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28742350cbef94c5119f3637da94dfbacec493126571d4369816a2577f3ade27
MD5 a53007d0193f9af81c57fee01b1fad46
BLAKE2b-256 b22d359ed244d4519949583e95224225a4dc5bb9abb5120696f604e860660b23

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 files

2.1.0

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.5.1

2 files

1.5.0

2 files

1.4.3

2 files

1.4.1

2 files

1.4.0

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page