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.1.0.tar.gz (16.7 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.1.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fptk-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0ef0148ef922b27011d7ad0f7c5fa916e39a1209fb6b9ec86e9528a10c222c46
MD5 a01e88e88319efc6fffb74a123be8346
BLAKE2b-256 fb9bc3393e897a5c5ed932e4a0a0031d4ecb83e80cc1ff2e2a4e37107569f2c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for fptk-1.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: fptk-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7af05d554ccdc76b33b96cf0f8914385d0ab97fbc36c9db18d60463f34b35b8
MD5 0857565aeedece3ce0c1f6c1961aeb25
BLAKE2b-256 0e59940d182dee368e41f0900fd41c0433d0eb71eb887fe1eeb4fe9accdd9b20

See more details on using hashes here.

Provenance

The following attestation bundles were made for fptk-1.1.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