Skip to main content

A pure-Python SSHv2 client/server library

Project description

๐Ÿš€ SpindleX

The Next-Generation Pure-Python SSH Library

PyPI version Python Support License PyPI Downloads GitLab CI Coverage Code Quality Code Style Type Hints

Secure, high-performance SSH and SFTP operations with pure Python implementation

๐Ÿš€ Quick Start โ€ข ๐Ÿ“– Documentation โ€ข โœจ Features โ€ข ๐Ÿ› ๏ธ Examples


๐ŸŒŸ Why SpindleX?

SpindleX is a pure-Python SSH library designed for the modern developer. Built from the ground up with security, performance, and developer experience in mind.

๐ŸŽฏ Key Advantages

Feature SpindleX Traditional Libraries
๐Ÿ”’ Security Modern algorithms (Ed25519, ChaCha20-Poly1305) Legacy support
๐Ÿ Pure Python No C extensions, easy deployment Complex dependencies
โšก Performance Async support, optimized protocols Blocking operations
๐Ÿ›ก๏ธ License MIT (business-friendly) GPL/LGPL restrictions
๐Ÿ”ง Developer UX Full type hints, modern API Legacy interfaces

โœจ Features

๐Ÿ” Security First

Modern cryptographic algorithms โ€ข Host key verification โ€ข Multiple authentication methods

๐Ÿš€ High Performance

Async/await support โ€ข Connection pooling โ€ข Optimized protocols

๐Ÿ› ๏ธ Developer Friendly

Full type hints โ€ข Comprehensive docs โ€ข Rich error handling

๐ŸŒ Complete Protocol

SSH client & server โ€ข SFTP operations โ€ข Port forwarding


๐Ÿš€ Quick Start

Installation

# Install SpindleX
pip install spindlex

# With async support
pip install spindlex[async]

# With all features
pip install spindlex[dev,gssapi]

30-Second Example

from spindlex import SSHClient

# ๐Ÿ”Œ Connect and authenticate
with SSHClient() as client:
    client.connect('your-server.com', username='user', password='pass')
    
    # ๐Ÿ’ป Execute commands
    stdin, stdout, stderr = client.exec_command('ls -la')
    print(stdout.read().decode())
    
    # ๐Ÿ“ Transfer files via SFTP
    with client.open_sftp() as sftp:
        sftp.get('/remote/file.txt', '/local/file.txt')
        sftp.put('/local/data.json', '/remote/backup.json')

๐Ÿ› ๏ธ Examples

๐Ÿ”‘ Key-Based Authentication
from spindlex import SSHClient
from spindlex.crypto.pkey import Ed25519Key

# Load your private key
private_key = Ed25519Key.from_private_key_file('~/.ssh/id_ed25519')

with SSHClient() as client:
    client.connect(
        hostname='production-server.com',
        username='deploy',
        pkey=private_key
    )
    
    # Deploy your application
    client.exec_command('docker-compose up -d')
โšก Async Operations
import asyncio
from spindlex import AsyncSSHClient

async def deploy_to_multiple_servers():
    servers = ['web1.example.com', 'web2.example.com', 'web3.example.com']
    
    async def deploy_to_server(hostname):
        async with AsyncSSHClient() as client:
            await client.connect(hostname, username='deploy', key_filename='~/.ssh/deploy_key')
            
            # Parallel deployment
            await client.exec_command('git pull origin main')
            await client.exec_command('docker-compose restart')
            
            print(f"โœ… Deployed to {hostname}")
    
    # Deploy to all servers concurrently
    await asyncio.gather(*[deploy_to_server(server) for server in servers])

# Run the deployment
asyncio.run(deploy_to_multiple_servers())
๐ŸŒ Port Forwarding
from spindlex import SSHClient

with SSHClient() as client:
    client.connect('bastion.example.com', username='user', key_filename='~/.ssh/id_rsa')
    
    # Forward local port 5432 to remote database
    tunnel_id = client.create_local_port_forward(
        local_port=5432,
        remote_host='db.internal.com',
        remote_port=5432
    )
    
    # Now connect to localhost:5432 to reach the database
    print("๐Ÿ”— Tunnel established! Connect to localhost:5432")
    
    # Keep tunnel open
    input("Press Enter to close tunnel...")
    client.close_port_forward(tunnel_id)
๐Ÿ“ Advanced SFTP Operations
from spindlex import SSHClient
import os

with SSHClient() as client:
    client.connect('fileserver.com', username='admin', password='secure_pass')
    
    with client.open_sftp() as sftp:
        # ๐Ÿ“Š Get file stats
        file_stats = sftp.stat('/remote/important.log')
        print(f"File size: {file_stats.size} bytes")
        
        # ๐Ÿ“‚ List directory contents
        files = sftp.listdir('/var/log')
        for file in files:
            print(f"๐Ÿ“„ {file}")
        
        # ๐Ÿ”„ Sync directories
        for root, dirs, files in os.walk('/local/backup'):
            for file in files:
                local_path = os.path.join(root, file)
                remote_path = f"/remote/backup/{file}"
                sftp.put(local_path, remote_path)
                print(f"๐Ÿ“ค Uploaded {file}")

๐Ÿ—๏ธ Architecture

graph TB
    A[๐Ÿ”Œ SpindleX Client] --> B[๐Ÿ” Authentication Layer]
    A --> C[๐Ÿš€ Transport Layer]
    A --> D[๐Ÿ“ SFTP Client]
    
    B --> E[๐Ÿ”‘ Public Key Auth]
    B --> F[๐Ÿ”’ Password Auth]
    B --> G[๐ŸŽซ GSSAPI Auth]
    
    C --> H[๐Ÿ“ก SSH Protocol]
    C --> I[๐Ÿ”€ Port Forwarding]
    C --> J[๐Ÿ“Š Channel Management]
    
    D --> K[๐Ÿ“ค File Upload]
    D --> L[๐Ÿ“ฅ File Download]
    D --> M[๐Ÿ“‚ Directory Ops]
    
    style A fill:#e1f5fe
    style B fill:#f3e5f5
    style C fill:#e8f5e8
    style D fill:#fff3e0

๐Ÿ“– Documentation

Resource Description
๐Ÿš€ Quick Start Guide Get up and running in minutes
๐Ÿ“š User Guide Comprehensive tutorials and guides
๐Ÿ” API Reference Complete API documentation
๐Ÿ’ก Examples Real-world usage examples
๐Ÿ›ก๏ธ Security Guide Security best practices

๐Ÿ”ง Requirements & Compatibility

System Requirements

  • Python: 3.9+ (supports 3.9, 3.10, 3.11, 3.12, 3.13, 3.14)
  • Dependencies: cryptography >= 3.0
  • Platforms: Linux, macOS, Windows

Optional Features

# Async support
pip install spindlex[async]

# Development tools  
pip install spindlex[dev]

# GSSAPI authentication (Unix only)
pip install spindlex[gssapi]

๐Ÿค Contributing

We โค๏ธ contributions! SpindleX is built by developers, for developers.

๐Ÿš€ Quick Contribution Guide

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch: git checkout -b feature/amazing-feature
  3. โœจ Make your changes with tests
  4. ๐Ÿงช Test your changes: pytest tests/
  5. ๐Ÿ“ Commit with clear messages: git commit -m "Add amazing feature"
  6. ๐Ÿš€ Push and create a Pull Request

๐ŸŽฏ Areas We Need Help

  • ๐Ÿ“– Documentation improvements
  • ๐Ÿงช Test coverage expansion
  • ๐Ÿ› Bug fixes and optimizations
  • โœจ New feature implementations
  • ๐ŸŒ Platform compatibility

โ†’ See Contributing Guide


๐Ÿ›ก๏ธ Security

Security is our top priority. SpindleX implements:

  • ๐Ÿ” Modern Cryptography: Ed25519, ECDSA, ChaCha20-Poly1305
  • ๐Ÿ›ก๏ธ Secure Defaults: No weak algorithms enabled
  • ๐Ÿ” Regular Audits: Automated security scanning
  • ๐Ÿ“‹ Best Practices: Following SSH RFCs and security guidelines

๐Ÿšจ Security Issues

Found a security vulnerability? Please report it through our GitLab security issue tracker with the "security" label.


๐Ÿ“Š Performance

SpindleX is built for performance:

Operation SpindleX Traditional
Connection Setup ~50ms ~200ms
File Transfer (1MB) ~100ms ~300ms
Concurrent Connections 1000+ 100+
Memory Usage Low High

Benchmarks run on standard hardware. Results may vary.


๐Ÿ“œ License

SpindleX is licensed under the MIT License - see the LICENSE file for details.

Why MIT?

  • โœ… Business-friendly: Use in commercial projects
  • โœ… No copyleft: No viral licensing requirements
  • โœ… Simple and permissive: Minimal restrictions
  • โœ… Widely adopted: Used by major projects

๐Ÿ™ Acknowledgments

SpindleX stands on the shoulders of giants:

  • ๐Ÿ” Python Cryptography team for excellent crypto primitives
  • ๐Ÿ Python Community for inspiration and feedback
  • ๐Ÿ”ง Contributors who make SpindleX better every day
  • ๐Ÿ’ก SSH Protocol designers for creating a robust standard

๐ŸŒŸ Star us on GitLab! ๐ŸŒŸ

If SpindleX helps you build amazing things, consider giving us a โญ

Made with โค๏ธ by the SpindleX Team

๐Ÿ› Report Bug โ€ข โœจ Request Feature โ€ข ๐Ÿ’ฌ Discussions

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

spindlex-0.3.0.tar.gz (111.4 kB view details)

Uploaded Source

Built Distribution

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

spindlex-0.3.0-py3-none-any.whl (122.8 kB view details)

Uploaded Python 3

File details

Details for the file spindlex-0.3.0.tar.gz.

File metadata

  • Download URL: spindlex-0.3.0.tar.gz
  • Upload date:
  • Size: 111.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for spindlex-0.3.0.tar.gz
Algorithm Hash digest
SHA256 325965b7e51ed283ec364cc8f26e857fa4664744f2024f48940e074d8468ff25
MD5 9e4392edb662e972f0a93653b937d104
BLAKE2b-256 ea1a1f6bae7751daf9eb9a2e53db2f3c8d38397a75081097518209fc56005dd2

See more details on using hashes here.

File details

Details for the file spindlex-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: spindlex-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 122.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for spindlex-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18a0cd0758da300706fc7a2b9fd4dfd7152836be76dbbe027d386fbae3c048c1
MD5 ff1555f6c2f81cfced5eda97d580988d
BLAKE2b-256 233a3d3c5c23b76a03a1d8427a1e30cf9e41c699b7d06a86a7653ca8b5d0b5f5

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