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
sbutterfly --method validate

# Post a message
sbutterfly --plugins twitter --method execute --message "Hello from Butterfly!"
sbutterfly --plugins mastodon --method execute --message "Hello from Butterfly!"
sbutterfly --plugins bluesky --method execute --message "Hello from Butterfly!"
# or
sbutterfly --method 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
uv sync

# Run tests
make test

# Run linting
make lint
make type

Using as a Library

from 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-1.2.4.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

sbutterfly-1.2.4-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sbutterfly-1.2.4.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.22

File hashes

Hashes for sbutterfly-1.2.4.tar.gz
Algorithm Hash digest
SHA256 a4006da3b2ef21213a1fd654c7d6f2df1cd809401f7d17c4dac16c73046c8111
MD5 a6129cb19f3fc5ebd9fb34ff035090c3
BLAKE2b-256 371d44f404207a6dbfd7e4f773d0a96cb4e1ece2f2b02a878d0dacf9f3766f33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sbutterfly-1.2.4-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.22

File hashes

Hashes for sbutterfly-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3367eeb9093366916f9d2b523eae157fcb3e4afaff2cf4c539393e109787b073
MD5 aefda0be235cffb08d179ffe3fd5c9e8
BLAKE2b-256 282699e521c4ba6265c8496b4b939e9f59fa5b1d86af70d0b1dfdbac69d26546

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