Skip to main content

Allows you to post to your socials

Project description

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

Project details


Download files

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

Source Distribution

sbutterfly-2.2.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

sbutterfly-2.2.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file sbutterfly-2.2.0.tar.gz.

File metadata

  • Download URL: sbutterfly-2.2.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","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}

File hashes

Hashes for sbutterfly-2.2.0.tar.gz
Algorithm Hash digest
SHA256 baa174820afd8533a332c1ebe9be0b0bb649372a7e743b9df1b3eda62dd63a34
MD5 8f3438fc79988e7aef197412eac42ece
BLAKE2b-256 d160169f762331787b5d100f81d00455d33df051a412b13cf71c6d4760c259e5

See more details on using hashes here.

File details

Details for the file sbutterfly-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: sbutterfly-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","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}

File hashes

Hashes for sbutterfly-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61d969eaeb5dc7ff3d6bc2af09c90b3c6a028455e4cc6c800a7a4f3e93d16915
MD5 78e6c844c3ab01eec3c862c76eb733e0
BLAKE2b-256 56759100fe36a938927382b4a9ae5695e47ae7b5f35422a1bd2e6cf343e716e6

See more details on using hashes here.

Supported by

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