{"id":16314835,"url":"https://github.com/smarie/python-mini-lambda","last_synced_at":"2025-10-25T16:08:43.881Z","repository":{"id":57441779,"uuid":"110528246","full_name":"smarie/python-mini-lambda","owner":"smarie","description":"Simple lambda functions without `lambda x:` prefix and with string conversion capability.","archived":false,"fork":false,"pushed_at":"2020-04-24T16:13:14.000Z","size":1873,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-25T23:01:56.861Z","etag":null,"topics":["expr","expression","func","function","lambda","mini","minimal","print","simple","string","symbol","symbolic"],"latest_commit_sha":null,"homepage":"https://smarie.github.io/python-mini-lambda/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smarie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-13T09:35:56.000Z","updated_at":"2024-08-23T12:55:51.000Z","dependencies_parsed_at":"2022-09-26T17:20:54.786Z","dependency_job_id":null,"html_url":"https://github.com/smarie/python-mini-lambda","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/smarie/python-mini-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarie%2Fpython-mini-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarie%2Fpython-mini-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarie%2Fpython-mini-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarie%2Fpython-mini-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smarie","download_url":"https://codeload.github.com/smarie/python-mini-lambda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarie%2Fpython-mini-lambda/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261967098,"owners_count":23237661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expr","expression","func","function","lambda","mini","minimal","print","simple","string","symbol","symbolic"],"created_at":"2024-10-10T21:55:24.995Z","updated_at":"2025-10-25T16:08:43.801Z","avatar_url":"https://github.com/smarie.png","language":"Python","readme":"# python-mini-lambda\n\n[![Python versions](https://img.shields.io/pypi/pyversions/mini-lambda.svg)](https://pypi.python.org/pypi/mini-lambda/) [![Build Status](https://travis-ci.org/smarie/python-mini-lambda.svg?branch=master)](https://travis-ci.org/smarie/python-mini-lambda) [![Tests Status](https://smarie.github.io/python-mini-lambda/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-mini-lambda/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-mini-lambda/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-mini-lambda)\n\n[![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-mini-lambda/) [![PyPI](https://img.shields.io/pypi/v/mini-lambda.svg)](https://pypi.python.org/pypi/mini-lambda/) [![Downloads](https://pepy.tech/badge/mini-lambda)](https://pepy.tech/project/mini-lambda) [![Downloads per week](https://pepy.tech/badge/mini-lambda/week)](https://pepy.tech/project/mini-lambda) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-mini-lambda.svg)](https://github.com/smarie/python-mini-lambda/stargazers)\n\nSimple lambda functions without `lambda x:` and with string conversion capability. Originally developed in the [valid8](https://github.com/smarie/python-valid8) validation library.\n\nThis is the readme for developers. The documentation for users is available here: [https://smarie.github.io/python-mini-lambda/](https://smarie.github.io/python-mini-lambda/)\n\n\n## Building from sources + notes on this project's design principles \n\nThis project is basically code generating code generating code :)\n\nThe following command performs the first code generation. It updates the `mini_lambda/generated.py` file.\n\n```bash\npython ./code_generation/mini_lambda_methods_generation.py\n```\n\nIt is based on a [mako](http://www.makotemplates.org/) template located at `code_generation/mini_lambda_template.mako`.\n\nThe generated code contains functions that generate functions when called, such as:\n\n```python\ndef __gt__(self, other):\n    \"\"\" Returns a new LambdaExpression performing '\u003cr\u003e \u003e other' on the result \u003cr\u003e of this evaluator's evaluation \"\"\"\n    def ___gt__(input):\n        # first evaluate the inner function\n        r = self.evaluate(input)\n        # then call the method\n        return r \u003e evaluate(other, input)\n\n    # return a new LambdaExpression of the same type than self, with the new function as inner function\n    return type(self)(___gt__)\n```\n\nSo whenever you use the syntax provided, for example when you perform `power2 = x \u003e 2 |_`, it dynamically creates a 'closure' function (here `___gt__`), that will be called when you will later evaluate the expression on an input, as in `power2(3)`.\n\n\n## Want to contribute ?\n\nContributions are welcome ! Simply fork this project on github, commit your contributions, and create pull requests.\n\nHere is a non-exhaustive list of interesting open topics: [https://github.com/smarie/python-mini-lambda/issues](https://github.com/smarie/python-mini-lambda/issues)\n\n## Running the tests\n\nThis project uses `pytest`. \n\n```bash\npytest -v mini_lambda/tests/\n```\n\nYou may need to install requirements for setup beforehand, using \n\n```bash\npip install -r ci_tools/requirements-test.txt\n```\n\n## Packaging\n\nThis project uses `setuptools_scm` to synchronise the version number. Therefore the following command should be used for development snapshots as well as official releases: \n\n```bash\npython setup.py egg_info bdist_wheel rotate -m.whl -k3\n```\n\nYou need to [generate code](##building-from-sources--notes-on-this-projects-design-principles) before packaging.\n\nYou also may need to install requirements for setup beforehand, using \n\n```bash\npip install -r ci_tools/requirements-setup.txt\n```\n\n## Generating the documentation page\n\nThis project uses `mkdocs` to generate its documentation page. Therefore building a local copy of the doc page may be done using:\n\n```bash\nmkdocs build\n```\n\nYou may need to install requirements for doc beforehand, using \n\n```bash\npip install -r ci_tools/requirements-doc.txt\n```\n\n## Generating the test reports\n\nThe following commands generate the html test report and the associated badge. \n\n```bash\npytest --junitxml=junit.xml -v mini_lambda/tests/\nant -f ci_tools/generate-junit-html.xml\npython ci_tools/generate-junit-badge.py\n```\n\n### PyPI Releasing memo\n\nThis project is now automatically deployed to PyPI when a tag is created. Anyway, for manual deployment we can use:\n\n```bash\ntwine upload dist/* -r pypitest\ntwine upload dist/*\n```\n","funding_links":[],"categories":["Awesome Functional Python"],"sub_categories":["Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarie%2Fpython-mini-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmarie%2Fpython-mini-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarie%2Fpython-mini-lambda/lists"}