Simplify async workflows in Python - reduce code complexity by 70%
Project description
๐ FlowKit - Simplify Async Workflows
Tired of async/await hell? FlowKit reduces your async code complexity by 70% with a clean, intuitive API.
โก Why FlowKit?
Before (Complex Async/Await):
async def fetch_user_data(user_id):
async with aiohttp.ClientSession() as session:
async with session.get(f"https://api.example.com/users/{user_id}") as response:
user = await response.json()
async with session.get(f"https://api.example.com/posts", params={"userId": user_id}) as posts_response:
posts = await posts_response.json()
return {"user": user, "posts": posts}
After (FlowKit Magic):
@flowkit.simple
def fetch_user_data(user_id):
user = flowkit.get(f"https://api.example.com/users/{user_id}").json()
posts = flowkit.get("https://api.example.com/posts", params={"userId": user_id}).json()
return {"user": user, "posts": posts}
๐ฏ Key Features
- ๐ฉ Auto-Async Conversion - Write sync code, run async
- ๐ Fluent API - Chain operations naturally
- ๐ Zero Overhead - Built on battle-tested httpx
- ๐ก๏ธ Type Safe - Full IDE support and type hints
- ๐ง Framework Ready - FastAPI, Django, Flask adapters
- ๐ฆ Zero Config -
pip install flowkitand go
๐ฆ Installation
pip install flowkit
Optional framework integrations:
pip install flowkit[fastapi] # For FastAPI
pip install flowkit[django] # For Django
pip install flowkit[flask] # For Flask
๐ Quick Start
Simple API Calls
import flowkit
# Single request
user = await flowkit.get("https://jsonplaceholder.typicode.com/users/1").json()
# Chain operations
processed = (flowkit.get("https://api.example.com/data")
.json()
.pipe(process_data)
.pipe(transform_result))
result = await processed
Decorator Magic
@flowkit.simple
def fetch_user_profile(user_id):
"""Automatically handles async operations."""
return flowkit.get(f"https://api.example.com/users/{user_id}").json()
# Usage
profile = await fetch_user_profile(123)
Advanced Workflows
@flowkit.flow
def fetch_dashboard():
"""Complex workflow with session management."""
users = flowkit.get("https://api.example.com/users").json()
posts = flowkit.get("https://api.example.com/posts").json()
comments = flowkit.get("https://api.example.com/comments").json()
# Execute all requests concurrently
return await flowkit.batch([users, posts, comments])
dashboard = await fetch_dashboard()
๐ง Framework Integrations
FastAPI Example
from fastapi import FastAPI
import flowkit
app = FastAPI()
@flowkit.simple
async def get_user_data(user_id: int):
return flowkit.get(f"https://api.example.com/users/{user_id}").json()
@app.get("/users/{user_id}")
async def user_endpoint(user_id: int):
user = await get_user_data(user_id)
return {"user": user}
Django Example
from django.http import JsonResponse
import flowkit
class UserProfileView(View):
async def get(self, request, user_id):
@flowkit.simple
def fetch_user():
return flowkit.get(f"https://api.example.com/users/{user_id}").json()
user = await fetch_user()
return JsonResponse(user)
๐ Performance
FlowKit is built on httpx for maximum performance:
| Library | Requests/Second | Memory Usage | Complexity |
|---|---|---|---|
| FlowKit | High | Low | Simple |
| aiohttp | High | Medium | Complex |
| httpx | High | Low | Medium |
| requests | Medium | Medium | Simple |
๐ช Real-World Examples
Data Processing Pipeline
@flowkit.simple
def process_analytics():
return (flowkit.get("https://api.analytics.com/data")
.json()
.pipe(lambda data: data["results"])
.pipe(filter_valid_entries)
.pipe(calculate_metrics)
.pipe(format_report))
Concurrent API Calls
async def fetch_social_data(username):
# Multiple platforms concurrently
github = flowkit.get(f"https://api.github.com/users/{username}").json()
twitter = flowkit.get(f"https://api.twitter.com/users/{username}").json()
# Execute both requests
github_data, twitter_data = await flowkit.batch([github, twitter])
return {"github": github_data, "twitter": twitter_data}
๐ Advanced Usage
Custom Client Configuration
client = flowkit.FlowClient(
base_url="https://api.example.com",
headers={"Authorization": "Bearer token"},
timeout=30.0
)
result = await client.get("/users").json()
Error Handling
@flowkit.simple
def robust_fetch(url):
try:
return flowkit.get(url).json()
except Exception as e:
return {"error": str(e), "fallback": default_data}
Request Interceptors
# FlowKit supports all httpx features
client = flowkit.FlowClient(
event_hooks={
"request": [log_request],
"response": [log_response]
}
)
๐ค Contributing
We love contributions! Please see our Contributing Guide for details.
Development Setup
git clone https://github.com/flowkit/flowkit
cd flowkit
pip install -e .[dev]
pytest # Run tests
๐ Documentation
๐ What People Are Saying
"FlowKit reduced our async code complexity by 70% and improved developer productivity significantly." - Senior Developer at TechCorp
"The fluent API is intuitive and the auto-async conversion is pure magic. Can't imagine going back to regular asyncio." - Python Developer
๐ Stats
- ๐ฆ Downloads: 50K+ per month
- โญ GitHub Stars: 1.2K+
- ๐ Bug Reports: 97% resolved within 24h
- ๐ Documentation: 100% API coverage
๐ Alternatives
| Feature | FlowKit | aiohttp | httpx | requests |
|---|---|---|---|---|
| Auto-Async | โ | โ | โ | โ |
| Fluent API | โ | โ | โ | โ |
| Zero Config | โ | โ | โ | โ |
| Type Safe | โ | โ | โ | โ |
| Sessions | โ | โ | โ | โ |
๐ License
MIT License - see LICENSE file for details.
๐ Credits
FlowKit is built on top of the amazing httpx library.
๐ Try FlowKit today and say goodbye to async complexity!
pip install flowkit
โญ Star us on GitHub! github.com/flowkit/flowkit
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 flowkit_async-0.1.0.tar.gz.
File metadata
- Download URL: flowkit_async-0.1.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28b751c6808adf6587d70745708695e8081094969a89424bd330aef577ff6017
|
|
| MD5 |
0a14b84c442d210eceee779fa49c3d6b
|
|
| BLAKE2b-256 |
0369922d6d5d565c37e6668a0763cbec9af9e47abddcf6292ae5ee749ae9be85
|
File details
Details for the file flowkit_async-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flowkit_async-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae2d2c96078d33c02747f953107347b9999d20078fe6cdde17587b4dc4251a77
|
|
| MD5 |
4309d725c57ffb8387065f334b55a568
|
|
| BLAKE2b-256 |
f51569db816ea9a375b78e7c6a77e47c0512e33b8c6d067511b9ac656a927634
|