{"id":6050,"library":"pyfunctional","title":"PyFunctional","description":"PyFunctional is a Python package designed for creating data pipelines using a functional programming paradigm, inspired by Scala and Spark. It provides tools for chaining operations on sequences, supporting lazy evaluation, parallel processing, and various data transformations. The current version is 1.5.0, and the project generally focuses on API stability since its 1.0.0 release.","status":"active","version":"1.5.0","language":"en","source_language":"en","source_url":"https://github.com/EntilZha/PyFunctional","tags":["functional programming","data pipelines","lazy evaluation","chaining","scala","spark"],"install":[{"cmd":"pip install pyfunctional","lang":"bash","label":"Install PyFunctional"}],"dependencies":[],"imports":[{"note":"Use `seq` for standard, lazy functional pipelines.","symbol":"seq","correct":"from functional import seq"},{"note":"Use `pseq` for pipelines that automatically leverage parallel processing for performance.","symbol":"pseq","correct":"from functional import pseq"}],"quickstart":{"code":"from functional import seq\n\n# Create a sequence from a range of numbers\nresult = seq(range(10))\n    .map(lambda x: x * x) # Square each number\n    .filter(lambda x: x > 10) # Keep numbers greater than 10\n    .reduce(lambda x, y: x + y, 0) # Sum the remaining numbers, starting with 0\n\nprint(result)\n# Expected output: 285","lang":"python","description":"This example demonstrates creating a sequence, applying common functional transformations like `map` and `filter`, and finally aggregating results with `reduce`."},"warnings":[{"fix":"Update `pip install scalafunctional` to `pip install pyfunctional` and change `from scalafunctional import ...` to `from functional import ...`.","message":"The library was renamed from `ScalaFunctional` to `PyFunctional` in version 0.6.0. Projects using the old package name will need to update their `install_requires` and import paths.","severity":"breaking","affected_versions":"<0.6.0"},{"fix":"Replace calls to `Sequence.zip_with_index()` with Python's built-in `enumerate()` for equivalent functionality.","message":"The behavior of `Sequence.zip_with_index` was modified in version 0.5.0. It no longer behaves as expected in previous versions and should be replaced.","severity":"breaking","affected_versions":"<0.5.0"},{"fix":"To force immediate evaluation for debugging or specific needs, append an action like `.to_list()` or `.to_dict()` at the point where you need the results.","message":"Starting from version 0.3.0, all operations in PyFunctional are lazy by default. This means transformations are not executed until an action (like `reduce`, `to_list`, `to_dict`, or iteration) consumes the sequence. This can lead to unexpected behavior if intermediate results are expected to be immediately available or if debugging relies on immediate evaluation.","severity":"gotcha","affected_versions":">=0.3.0"},{"fix":"If your pipeline operations are CPU-bound and you want to leverage multiple cores, ensure your pipeline starts with `from functional import pseq` and use `pseq(...)`.","message":"For automatic parallelization of pipeline operations (e.g., `map`, `filter`), you must explicitly import and use `pseq` instead of `seq`. `seq` does not use parallel processing.","severity":"gotcha","affected_versions":">=0.7.0"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}