A pure-Python SSHv2 client/server library
Project description
๐ SpindleX
The Next-Generation Pure-Python SSH Library
Secure, high-performance SSH and SFTP operations without GPL/LGPL dependencies
๐ 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 | Apache 2.0 (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.8+
- 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
- ๐ด Fork the repository
- ๐ฟ Create a feature branch:
git checkout -b feature/amazing-feature - โจ Make your changes with tests
- ๐งช Test your changes:
pytest tests/ - ๐ Commit with clear messages:
git commit -m "Add amazing feature" - ๐ Push and create a Pull Request
๐ฏ Areas We Need Help
- ๐ Documentation improvements
- ๐งช Test coverage expansion
- ๐ Bug fixes and optimizations
- โจ New feature implementations
- ๐ Platform compatibility
๐ก๏ธ 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 email security@spindlex.org instead of creating a public issue.
๐ 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 Apache License 2.0 - see the LICENSE file for details.
Why Apache 2.0?
- โ Business-friendly: Use in commercial projects
- โ No copyleft: No viral licensing requirements
- โ Patent protection: Includes patent grant
- โ 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spindlex-0.2.0.tar.gz.
File metadata
- Download URL: spindlex-0.2.0.tar.gz
- Upload date:
- Size: 103.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3451d63a6b20e6560386d45d5c62ffc170b1b1f68ad91c9f86231ce04a2b111
|
|
| MD5 |
1146b8b28981e381c956d32aa4528c7b
|
|
| BLAKE2b-256 |
3d7241d157a48b039f10c50422ad96b283d9de01e43722cd554135c725004d9d
|
File details
Details for the file spindlex-0.2.0-py3-none-any.whl.
File metadata
- Download URL: spindlex-0.2.0-py3-none-any.whl
- Upload date:
- Size: 114.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fb42d10696e8f369e30f212b10677d87aad08c0f03d5b359dcc6261238d94d7
|
|
| MD5 |
91d22f7f0e13f3594bb21d5264532393
|
|
| BLAKE2b-256 |
1cf9af10c90b4b11e3a1f9082d7a359bed85197bddd9fbca703d3982c863d0dd
|