Skip to main content

NoFuture

NoFuture

pipeline status

No futures. No exceptions. Just explicit values.

MayBe et Result pour Python, built en Rust (PyO3 + maturin).

Manifeste

Tu veux du safe ? Prends un try/except.

  • pas d'exceptions fantomes
  • pas de magie: tout est explicite
  • pas de futur promis: on assume Nothing / Err
from nofuture import MayBe, Result

Installation

pip install nofuture

Dev mode: maturin develop

MayBe

Valeur optionnelle: Just(value) ou Nothing.

MayBe.just(42)      # Just(42)
MayBe.nothing()     # Nothing

# API
.is_just() / .is_nothing()
.unwrap()                    # raise si Nothing
.expect(msg)                 # raise avec message custom si Nothing
.or_else(default)            # valeur ou default
.to_option()                 # valeur ou None
.map(fn)                     # Just(fn(x)) ou Nothing
.flat_map(fn)                # fn doit retourner MayBe
.match(just=fn, nothing=fn)  # pattern matching
>> fn                        # flat_map
| default                    # or_else
.__len__()                   # 1 si Just, 0 si Nothing
.__iter__()                  # itération sur 0/1 élément
.__bool__()                  # truthiness (Just -> True)
.__repr__()                  # "Just(x)" / "Nothing"
.__class_getitem__()         # support MayBe[T]

Result

Succès ou erreur: Ok(value) ou Err(message, code?, details?). La vie en binaire, avec du contexte.

Result.ok(42)
Result.err("not found", code="NOT_FOUND")
Result.err("validation", code="INVALID", details={"field": "name"})
Result.from_dict({"ok": True, "value": 42})  # réciproque de to_dict

# API
.is_ok() / .is_err()
.unwrap()              # raise si Err
.expect(msg)           # raise avec message custom si Err
.unwrap_or(default)    # valeur ou default
.unwrap_err()          # (msg, code, details) ou raise
.to_option()           # valeur ou None
.map(fn)               # Ok(fn(x)) ou Err passthrough
.map_err(fn)           # fn(msg, code, details) -> (msg, code, details)
.flat_map(fn)          # fn doit retourner Result
.and_then(fn)          # alias flat_map
.match(ok=fn, err=fn)  # pattern matching (err reçoit msg, code, details)
.to_dict()             # {"ok": True, "value": ...} ou {"ok": False, "error": ...}
>> fn                  # flat_map
| default              # unwrap_or
.__len__()             # 1 si Ok, 0 si Err
.__iter__()            # itération sur 0/1 élément
.__bool__()            # truthiness (Ok -> True)
.__repr__()            # "Ok(x)" / "Err('msg')"
.__class_getitem__()   # support Result[T, E]

Typage générique

MayBe et Result supportent la syntaxe générique pour le typage statique :

from nofuture import MayBe, Result
from typing import Any

# MayBe[T] pour les valeurs optionnelles
def find_user(id: int) -> MayBe[User]:
    ...

# Result[T, E] pour les opérations faillibles
MyResult = Result[dict[str, Any], str]

Itération

MayBe et Result se comportent comme des collections de 0 ou 1 élément :

len(MayBe.just(42))      # 1
len(MayBe.nothing())     # 0

for x in Result.ok("hi"):
    print(x)

value, = MayBe.just("ok")    # unpacking

Exemples

Quelques exemples concrets pour voir MayBe et Result en action :

  • base.py : les bases (construction, mapping, chaînage)
  • objects.py : intégration avec dataclasses et objets métier
  • result.py : pipelines d'erreurs et sérialisation
  • iteration.py : itération, unpacking, builtins
  • websocket_app.py + websocket_client.py : mini‑app complète

Tout le détail (dépendances, commandes, payloads, explications) est dans examples/README.md.

Tests

python3 -m unittest discover -s tests -p 'test_*.py'

Metadata

Release files for nofuture 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nofuture 1.2.1
File Size Uploaded Provenance Actions
nofuture-1.2.1.tar.gz 42.0 kB With provenance Details for nofuture-1.2.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for nofuture 1.2.1
File Actions
nofuture-1.2.1-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for nofuture-1.2.1-cp312-abi3-win_amd64.whl
nofuture-1.2.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for nofuture-1.2.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
nofuture-1.2.1-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for nofuture-1.2.1-cp312-abi3-macosx_11_0_arm64.whl
nofuture-1.2.1-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for nofuture-1.2.1-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 1.0 MB

Release files / nofuture-1.2.1.tar.gz

Download URL nofuture-1.2.1.tar.gz
Size 42.0 kB
Tags Source
SHA-256 checksum
How to use checksums
97597061303ebc62e3f6ad4f12ec385ce29e8067eee6d4f4e853c2ecdb4f69c1
BLAKE2b-256 checksum
How to use checksums
62ea4c20176f67635e31707c31a18125d485e8d7a6d60458beccfdf19f05ece8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

Release files / nofuture-1.2.1-cp312-abi3-win_amd64.whl

Download URL nofuture-1.2.1-cp312-abi3-win_amd64.whl
Size 156.8 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
721287dfd3910cc8f5be84b930fa1f69574f816da4cb70c13589cdfd2c5884da
BLAKE2b-256 checksum
How to use checksums
03908b98016b2e3ca417d4c4191153beafc8499a81cbccc84eb060a37d5ec47e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

Release files / nofuture-1.2.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL nofuture-1.2.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 298.1 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
6621b6eedada94a568a2e01152465efb459f7e4b4d6ec0841952f90debcad1de
BLAKE2b-256 checksum
How to use checksums
695c286ff7d083e066e848afd9bd13beddd3b00ebd7c9687b4e5bea99d193ffa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

Release files / nofuture-1.2.1-cp312-abi3-macosx_11_0_arm64.whl

Download URL nofuture-1.2.1-cp312-abi3-macosx_11_0_arm64.whl
Size 263.4 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b81123762effefe71b2f18b21b943bcabd2212639768f68d48d2c8b7ad9fc8ba
BLAKE2b-256 checksum
How to use checksums
8f00ce1c747ee0dfa41884dc16757a0a8d5b3851107a4bcbc7137620fd1c6207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

Release files / nofuture-1.2.1-cp312-abi3-macosx_10_12_x86_64.whl

Download URL nofuture-1.2.1-cp312-abi3-macosx_10_12_x86_64.whl
Size 266.0 kB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a8dc451e8282b68e5903b444c94850627ab8d4a0554835b42498616471d598b4
BLAKE2b-256 checksum
How to use checksums
ff9a7b1074b63b4d3e454712e109ef19c75f2fea06b8ba33cdd3fd339efb13c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

Security for nofuture 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for nofuture-1.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page