FuPy


NameFuPy JSON
Version 0.8.2 PyPI version JSON
download
home_pageNone
SummaryFunctional Programming in Python, for Education
upload_time2024-07-02 22:10:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT License Copyright (c) 2024 - Eindhoven University of Technology, The Netherlands Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords functional programming education
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img src="https://gitlab.tue.nl/t-verhoeff-software/fupy/-/raw/main/images/FuPy.png" alt="FuPy logo" style="float: right; margin-left: 20px; margin-bottom: 20px;">

# FuPy: Functional Programming in Python, for Education

[![Pipeline Status](https://gitlab.tue.nl/t-verhoeff-software/fupy/badges/main/pipeline.svg)](https://gitlab.tue.nl/t-verhoeff-software/fupy/pipelines)
[![Test Coverage](https://gitlab.tue.nl/t-verhoeff-software/fupy/badges/main/coverage.svg)](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/commits/main)
[![Latest Release](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/badges/release.svg)](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/releases)[![PyPI version](https://badge.fury.io/py/FuPy.svg)](https://badge.fury.io/py/FuPy)
[![License](https://img.shields.io/badge/license-MIT-brightgreen)](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/blob/main/LICENSE.txt)
[![Documentation Status](https://readthedocs.org/projects/fupy/badge/?version=latest)](https://fupy.readthedocs.io/en/latest/?badge=latest)
[![Python Versions](https://img.shields.io/pypi/pyversions/FuPy.svg)](https://pypi.org/project/FuPy/)

## Overview

* [Documentation](https://fupy.readthedocs.io/en/latest/)
* For some examples, see [demo.py](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/raw/main/examples/demo.py).

Python offers (limited) support for functional programming:
* functions are first-class citizens;
* functions can take functions as arguments and can return functions
* lambda expressions for anonymous functions

`FuPy` aims to overcome some limitations, by adding:
* basic types and type constructors
  - `Empty` type without values
  - `Unit` type with value `unit`
  - `Either[A, B]` (disjoint sum) type
  - `Both[A, B]` (product) type (tuple)
  - `Func[A, B]` function space type
* function composition and other function combinators
  - `@` for head-to-tail composition, also written as ⚬
  - `&` for split, also written as △
  - `|` for case, also written as ▽
  - `*` for product (functor over product/tuple type), also written as ⨯
  * `+` for sum (functor over sum/Either type), also written as +
  * `**` for repeated composition, also written with a superscript
* auto (un)packing of arguments in case of functions with no/multiple arguments
* predefined common functions:
  - `id_`, `const`, `left`, `right`, `guard`, `first`, `second`
  - `curry`, `uncurry`, `flip`, `ap`,
  - `compose`, `split`, `case_`, `fplus`, `ftimes`, `fpower`, `fpower_left`
* [operator sections](https://wiki.haskell.org/Section_of_an_infix_operator)
* lazy expressions (suspended computations)
* printable function and lambda expressions
* evaluation tracing
* inductive and co-inductive types
  - `Functor`, `fmap`
  - `Fix`, `fix`
  - `cata` (catamorphisms, folds)
  - `ana` (anamorphims, unfolds)

Main classes:
* `Func`, for composable, printable, and traceable functions with auto-(un)packing of arguments.
* `OperatorSection`, for operator sections
* `Lazy`, for lazy expressions.

Not intended for industrial use:
* there are performance penalties in terms of memory and execution overhead

Notes:
* Type hints do not all verify (but it works).
  The Python type system is too limited
  (we need Higher-Kinded Types, HKTs).
* Binding strength of function combinators are as applied by Python,
  doesn't correspond to the theory.

## Future work
* Applicatives and monads

## Installation

``` shell
pip install FuPy
```

## Development (for developers)

* Build:
  ```shell
  python -m build
  ```
* Test:
  ```shell
  pytest
  ```
* Build documentation:
  In `docs/`
  ```shell
  make clean
  make html
  ```
* Upload to [PyPI](https://pypi.org/):
  ```shell
  twine upload dist/*
  ```

## Authors and acknowledgment

* Tom Verhoeff (Eindhoven University of Technology, Netherlands)

## License

[MIT License](LICENSE.txt)

## Project status

* Under development, but already usable
* Documentation:
  - incomplete
  - Sphinx version still has issues
* Test cases: incomplete
* Functionality:
  - functions only print in mixed Math/Python notation
  - level of detail in tracing cannot be selected
  - limited form of laziness
* [Issues](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/issues)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "FuPy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "functional programming, education",
    "author": null,
    "author_email": "\"Tom Verhoeff (Eindhoven Univesity of Technology)\" <T.Verhoeff@tue.nl>",
    "download_url": "https://files.pythonhosted.org/packages/16/14/b7bef9e9d626f517790cb69cb1a001a008becfb70e35258efad0cc426f0f/fupy-0.8.2.tar.gz",
    "platform": null,
    "description": "<img src=\"https://gitlab.tue.nl/t-verhoeff-software/fupy/-/raw/main/images/FuPy.png\" alt=\"FuPy logo\" style=\"float: right; margin-left: 20px; margin-bottom: 20px;\">\n\n# FuPy: Functional Programming in Python, for Education\n\n[![Pipeline Status](https://gitlab.tue.nl/t-verhoeff-software/fupy/badges/main/pipeline.svg)](https://gitlab.tue.nl/t-verhoeff-software/fupy/pipelines)\n[![Test Coverage](https://gitlab.tue.nl/t-verhoeff-software/fupy/badges/main/coverage.svg)](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/commits/main)\n[![Latest Release](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/badges/release.svg)](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/releases)[![PyPI version](https://badge.fury.io/py/FuPy.svg)](https://badge.fury.io/py/FuPy)\n[![License](https://img.shields.io/badge/license-MIT-brightgreen)](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/blob/main/LICENSE.txt)\n[![Documentation Status](https://readthedocs.org/projects/fupy/badge/?version=latest)](https://fupy.readthedocs.io/en/latest/?badge=latest)\n[![Python Versions](https://img.shields.io/pypi/pyversions/FuPy.svg)](https://pypi.org/project/FuPy/)\n\n## Overview\n\n* [Documentation](https://fupy.readthedocs.io/en/latest/)\n* For some examples, see [demo.py](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/raw/main/examples/demo.py).\n\nPython offers (limited) support for functional programming:\n* functions are first-class citizens;\n* functions can take functions as arguments and can return functions\n* lambda expressions for anonymous functions\n\n`FuPy` aims to overcome some limitations, by adding:\n* basic types and type constructors\n  - `Empty` type without values\n  - `Unit` type with value `unit`\n  - `Either[A, B]` (disjoint sum) type\n  - `Both[A, B]` (product) type (tuple)\n  - `Func[A, B]` function space type\n* function composition and other function combinators\n  - `@` for head-to-tail composition, also written as \u26ac\n  - `&` for split, also written as \u25b3\n  - `|` for case, also written as \u25bd\n  - `*` for product (functor over product/tuple type), also written as \u2a2f\n  * `+` for sum (functor over sum/Either type), also written as +\n  * `**` for repeated composition, also written with a superscript\n* auto (un)packing of arguments in case of functions with no/multiple arguments\n* predefined common functions:\n  - `id_`, `const`, `left`, `right`, `guard`, `first`, `second`\n  - `curry`, `uncurry`, `flip`, `ap`,\n  - `compose`, `split`, `case_`, `fplus`, `ftimes`, `fpower`, `fpower_left`\n* [operator sections](https://wiki.haskell.org/Section_of_an_infix_operator)\n* lazy expressions (suspended computations)\n* printable function and lambda expressions\n* evaluation tracing\n* inductive and co-inductive types\n  - `Functor`, `fmap`\n  - `Fix`, `fix`\n  - `cata` (catamorphisms, folds)\n  - `ana` (anamorphims, unfolds)\n\nMain classes:\n* `Func`, for composable, printable, and traceable functions with auto-(un)packing of arguments.\n* `OperatorSection`, for operator sections\n* `Lazy`, for lazy expressions.\n\nNot intended for industrial use:\n* there are performance penalties in terms of memory and execution overhead\n\nNotes:\n* Type hints do not all verify (but it works).\n  The Python type system is too limited\n  (we need Higher-Kinded Types, HKTs).\n* Binding strength of function combinators are as applied by Python,\n  doesn't correspond to the theory.\n\n## Future work\n* Applicatives and monads\n\n## Installation\n\n``` shell\npip install FuPy\n```\n\n## Development (for developers)\n\n* Build:\n  ```shell\n  python -m build\n  ```\n* Test:\n  ```shell\n  pytest\n  ```\n* Build documentation:\n  In `docs/`\n  ```shell\n  make clean\n  make html\n  ```\n* Upload to [PyPI](https://pypi.org/):\n  ```shell\n  twine upload dist/*\n  ```\n\n## Authors and acknowledgment\n\n* Tom Verhoeff (Eindhoven University of Technology, Netherlands)\n\n## License\n\n[MIT License](LICENSE.txt)\n\n## Project status\n\n* Under development, but already usable\n* Documentation:\n  - incomplete\n  - Sphinx version still has issues\n* Test cases: incomplete\n* Functionality:\n  - functions only print in mixed Math/Python notation\n  - level of detail in tracing cannot be selected\n  - limited form of laziness\n* [Issues](https://gitlab.tue.nl/t-verhoeff-software/fupy/-/issues)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 - Eindhoven University of Technology, The Netherlands  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Functional Programming in Python, for Education",
    "version": "0.8.2",
    "project_urls": {
        "Documentation": "https://gitlab.tue.nl/t-verhoeff-software/FuPy/docs",
        "Homepage": "https://gitlab.tue.nl/t-verhoeff-software/FuPy",
        "Issues": "https://gitlab.tue.nl/t-verhoeff-software/fupy/-/issues",
        "Source": "https://gitlab.tue.nl/t-verhoeff-software/FuPy/src"
    },
    "split_keywords": [
        "functional programming",
        " education"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ed8586865ea433667a25736165c93f4506db9f4c106efe7f69e6daf608bba7f",
                "md5": "7c4e6953427a26f06491511713b1e85f",
                "sha256": "8e9cd40aacbc33d604bc6b761d1c49203c6602eba0a3f77197fdd858d55e98a0"
            },
            "downloads": -1,
            "filename": "FuPy-0.8.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7c4e6953427a26f06491511713b1e85f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 26388,
            "upload_time": "2024-07-02T22:10:20",
            "upload_time_iso_8601": "2024-07-02T22:10:20.873167Z",
            "url": "https://files.pythonhosted.org/packages/9e/d8/586865ea433667a25736165c93f4506db9f4c106efe7f69e6daf608bba7f/FuPy-0.8.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1614b7bef9e9d626f517790cb69cb1a001a008becfb70e35258efad0cc426f0f",
                "md5": "4c15807d7f5b35651f5b8669aba19a84",
                "sha256": "98d04f5d636e8c22d5ca6061938f01fa1cfb0584b2659c4e21681d65a5e0f82e"
            },
            "downloads": -1,
            "filename": "fupy-0.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4c15807d7f5b35651f5b8669aba19a84",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 24808,
            "upload_time": "2024-07-02T22:10:22",
            "upload_time_iso_8601": "2024-07-02T22:10:22.273451Z",
            "url": "https://files.pythonhosted.org/packages/16/14/b7bef9e9d626f517790cb69cb1a001a008becfb70e35258efad0cc426f0f/fupy-0.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-02 22:10:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "fupy"
}
        
Elapsed time: 0.30659s