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

flowkitx-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

flowkitx-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file flowkitx-0.1.0.tar.gz.

File metadata

  • Download URL: flowkitx-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for flowkitx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 690d134b4fd7690d27da8248c883be852ccf414af56df1926068f93f0a139516
MD5 2848993acd02170c1a538c72c2338bfe
BLAKE2b-256 2ae378198f3818eff68bf70c7fb920e3802d0d48777f3415389f71ad57d7d957

See more details on using hashes here.

File details

Details for the file flowkitx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flowkitx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for flowkitx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5854cd2f9b90df5f19ea42966eb3e7f3bd1135e290302b18cba4fb56f0317ceb
MD5 f1348f2601c8d316b2a8d38d113efae4
BLAKE2b-256 2eaba19f2943424761d43d9d8c63aae323ac50c267c6fd8020ff66bb7e43247a

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