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, making implementations swappable without changing your application code.
Installation
pip install neuronos-capabilities
What is a Capability?
A capability is a self-contained backend module that follows hexagonal architecture (ports and adapters pattern):
Capability/
├── ports/ # Abstract interfaces — defines WHAT operations exist
├── adapters/ # Provider implementations — defines HOW they work
├── config/ # Configuration management
├── exceptions/ # Custom exception hierarchy
└── [name]_manager.py # Public API — single entrypoint for consumers
You interact only with the Manager. The port defines the contract, and adapters implement it for specific providers. Switching from PostgreSQL to MySQL, or from Clerk to Auth0, is just a config change.
Available Capabilities
| Capability | Description | Providers | Docs |
|---|---|---|---|
| SQLManager | Database management with ORM, migrations, connection pooling | PostgreSQL | docs/sql-manager.md |
| AuthManager | JWT authentication and role-based authorization for FastAPI | Clerk | docs/auth-manager.md |
SQLManager — Quick Look
from neuronos_capabilities import SQLManager
config = {"host": "localhost", "database": "myapp", "user": "postgres", "password": "secret"}
with SQLManager(config) as db:
db.create_tables([User])
user = db.insert(User, {"name": "Alice", "email": "alice@example.com"})
users = db.query(User, {"name": "Alice"})
AuthManager — Quick Look
from neuronos_capabilities import AuthManager
from fastapi import FastAPI, Depends
auth = AuthManager() # reads NEURONOS_AUTH_JWKS_URL from env
app = FastAPI()
@app.get("/api/protected")
async def protected(user: dict = Depends(auth.require_auth())):
return {"user_id": user["sub"]}
@app.get("/api/admin")
async def admin(user: dict = Depends(auth.require_roles(["org:admin"]))):
return {"message": "Admin access granted"}
Development
git clone https://github.com/neuronos/neuronos_python_capabilities_library
cd neuronos_python_capabilities_library
pip install -e ".[dev]"
pytest -v
pytest --cov=neuronos_capabilities --cov-report=html
Contributing
- Follow hexagonal architecture: port → adapter → manager
- Implement both sync and async methods
- Include tests and documentation
- Update this README with the new capability
License
MIT — see LICENSE
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.2.tar.gz.
File metadata
- Download URL: neuronos_capabilities-0.0.1.2.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e05dfc76a3d9bcbaaab8cc52255f5ed8a728af59b7f247288e5f53e0e934ab40
|
|
| MD5 |
74cf935ff95bf8f16b2c9f8aec56442d
|
|
| BLAKE2b-256 |
d795a64b3e49c207b128c8f491f8dc3ae2bf32e7f93d894fe1d5b654c77e4960
|
File details
Details for the file neuronos_capabilities-0.0.1.2-py3-none-any.whl.
File metadata
- Download URL: neuronos_capabilities-0.0.1.2-py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6c62e41295a675c83ca1b344e88ce11bed7ccdd27195f13a09c5c854c9c076d
|
|
| MD5 |
339132ad7331c45b7082017b0bef3210
|
|
| BLAKE2b-256 |
5263eec295263065b55d6a10a9dbaf71f964b641790244c861657aabbd05cbc4
|