Skip to main content

Butterfly

A lightweight, extensible social media management tool.

Overview

Butterfly is a Python framework for managing posts across multiple social media platforms through a unified interface. It uses a plugin-based architecture to support different social media services.

Currently supported platforms:

  • Twitter
  • Mastodon
  • BlueSky

Installation

Requires Python 3.12+ & uv/pipx

uv tool install sbutterfly

Usage

Command Line Interface

# List available plugins
sbutterfly --list-plugins

# Validate credentials (default behavior)
sbutterfly --plugins twitter
sbutterfly --plugins mastodon
sbutterfly --plugins bluesky
# or validate all plugins
sbutterfly

# Post a message (use --execute flag)
sbutterfly --plugins twitter --execute --message "Hello from Butterfly!"
sbutterfly --plugins mastodon --execute --message "Hello from Butterfly!"
sbutterfly --plugins bluesky --execute --message "Hello from Butterfly!"
# or post to all platforms
sbutterfly --execute --message "Hello from Butterfly!"

Configuration

Butterfly uses environment variables for authentication:

Environment Variables

TWITTER_CONSUMER_KEY
TWITTER_CONSUMER_SECRET
TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET
MASTODON_BEARER_TOKEN
BSKY_USERNAME
BSKY_PASSWORD

Extending Butterfly

To create a new social media plugin:

  1. Create a new file in the plugins directory
  2. Implement a class that adheres to the Plugin protocol:
    • get_name(): Returns the plugin's name
    • validate(): Validates the plugin's credentials
    • execute(): Posts content to the social media platform

See plugins/twitter.py for an example implementation.

Development

git clone https://github.com/danwald/butterfly.git
cd butterfly

# Install development dependencies (including dev group)
uv sync

# Run tests
uv run pytest tests

# Run type checking
uv run mypy src tests

# Run linting
uv run pre-commit run --all-files
uv run ruff check

Using as a Library

from src.plugins.twitter import Twitter

# Create a Twitter plugin instance
twitter = Twitter()

# Validate credentials
if twitter.validate():
    # Post a message
    twitter.execute("Hello from Butterfly!")

Todo

  • support meta threads

Metadata

Release files for sbutterfly 2.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sbutterfly 2.3.2
File Size Uploaded Provenance
sbutterfly-2.3.2.tar.gz 10.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sbutterfly 2.3.2
File Interpreter ABI Platform
sbutterfly-2.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / sbutterfly-2.3.2.tar.gz

Download URL sbutterfly-2.3.2.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b2d4db7eb1104ed4e6cb123de4a65f10951e855a7aa0bb88fab0f778931a59e6
BLAKE2b-256 checksum
How to use checksums
7ff38c2fec2595de5c712f9adc7fad20790095ac39f40fb83887b8a1e6001f24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sbutterfly-2.3.2-py3-none-any.whl

Download URL sbutterfly-2.3.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd14a886078d99fcd7e7be3defe245690b8c645f5bd410af56df81b235902a8f
BLAKE2b-256 checksum
How to use checksums
ed9aff2d1a93f27662a4415d72d6581dab1cef4f16e6406513d70ec28702d8e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for sbutterfly 2.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page