Skip to main content

Python functools for async!

Project description

Build Status License Documentation Status

aiofunctools

Library to help in Python functional programing. It’s asyncio compatible.

Basic idea behind it is Railway Oriented Programing.

This allows us to:

  • simplify our code.
  • improve error management.
  • be cool! be functional!

Examples:

Old code example:

async def create_user_handler(request) -> Response:
    try:
        user = check_valid_user(request)
        create_user(user)
    except InvalidBody:
        return_422('Invalid body')
    except UserAlreadyExists:
        return_409('User already exists')
    return_201(user)

ROP example:

async def create_user_handler(request) -> Response:
    return await compose(
        check_valid_user,
        create_user,
        return_201
    )(request)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

aiofunctools-0.0.3-py3-none-any.whl (14.8 kB view hashes)

Uploaded Python 3

Supported by

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