Giter VIP home page Giter VIP logo

raffiot.py's Introduction

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

The guide is online at https://chrilves.github.io/raffiot.py/index.html.

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 everything IO 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 this value.
  • Error(error): the computation failed on some expected failure error, probably from the business domain.
  • Panic(exception): the computation failed on some unexpected failure exception.

raffiot.py's People

Contributors

chrilves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sdaves

raffiot.py's Issues

Production state of the code

Hello,

First let me tell you that I am very impressed by the amount of documentation and resource you have put into this library.
I am very interested in using it in production and would like your feedback considering the library development state.
I did not have yet the chance to watch https://www.youtube.com/watch?v=PYWWSbNwVuc, so sorry if you already answered it there.
You are probably biased but that would be nice to know if you are already using it for your own production project or if it was more of an experiment.

Thanks

Alexis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.