Manaflow
Async connection management for Manaflow services. This package provides utilities for managing database connections and other services with dependency injection.
Installation
pip install manaflow
Usage
import asyncio
import manaflow
from manaflow import secrets_manager
# Pre-populate secrets manager with scoped keys
secrets_manager.set_secret("postgres_conn_db_uri", "postgresql://user:pass@localhost/mydb")
secrets_manager.set_secret("redis_conn_cache_uri", "redis://localhost:6379")
# Define connection factories with scoped secrets
@manaflow.connection("postgres_conn_db", secret_keys=["uri"])
async def postgres_factory(uri: str):
# Use your preferred async PostgreSQL driver
return await create_postgres_pool(uri)
@manaflow.connection("redis_conn_cache", secret_keys=["uri"])
async def redis_factory(uri: str):
# Use your preferred async Redis driver
return await create_redis_connection(uri)
# Use connections with dependency injection
async def demo_postgres(db=manaflow.Depends("postgres_conn_db")):
# The connection is automatically retrieved and injected
connection = await db()
# Use the connection
return {"status": "success"}
# Run everything
async def main():
result = await demo_postgres()
print(result)
# Close all connections when done
await manaflow.connection.close_connections()
if __name__ == "__main__":
asyncio.run(main())
Features
- Async connection management with dependency injection
- Secret management for connection credentials
- Support for multiple connection types (PostgreSQL, MySQL, MongoDB, Redis, HTTP, etc.)
- No external dependencies required
License
MIT
Metadata
Release files for manaflow 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| manaflow-0.1.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| manaflow-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / manaflow-0.1.0.tar.gz
| Download URL | manaflow-0.1.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
632f7cfe62021e644fc282b5102a2eeb568449fc3c5dd3a5ca364787ecd8a62e
|
|
BLAKE2b-256 checksum How to use checksums |
d3e4068a3958c84dda4eb981478ae68b45f3984fbae7e543d919a12533d6292d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.0
|
Release files / manaflow-0.1.0-py3-none-any.whl
| Download URL | manaflow-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93bee6d29e6803ab6c2cc96bf0e63b6b3e0ab24f85af9687e4220f194e3af496
|
|
BLAKE2b-256 checksum How to use checksums |
261feac9d4831f6f168e0b5b7103a84b2a2f0a368bd342974e1dd00c81474173
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.0
|