Metadata-Version: 2.4
Name: socialpost
Version: 0.1.0
Summary: Unified social media publishing library
Author-email: Newton Poudel <hinewton25@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/lilixac/socialpost
Project-URL: Documentation, https://github.com/lilixac/socialpost/tree/main/docs
Project-URL: Repository, https://github.com/lilixac/socialpost/
Project-URL: Bug Tracker, https://github.com/yourusername/socialpost/issues
Keywords: social,media,api,automation,tiktok,reddit,instagram
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: structlog>=23.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: tenacity>=8.0.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: respx>=0.20.0; extra == "dev"
Requires-Dist: aioresponses>=0.7.0; extra == "dev"
Provides-Extra: tiktok
Requires-Dist: requests-toolbelt>=1.0.0; extra == "tiktok"
Provides-Extra: reddit
Requires-Dist: praw>=7.7.0; extra == "reddit"
Provides-Extra: instagram
Requires-Dist: instagrapi>=2.0.0; extra == "instagram"
Provides-Extra: facebook
Requires-Dist: facebook-sdk>=3.1.0; extra == "facebook"
Provides-Extra: youtube
Requires-Dist: google-api-python-client>=2.0.0; extra == "youtube"
Requires-Dist: google-auth>=2.0.0; extra == "youtube"
Provides-Extra: all
Requires-Dist: socialpost[facebook,instagram,reddit,tiktok,youtube]; extra == "all"

# SocialPost

A unified, provider-agnostic Python library for publishing content across multiple social media platforms. Built with enterprise-grade architecture: clean abstractions, dependency injection, comprehensive error handling, and extensive testability.

## Features

- **Multi-platform support** - TikTok, Reddit, Instagram, Facebook, YouTube
- **Async-first** - All network I/O is async, with concurrent publishing support
- **Strongly typed** - Complete type hints, frozen dataclasses, Protocol-based interfaces
- **Fail-safe by default** - Railway-oriented programming with `Result[T]` types, no surprise exceptions
- **Dependency injection** - Pluggable HTTP clients, authenticators, and rate limiters
- **Extensible** - Protocol-based design makes adding new platforms straightforward

## Installation

```bash
pip install socialpost

# With all platform dependencies
pip install socialpost[all]

# Specific platforms
pip install socialpost[reddit,tiktok]
```

## Quick Start

```python
import asyncio
from socialpost import SocialPost, Post, Media, MediaType, ContentFormat

async def main():
    async with SocialPost() as sp:
        # Configure your platform (see docs/auth_setup.md for credentials)
        # await sp.add_platform("reddit", reddit_auth, reddit_publisher)

        # Create a post
        post = Post(
            text="Check out this library!",
            tags=["python", "automation"],
            metadata={"subreddit": "programming"},
        )

        # Publish
        # result = await sp.publish("reddit", post)
        # if result.is_ok:
        #     print(f"Published! ID: {result.unwrap()}")
        # else:
        #     error = result.unwrap_err()
        #     print(f"Failed: {error.message}")

asyncio.run(main())
```

## Multi-Platform Publishing

```python
# Publish to all configured platforms
results = await sp.publish_to_all(post, platforms=["reddit", "tiktok"])

for platform, result in results.items():
    if result.is_ok:
        print(f"{platform}: {result.unwrap()}")
    else:
        print(f"{platform}: {result.unwrap_err().message}")
```

## Documentation

- [Architecture Overview](docs/architecture.md)
- [Authentication Setup Guide](docs/auth_setup.md)
- [Basic Usage Example](docs/examples/basic_usage.py)
- [Error Handling Example](docs/examples/error_handling.py)
- [Full Architecture Spec](CONTEXT.md)

## Supported Platforms

| Platform | Text | Images | Video | Stories | Polls | Threads |
|----------|------|--------|-------|---------|-------|---------|
| Reddit   | Yes  | Yes    | Yes   | No      | Yes   | Yes     |
| TikTok   | No   | No     | Yes   | No      | No    | No      |
| Instagram| No   | Yes    | Yes   | Yes     | No    | No      |
| Facebook | Yes  | Yes    | Yes   | Yes     | No    | No      |
| YouTube  | No   | No     | Yes   | No      | No    | No      |

## Development

```bash
# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=socialpost

# Type checking
mypy socialpost

# Format code
black socialpost
ruff check socialpost
```

## Contributing

Contributions are welcome! See [CONTEXT.md](CONTEXT.md) for architectural guidelines and code style.

## License

MIT
