Skip to main content

Fluent async workflows with lazy execution for Python

Project description

🚀 FlowKit - Simplify Async Workflows

PyPI version Python 3.8+ License: MIT Tests

FlowKit provides fluent async workflows with lazy execution and minimal boilerplate.

Why FlowKit?

Before (Traditional Async):

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("https://api.example.com/posts", params={"userId": user_id}) as posts_response:
                posts = await posts_response.json()
                return {"user": user, "posts": posts}

After (FlowKit):

@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

  • 🔗 Fluent API - Chain operations with .pipe() method
  • 🛡️ Type Safe - Full IDE support and type hints
  • 🚀 Modern Foundation - Built on battle-tested httpx
  • 🔧 Framework Ready - FastAPI, Django, Flask examples
  • 📦 Simple Installation - pip install flowkit-async

📦 Installation

pip install flowkit-async

🔧 How FlowKit Works

FlowKit provides lazy async pipelines - operations are queued and executed when awaited.

import flowkit

# FlowKit operations return awaitable Flow objects
user_flow = flowkit.get("https://api.example.com/users/1")
posts_flow = flowkit.get("https://api.example.com/posts")

# Execute both operations
user = await user_flow.json()
posts = await posts_flow.json()

Core Concept: Flow Objects

Flow objects are awaitable pipelines that:

  • Chain operations without immediate execution
  • Execute when awaited in the current event loop
  • Enable fluent, readable async patterns

This is structured async workflows, not sync-to-async magic.

🔧 How FlowKit Works

FlowKit provides lazy async pipelines. API calls return awaitable Flow objects that record operations and execute asynchronously when awaited.

FlowKit does NOT:

  • convert blocking code into async
  • use threads or greenlets
  • bypass the event loop

This is structured async composition, not async magic.

🏆 Real-World Examples

Data Processing Pipeline

@flowkit.simple
def fetch_user_data(user_id: int):
    """Fetch and process user data."""
    return (flowkit.get(f"https://jsonplaceholder.typicode.com/users/{user_id}")
              .json()
              .pipe(lambda user: {**user, "processed": True}))

Note: @flowkit.simple is intended for synchronous functions. If used on async functions, it acts as a pass-through wrapper.

Concurrent Operations

@flowkit.simple
def fetch_dashboard():
    """Fetch multiple data sources concurrently."""
    users = flowkit.get("https://jsonplaceholder.typicode.com/users").json()
    posts = flowkit.get("https://jsonplaceholder.typicode.com/posts").json()
    comments = flowkit.get("https://jsonplaceholder.typicode.com/comments").json()
    
    # These execute concurrently when awaited
    return {"users": users, "posts": posts, "comments": comments}

🛠 When to Use FlowKit

FlowKit is ideal for:

  • API-heavy applications with multiple calls
  • Data pipelines and processing workflows
  • Teams wanting consistent async patterns
  • Rapid prototyping with clean syntax

⚠️ Important Notes

FlowKit does NOT:

  • Block the event loop or use thread pools
  • Make synchronous code magically non-blocking
  • Replace understanding of asyncio fundamentals
  • Work with CPU-bound operations

Always use async/await with CPU-intensive tasks.

🆚 How FlowKit Compares

Feature FlowKit aiohttp httpx requests
Fluent API
Type Safe
Sessions
Pipelines

FlowKit provides structured async workflows with minimal overhead on top of httpx and is comparable in performance for typical I/O-bound workloads.

📋 License

MIT License - see LICENSE file for details.

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.


🚀 Try FlowKit today for cleaner async workflows:

pip install flowkit-async

⭐ 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-1.0.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

flowkitx-1.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flowkitx-1.0.1.tar.gz
Algorithm Hash digest
SHA256 eaaf42055ed49e95ba42d9a9d3c983da89d82614f725811c84c33998e2908fa9
MD5 8188bd70ea0989c2160e1a5b3bacd7b8
BLAKE2b-256 df099b7b1f08eb311297df84bc51187fb482ffee315329aa7f9d7743f7089fb7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flowkitx-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d46fc41c04b98eae5670d0a5928f5522b6f942dfa5487a5846c037a9160510d
MD5 d506feb7a11514411696f6f8ff4c6471
BLAKE2b-256 60160d377ef301977dc3e04e658e9f41fba42ce7d4ba3556bd66bd22f03bc2c3

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