Skip to main content

fptk (Functional Programming Toolkit) — Pragmatic functional programming helpers for Python (pipe/compose/curry, Option/Result, lazy iterators, applicative validation).

Project description

fptk

Pragmatic functional programming for Python 3.13+

PyPI Python CI License


Install

pip install fptk

Quick Example

from fptk.core.func import pipe
from fptk.adt.option import Some, NOTHING
from fptk.adt.result import Ok, Err

# Compose transformations
result = pipe(5, lambda x: x + 1, lambda x: x * 2)  # 12

# Handle absence explicitly
name = Some("alice").map(str.upper).unwrap_or("anonymous")  # "ALICE"

# Type-safe error handling
def parse(s: str) -> Result[int, str]:
    try:
        return Ok(int(s))
    except ValueError:
        return Err(f"invalid: {s}")

parse("42").map(lambda x: x * 2)  # Ok(84)

Documentation

mhbxyz.github.io/fptk

License

MIT

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

fptk-1.0.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fptk-1.0.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file fptk-1.0.0.tar.gz.

File metadata

  • Download URL: fptk-1.0.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fptk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 be8b7d79255733a726ac8129a35ec91f584ddc995c422297c21cc2da1f9cbcb9
MD5 8f7ac4f49345676e608563fa7a5979ba
BLAKE2b-256 9a30c155699fa94752293a7913bcfb87839900f33e0f48cc956d9fea16af01ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for fptk-1.0.0.tar.gz:

Publisher: release.yml on mhbxyz/fptk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fptk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: fptk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fptk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3faeaaf49031dd65c91680a03cd10d172a5efa89b911e3cb9a0b2a8096d9aa8
MD5 7e41c517544933428b6d09f07e7a216d
BLAKE2b-256 03077a9b2383b03038af0a09001717572eb8f8e8df53279f6d71a83de0d43348

See more details on using hashes here.

Provenance

The following attestation bundles were made for fptk-1.0.0-py3-none-any.whl:

Publisher: release.yml on mhbxyz/fptk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page