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

Installation

Requires Python 3.12+

# Clone the repository
git clone https://github.com/danwald/butterfly.git
cd butterfly

# Install
pipx install .

Usage

Command Line Interface

# List available plugins
sbutterfly --list-plugins

# Validate credentials
sbutterfly --plugins twitter --method validate
sbutterfly --plugins mastodon --method validate
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 --method execute --message "Hello from Butterfly!"

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!")

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

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

# Install development dependencies
uv pip install -e ".[dev]"

# Run tests
make test

# Run linting
make lint
make type

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.1.0.tar.gz (7.7 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.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sbutterfly-1.1.0.tar.gz
Algorithm Hash digest
SHA256 94cae09f2dbd5c72aec8e53963f747286063888ae4819ca5c14227f47dfbbc12
MD5 f663a2091de1f86020e50eb5c7ed97d0
BLAKE2b-256 f51a21f4520159ebf3e8a9cf5d5311e40287cb8d5095ec32c26465071ff35585

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sbutterfly-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d981c5256735056b9974d982e595fdb57ca7d407d36372872c4c2a27a2b5e8d
MD5 7a47c4df02e5a0c4c120ecbec6f03ebf
BLAKE2b-256 a082cf4b4026db19daeded042685ee4386fdcc661913bc31b3c730f7f10d308b

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