Skip to main content

Simplify async workflows in Python - reduce code complexity by 70%

Project description

๐Ÿš€ FlowKit - Simplify Async Workflows

PyPI version Python 3.8+ License: MIT Tests

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 flowkit and 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flowkit_async-0.1.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flowkit_async-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

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

Hashes for flowkit_async-0.1.0.tar.gz
Algorithm Hash digest
SHA256 28b751c6808adf6587d70745708695e8081094969a89424bd330aef577ff6017
MD5 0a14b84c442d210eceee779fa49c3d6b
BLAKE2b-256 0369922d6d5d565c37e6668a0763cbec9af9e47abddcf6292ae5ee749ae9be85

See more details on using hashes here.

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

Hashes for flowkit_async-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae2d2c96078d33c02747f953107347b9999d20078fe6cdde17587b4dc4251a77
MD5 4309d725c57ffb8387065f334b55a568
BLAKE2b-256 f51569db816ea9a375b78e7c6a77e47c0512e33b8c6d067511b9ac656a927634

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page