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.0rc1.tar.gz (16.3 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.0rc1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fptk-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 16.3 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.0rc1.tar.gz
Algorithm Hash digest
SHA256 07633cca5edcd63ee0c1a14bd5bfdad623a6f4aa071c168e5c3c2153f5782428
MD5 613bd0522e2b0691cfdb4462d3626903
BLAKE2b-256 8bc9fd04e8c5c8bed9051a4f2430e1828b61cd848f7fcb06268be9bd7ddc9410

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: fptk-1.0.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 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.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 e89f2add5d96451c1b2bf3f408834a9586bd60066338ecb0005472277bc0848a
MD5 6384b03129401f23ca9172002417e783
BLAKE2b-256 871e3517f0d43210a58becc2da02e0fb9c6387153de2678a9f98561ccd00e905

See more details on using hashes here.

Provenance

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