DEV Community

Discussion on: Write Unbreakable Python

Collapse
 
sobolevn profile image
Nikita Sobolev • Edited

Thanks a lot for this article!

Consider using returns library. It has several most useful monads like Maybe, Result, IO, IOResult, Reader, and their combinations.

The main feature of this library is that it is fully typed with mypy. So, mypy will check that you are writing correct code before even running it.

We also have beginner-friendly docs, so it would easy to teach your team to use it.

GitHub logo dry-python / returns

Make your functions return something meaningful, typed, and safe!

Returns logo


Build Status Coverage Status Documentation Status Python Version wemake-python-styleguide Checked with mypy


Make your functions return something meaningful, typed, and safe!

Features

  • Provides a bunch of primitives to write declarative business logic
  • Enforces better architecture
  • Fully typed with annotations and checked with mypy, PEP561 compatible
  • Has a bunch of helpers for better composition
  • Pythonic and pleasant to write and to read 🐍
  • Support functions and coroutines, framework agnostic
  • Easy to start: has lots of docs, tests, and tutorials

Installation

pip install returns

You might also want to configure mypy correctly and install our plugin to fix this existing issue:

# In setup.cfg or mypy.ini:
[mypy]
plugins =
  returns.contrib.mypy.decorator_plugin

We also recommend to use the same mypy settings we use.

Make sure you know how to get started, check out our docs!

Contents

Collapse
 
jesterxl profile image
Jesse Warden

Dude, that library is awesome. The annotations + automatic lifting of types is great!
I'll never be a fan of Python's TypeScript/Java inline typing style, ML/Haskell made me a fan of their way, but overall, I'm loving what I'm seeing in returns, thanks a lot for the share.

Collapse
 
sobolevn profile image
Nikita Sobolev

Thanks! I am open for any feedback from your side.

Thread Thread
 
jesterxl profile image
Jesse Warden

Keep creating stuff like that? Save the planet?