NeuronOS Python Capabilities Library - Provider-agnostic backend capabilities following hexagonal architecture
Project description
NeuronOS Capabilities Library
A collection of provider-agnostic backend capabilities for Python applications, following hexagonal architecture principles. Each capability exposes well-defined ports and adapters for flexible backend infrastructure.
Installation
pip install neuronos-capabilities
Available Capabilities
SQLManager - Database Management
A comprehensive SQL database management capability with:
- ✅ SQLAlchemy ORM support with type hints
- ✅ Alembic migrations (auto-generate, apply, rollback)
- ✅ Connection pooling with singleton pattern
- ✅ Async/await support
- ✅ PostgreSQL support (extensible to other databases)
- ✅ Transaction management
- ✅ Multi-schema support
- ✅ CRUD operations with filters
Quick Example:
from neuronos_capabilities import SQLManager
from neuronos_capabilities.SQLManager import Base
from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy import String
# Define your model
class User(Base):
__tablename__ = "users"
id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str] = mapped_column(String(100))
email: Mapped[str] = mapped_column(String(255), unique=True)
# Configure database
config = {
"host": "localhost",
"database": "myapp",
"user": "postgres",
"password": "secret"
}
# Use with context manager
with SQLManager(config) as db:
# Create tables
db.create_tables([User])
# Insert data
user = db.insert(User, {"name": "Alice", "email": "alice@example.com"})
# Query data
users = db.query(User, {"name": "Alice"})
print(f"Found user: {users[0].email}")
Async Example:
async with SQLManager(config) as db:
user = await db.insert_async(User, {"name": "Bob", "email": "bob@example.com"})
users = await db.query_async(User, {"email": "bob@example.com"})
Full Documentation: SQLManager/README.md
Architecture
All capabilities follow hexagonal architecture (ports and adapters pattern):
Capability/
├── ports/ # Abstract interfaces (provider-agnostic contracts)
├── adapters/ # Provider-specific implementations
├── models/ # Data models and base classes
├── config/ # Configuration management
├── exceptions/ # Custom exception hierarchy
└── [capability]_manager.py # Public API with singleton pattern
Benefits:
- 🔄 Provider-agnostic: Switch implementations without code changes
- ✅ Testable: Mock ports for unit testing
- 🔌 Extensible: Add new providers by implementing port interfaces
- 🧩 Composable: Combine capabilities in larger applications
Development
Local Installation
# Clone repository
git clone https://github.com/neuronos/neuronos_python_capabilities_library
cd neuronos_python_capabilities_library
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
Running Tests
# All tests
pytest -v
# With coverage report
pytest --cov=neuronos_capabilities --cov-report=html
# Specific capability tests
pytest neuronos_capabilities/SQLManager/tests/ -v
Building and Publishing
# Build distributions (wheel + source)
./build.sh
# Build and publish to PyPI (requires PyPI credentials)
./build.sh --deploy_pypi
Roadmap
Future capabilities planned:
- CacheManager: Redis, Memcached, and in-memory caching
- QueueManager: RabbitMQ, AWS SQS, message queue abstraction
- StorageManager: S3, Azure Blob, file storage abstraction
- AuthManager: JWT, OAuth2, authentication/authorization
Contributing
Contributions welcome! Please ensure:
- Follow hexagonal architecture principles
- Implement both sync and async methods
- Include comprehensive tests
- Add detailed documentation
- Update CHANGELOG.md
License
MIT License - see LICENSE file for details.
Links
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
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 neuronos_capabilities-0.0.1.tar.gz.
File metadata
- Download URL: neuronos_capabilities-0.0.1.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f0d9bafac8233987bc298b2f2e785f1ae53f3e5524189f496e738ef77b59b6e
|
|
| MD5 |
07312b73879bee05baca35fc3785da07
|
|
| BLAKE2b-256 |
3e546d084cbad43f7f4bb567dffeb0a12c29adeacf6531344fe8ef63a82e8ab6
|
File details
Details for the file neuronos_capabilities-0.0.1-py3-none-any.whl.
File metadata
- Download URL: neuronos_capabilities-0.0.1-py3-none-any.whl
- Upload date:
- Size: 35.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f0305c41ca2abeb2d789871ab01780913975c1e1e2aa398a384b25ae86a4d61
|
|
| MD5 |
f5ad86c362712c67204d032d6b2c31f9
|
|
| BLAKE2b-256 |
a2d3a58ed4b2e6a79f5d433d3fff749aa64fd81b533d8e5e24ec34f382818b11
|