Skip to main content

SwapLayer

The Anti-Vendor-Lock-in Framework for Django

One Interface. Any Provider. Zero Rewrites.


What is SwapLayer?

SwapLayer is a unified infrastructure layer for Django that protects you from vendor lock-in.

Instead of coupling your code directly to Stripe, AWS, or Twilio, you write against one consistent interface and swap providers by changing a single configuration line.

The Problem

# ❌ Tightly coupled - if Stripe fails, you rewrite everything
import stripe
customer = stripe.Customer.create(email='user@example.com')

The Solution

# ✅ Provider-agnostic - swap providers in settings
from swap_layer import get_provider
payments = get_provider('payments')
customer = payments.create_customer(email='user@example.com')

Quick Start

1. Install

SwapLayer has optional dependencies - install only what you need:

# Install with specific providers
pip install swaplayer[stripe]        # Just Stripe billing
pip install swaplayer[identity]      # Just WorkOS/Auth0
pip install swaplayer[email,sms]     # Email + SMS

# Or install everything
pip install swaplayer[all]

Available extras:

  • stripe - Stripe payment processing
  • identity - WorkOS/Auth0 OAuth/SSO
  • email - Enhanced email (django-anymail)
  • sms - Twilio/AWS SNS messaging
  • aws - AWS services (S3, SNS)
  • mcp - AI assistant integration
  • all - Everything

2. Configure

# settings.py
from swap_layer.settings import SwapLayerSettings

SWAPLAYER = SwapLayerSettings(
    email={'provider': 'django'},
    payments={'provider': 'stripe', 'stripe': {'secret_key': '...'}},
    sms={'provider': 'twilio', 'twilio': {'account_sid': '...'}},
    storage={'provider': 'django'},
)

3. Use Anywhere

from swap_layer import get_provider

# Email
get_provider('email').send(to='user@example.com', subject='Hello')

# Payments  
get_provider('payments').create_customer(email='user@example.com')

# SMS
get_provider('sms').send(to='+1555555', message='Welcome!')

Features

Module Status Description
Email ✅ Production SMTP, SendGrid, Mailgun, SES
Payments ✅ Production Stripe (PayPal planned)
SMS ✅ Production Twilio, AWS SNS
Storage ✅ Production S3, Azure, GCS, Local
Identity 🚧 Beta OAuth/SSO, KYC Verification
MCP Server ✅ Production AI Assistant Integration

🤖 AI Assistant Integration

SwapLayer includes an MCP (Model Context Protocol) server that exposes provider management as tools for AI assistants:

# Install with MCP support
pip install 'swaplayer[mcp]'

# Run the MCP server
swaplayer-mcp

AI assistants can now help you:

  • Configure and switch providers through conversation
  • Send test emails/SMS to verify integrations
  • Get provider setup instructions and capabilities
  • Inspect your current configuration

Perfect for AI-powered development workflows! → MCP Documentation


📚 Full Documentation

→ docs/ - One doc per module:


Why SwapLayer?

✅ Avoid Vendor Lock-in - Never get trapped by a single provider
✅ Consistent Interface - Same API across all vendors
✅ Type Safe - Pydantic validation catches errors early
✅ Battle Tested - Wraps proven tools (django-storages, django-anymail)
✅ Zero Rewrites - Swap providers with configuration changes only
✅ AI-Powered - Built-in MCP server for AI assistant integration


License

MIT - Because avoiding vendor lock-in should be free.


→ Read Full Documentation

Metadata

Release files for SwapLayer 0.3.0

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

Source distribution (sdist)

Source distribution for SwapLayer 0.3.0
File Size Uploaded Provenance Actions
swaplayer-0.3.0.tar.gz 157.5 kB With provenance Details for swaplayer-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for SwapLayer 0.3.0
File Interpreter ABI Platform Actions
swaplayer-0.3.0-py3-none-any.whl Python 3 none any Details for swaplayer-0.3.0-py3-none-any.whl

Total release size: 296.6 kB

Release files / swaplayer-0.3.0.tar.gz

Download URL swaplayer-0.3.0.tar.gz
Size 157.5 kB
Tags Source
SHA-256 checksum
How to use checksums
93f4bb60bb53cdde4f786f18101c7a550bd505f63ac4dcc7a902000eab4e77b6
BLAKE2b-256 checksum
How to use checksums
1b8549704ade4d57b9168783adb867ae1e87ffa17647a6362b901233c60a5ef8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release files / swaplayer-0.3.0-py3-none-any.whl

Download URL swaplayer-0.3.0-py3-none-any.whl
Size 139.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a9d7c639e8f5f459fe038e504da837e01ead22fee6aa0be78108484a0ef60a0
BLAKE2b-256 checksum
How to use checksums
50dbc31325fa6e1286de396d7d6d85cd48982eac383f003a4d3b2c5bb3e3e7a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Security for SwapLayer 0.3.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for swaplayer-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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