Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Robust And Fast Functional IO Toolkit

License

NotificationsYou must be signed in to change notification settings

chrilves/raffiot.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raffiot is small (almost) dependency-free python library providing someusual functional tools. It currently provides

  • an easy-to-useIO monad which isstack-safe,fast, supportasynchronous,concurrent,parallel programming, has many other features.
  • aResource data type for easy but reliableresource management.
  • aResult 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 concurrentand parallel programing is inraffiot.

Note that this command will install raffiot in your current Python environment

Documentation

Theguide is online athttps://chrilves.github.io/raffiot.py/index.html.

TheAPI is online athttps://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 ontyping-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 injectionmade easy: make some context visible from anywhere.
  • simpleasynchronousandconcurrent programming: full support of synchronous,asynchronous and concurrent programmingwith the same simple API.
  • railway-oriented programming: clean and simple failure management.
  • distinctionbetweenexpected and unexpected failures: some failures are partof your program's normal behaviour (errors) while others are show somethingterribly wrong happened (panics). Yes, that's heavily inspired byRust.

Resource

Python has thewith construction, butResource goes a step further.

  • easy user-defined resource creation: just provide some open and closefunction.
  • 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, includingits wonderful failure management.

Result

Did I mentionRailway-Oriented Programming?Result is represent the 3 possibleresult of a computation:

  • Ok(value): the computation successfully computed the thisvalue.
  • Error(error): the computation failed on some expected failureerror, probablyfrom the business domain.
  • Panic(exception): the computation failed on some unexpected failureexception.

[8]ページ先頭

©2009-2025 Movatter.jp