Robust And Fast Functional IO Toolkit
Project description
Robust And Fast Functional IO Toolkit
Raffiot is small (almost) dependency-free python library providing some usual functional tools. It currently provides
- an easy-to-use
IO
monad which is stack-safe, fast, support asynchronous, concurrent, parallel programming, has many other features. - a
Resource
data type for easy but reliable resource management. - a
Result
data structure to represent errors
Demo
For a demo, just type this in a terminal:
curl https://raw.githubusercontent.com/chrilves/raffiot.py/main/demos/raffiot_demo.sh | /bin/sh
This demo runs 4 computations in parallel. It demonstrates how simple concurrent and parallel programing is in raffiot.
Note that this command will install raffiot in your current Python environment
Documentation
Guide
The guide is online at https://chrilves.github.io/raffiot.py/index.html.
API
The API is online at https://chrilves.github.io/raffiot.py/api/index.html.
Features
- pure python: Raffiot is written entirely in Python 3.7+.
- small: it is just a few small files.
- (almost) dependency-free: it only depends on
typing-extensions
(for the@final
annotation). - crystal clear code
IO
- stack safe: you just won't run into stack overflows anymore.
- fast: you won't notice the overhead.
- dependency injection made easy: make some context visible from anywhere.
- simple asynchronous and concurrent programming: full support of synchronous, asynchronous and concurrent programming with the same simple API.
- railway-oriented programming: clean and simple failure management.
- distinction between expected and unexpected failures: some failures are part of your program's normal behaviour (errors) while others are show something terribly wrong happened (panics). Yes, that's heavily inspired by Rust.
Resource
Python has the with
construction, but Resource
goes a step further.
- easy user-defined resource creation: just provide some open and close function.
- composability: the resource you want to create depends on another resource? Not a problem, you can compose resources the way you want. It scales.
- failures handling in resources:
Resource
has everythingIO
has, including its wonderful failure management.
Result
Did I mention Railway-Oriented Programming? Result
is represent the 3 possible
result of a computation:
Ok(value)
: the computation successfully computed the thisvalue
.Error(error)
: the computation failed on some expected failureerror
, probably from the business domain.Panic(exception)
: the computation failed on some unexpected failureexception
.
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
File details
Details for the file raffiot-0.6.3.tar.gz
.
File metadata
- Download URL: raffiot-0.6.3.tar.gz
- Upload date:
- Size: 40.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07a07aef11ad43b109c501a93a4de9d1b89fc9fb4c1544dd3cd5788fcaca761a |
|
MD5 | 6695e3506a561584c2baf36c968705f8 |
|
BLAKE2b-256 | 07e1518fe2e503a845ce5f3dd3a49e2cb5814619e16b83b54b22533b12332c47 |