NoFuture: explicit Maybe and Result types. No futures. No exceptions.
Project description
NoFuture
No futures. No exceptions. Just explicit values.
MayBe et Result pour Python, built en Rust (PyO3 + maturin).
from nofut 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
.or_else(default) # valeur ou default
.map(fn) # Just(fn(x)) ou Nothing
.flat_map(fn) # fn doit retourner MayBe
>> fn # flat_map
| default # or_else
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"})
# API
.is_ok() / .is_err()
.unwrap() # raise si Err
.unwrap_or(default) # valeur ou default
.unwrap_err() # (msg, code, details) ou raise
.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
.to_dict() # {"ok": True, "value": ...} ou {"ok": False, "error": ...}
>> fn # flat_map
| default # unwrap_or
Typage générique
MayBe et Result supportent la syntaxe générique pour le typage statique :
from nofut 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]
Exemples
Exemples progressifs (basics -> objets -> pipeline Result).
python3 examples/base.py
python3 examples/objects.py
python3 examples/result.py
Tests
python3 -m unittest discover -s tests -p 'test_*.py'
Changelog
Voir CHANGELOG.md
Licence
GPLv3 - voir LICENSE
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nofuture-1.0.2.tar.gz.
File metadata
- Download URL: nofuture-1.0.2.tar.gz
- Upload date:
- Size: 31.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86e9c4e663a307054456cc4deabcda454b94636aa91ad6c82ea4a87a958322f5
|
|
| MD5 |
c307cbc1c136b5b12e02b0794f73dcf4
|
|
| BLAKE2b-256 |
febb75aa9cde64c3128b8f210e5b51af819d6d9908d159e0da0aea3ef7d32a1a
|
Provenance
The following attestation bundles were made for nofuture-1.0.2.tar.gz:
Publisher:
publish.yml on aristofor/nofuture
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nofuture-1.0.2.tar.gz -
Subject digest:
86e9c4e663a307054456cc4deabcda454b94636aa91ad6c82ea4a87a958322f5 - Sigstore transparency entry: 785311730
- Sigstore integration time:
-
Permalink:
aristofor/nofuture@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/aristofor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nofuture-1.0.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: nofuture-1.0.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 150.3 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a7fc64a538e816f3f20def024b59f8fe9da479a194443463192e27ae5019fb9
|
|
| MD5 |
a67376db2def0e0acddbdc795aae0463
|
|
| BLAKE2b-256 |
9240022822c976a12097b13cacfc209e4d792fbf5c8b057d09a4df21b0bbeac3
|
Provenance
The following attestation bundles were made for nofuture-1.0.2-cp312-cp312-win_amd64.whl:
Publisher:
publish.yml on aristofor/nofuture
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nofuture-1.0.2-cp312-cp312-win_amd64.whl -
Subject digest:
3a7fc64a538e816f3f20def024b59f8fe9da479a194443463192e27ae5019fb9 - Sigstore transparency entry: 785311754
- Sigstore integration time:
-
Permalink:
aristofor/nofuture@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/aristofor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nofuture-1.0.2-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: nofuture-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 260.1 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2781a5f9fe5da30331757730dc122266abaceccbd5efcbd818cac9d6285df686
|
|
| MD5 |
930f24d9f2a9a9001b367166f5e22366
|
|
| BLAKE2b-256 |
80b9ad1cba471e3d2d255cfa865fad2edf577dd88196b4eaefc9332894ea0e91
|
Provenance
The following attestation bundles were made for nofuture-1.0.2-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
publish.yml on aristofor/nofuture
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nofuture-1.0.2-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
2781a5f9fe5da30331757730dc122266abaceccbd5efcbd818cac9d6285df686 - Sigstore transparency entry: 785311750
- Sigstore integration time:
-
Permalink:
aristofor/nofuture@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/aristofor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nofuture-1.0.2-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: nofuture-1.0.2-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 264.4 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70022fc9ed43ad07d7f40677f5bf00aec903faac419886f33f6e13b2a8b837b5
|
|
| MD5 |
ee715eba533d5fd8c2e26751b12c663a
|
|
| BLAKE2b-256 |
fec7ec7c5a24978b873226dbf2dbc9cb18364886579e6f0a9943ea17f6ccdf23
|
Provenance
The following attestation bundles were made for nofuture-1.0.2-cp312-cp312-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on aristofor/nofuture
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nofuture-1.0.2-cp312-cp312-macosx_10_12_x86_64.whl -
Subject digest:
70022fc9ed43ad07d7f40677f5bf00aec903faac419886f33f6e13b2a8b837b5 - Sigstore transparency entry: 785311736
- Sigstore integration time:
-
Permalink:
aristofor/nofuture@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/aristofor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nofuture-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: nofuture-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 298.1 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
449ff1dfde24bd02d2bcb6cd1f9977772cff9dc07e1acc6b746b88021985f0e5
|
|
| MD5 |
8d4f130f60b56f69269c23fc506d1fe2
|
|
| BLAKE2b-256 |
5e033b5e7198e49dd91da2dc78a99b08d297970ba19164a86f77b31c084af6eb
|
Provenance
The following attestation bundles were made for nofuture-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on aristofor/nofuture
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nofuture-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
449ff1dfde24bd02d2bcb6cd1f9977772cff9dc07e1acc6b746b88021985f0e5 - Sigstore transparency entry: 785311744
- Sigstore integration time:
-
Permalink:
aristofor/nofuture@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/aristofor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f44c4b707774e4c57ea6bfc83c344f7c3b0e6318 -
Trigger Event:
push
-
Statement type: