Skip to main content

A modern, high-performance, pure-Python SSHv2 and SFTP client/server library

Project description

๐Ÿš€ SpindleX

The Next-Generation Pure-Python SpindleX

PyPI version Socket Badge 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 SpindleX 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

# From source
git clone https://gitlab.com/daveops.world/development/python/spindle.git
cd spindle
pip install .

# With async support
pip install .[async]

# With all features for development
pip install .[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 .[async]

# Development tools  
pip install .[dev]

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

๐Ÿค Contributing

I โค๏ธ 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: python -m pytest tests/
  5. ๐Ÿ“ Commit with clear messages: git commit -m "Add amazing feature"
  6. ๐Ÿš€ Push and create a Pull Request

๐ŸŽฏ Areas I Need Help

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

โ†’ See Contributing Guide


๐Ÿ›ก๏ธ Security

Security is my 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 my 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 me on GitLab! ๐ŸŒŸ

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

Made with โค๏ธ by Di3Z1E

๐Ÿ› 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.4.1.tar.gz (114.8 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.4.1-py3-none-any.whl (125.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for spindlex-0.4.1.tar.gz
Algorithm Hash digest
SHA256 d49bbf169fb161843946415b295c0d0876042c296ef62ac6e86a215916536186
MD5 fb2cd7e786fb0482caadb13d2f8441f8
BLAKE2b-256 79b4df5ea9dc9099343cbb4a7f31b9c775c54ece5f26210d68ce6e8ab2e687e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spindlex-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 125.7 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.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c9dc369a86fcb751689902fce4214498ec9eac67646d74b59a03d6c2e282b6b
MD5 992497186a9493dbdd9d60f932ff61d6
BLAKE2b-256 0809574866541253497a126110198b29f0b0d03475e15b087599ca0bdb4c7fca

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