{ "info": { "author": "sobolevn", "author_email": "mail@sobolevn.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "[![lambdas logo](https://raw.githubusercontent.com/dry-python/brand/master/logo/lambdas.png)](https://github.com/dry-python/lambdas)\n\n-----\n\n[![Build Status](https://travis-ci.org/dry-python/lambdas.svg?branch=master)](https://travis-ci.org/dry-python/lambdas)\n[![Coverage Status](https://coveralls.io/repos/github/dry-python/lambdas/badge.svg?branch=master)](https://coveralls.io/github/dry-python/lambdas?branch=master)\n[![Documentation Status](https://readthedocs.org/projects/lambdas/badge/?version=latest)](https://lambdas.readthedocs.io/en/latest/?badge=latest)\n[![Python Version](https://img.shields.io/pypi/pyversions/lambdas.svg)](https://pypi.org/project/lambdas/)\n[![wemake-python-styleguide](https://img.shields.io/badge/style-wemake-000000.svg)](https://github.com/wemake-services/wemake-python-styleguide) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n\n-----\n\nWrite short and fully-typed `lambda`s where you need them.\n\n\n## Features\n\n- Allows to write `lambda`s as `_`\n- Fully typed with annotations and checked with `mypy`, [PEP561 compatible](https://www.python.org/dev/peps/pep-0561/)\n- Has a bunch of helpers for better composition\n- Easy to start: has lots of docs, tests, and tutorials\n\n\n## Installation\n\n```bash\npip install lambdas\n```\n\nWe also recommend to use the same `mypy` settings [we use](https://github.com/wemake-services/wemake-python-styleguide/blob/master/styles/mypy.toml).\n\n\n## Examples\n\nImagine that you need to sort an array of dictionaries like so:\n\n```python\nscores = [\n {'name': 'Nikita', 'score': 2},\n {'name': 'Oleg', 'score': 1},\n {'name': 'Pavel', 'score': 4},\n]\n\nprint(sorted(scores, key=lambda item: item['score']))\n```\n\nAnd it works perfectly fine.\nExcept, that you have to do a lot of typing for such a simple operation.\n\nThat's where `lambdas` helper steps in:\n\n```python\nscores = [\n {'name': 'Nikita', 'score': 2},\n {'name': 'Oleg', 'score': 1},\n {'name': 'Pavel', 'score': 4},\n]\n\nprint(sorted(scores, key=_['score']))\n```\n\nIt might really save you a lot of effort,\nwhen you use a lot of `lambda` functions.\nLike when using [`returns`](https://github.com/dry-python/returns) library.\n\nWork in progress:\n\n- `_.some_attribute` is not supported yet, because we need a complex `mypy` plugin for this\n- `_.method()` is not supported yet for the same reason\n- `TypedDict`s are not tested with `__getitem__`\n- `__getitem__` does not work with list and tuples (collections), only dicts (mappings)\n\nFor now you will have to use regular `lamdba`s in these cases.\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://lambdas.readthedocs.io", "keywords": "functional programming,fp,lambda,lambdas,composition,type-safety,mypy,stubs", "license": "BSD-2-Clause", "maintainer": "sobolevn", "maintainer_email": "mail@sobolevn.me", "name": "lambdas", "package_url": "https://pypi.org/project/lambdas/", "platform": "", "project_url": "https://pypi.org/project/lambdas/", "project_urls": { "Homepage": "https://lambdas.readthedocs.io", "Repository": "https://github.com/dry-python/lambdas" }, "release_url": "https://pypi.org/project/lambdas/0.1.0/", "requires_dist": [ "typing-extensions (>=3.7,<4.0)" ], "requires_python": ">=3.6,<4.0", "summary": "Typed lambdas that are short and readable", "version": "0.1.0" }, "last_serial": 6002891, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e66444961c6c85c27e9515ce80d1bf19", "sha256": "b197d7cf464b9733944cf9b9cf73d05d934b19eaf0c32fc04a9e7dd25b5ce321" }, "downloads": -1, "filename": "lambdas-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e66444961c6c85c27e9515ce80d1bf19", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 4371, "upload_time": "2019-10-20T13:39:56", "url": "https://files.pythonhosted.org/packages/69/82/366db987b7c5ec36cb0b4b78211085ce954e669d6e2fc7a67ccabe973f81/lambdas-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7bcb33cc74df722deb1843734f447908", "sha256": "a595cfbcea23bf7295a821563044785d0dc843b39d21ccaee5c3a79afe79e140" }, "downloads": -1, "filename": "lambdas-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7bcb33cc74df722deb1843734f447908", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 4335, "upload_time": "2019-10-20T13:39:58", "url": "https://files.pythonhosted.org/packages/ae/8e/fca52d7944063d05659382921110946272feec474123b954821a4e4e8fcb/lambdas-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e66444961c6c85c27e9515ce80d1bf19", "sha256": "b197d7cf464b9733944cf9b9cf73d05d934b19eaf0c32fc04a9e7dd25b5ce321" }, "downloads": -1, "filename": "lambdas-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e66444961c6c85c27e9515ce80d1bf19", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 4371, "upload_time": "2019-10-20T13:39:56", "url": "https://files.pythonhosted.org/packages/69/82/366db987b7c5ec36cb0b4b78211085ce954e669d6e2fc7a67ccabe973f81/lambdas-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7bcb33cc74df722deb1843734f447908", "sha256": "a595cfbcea23bf7295a821563044785d0dc843b39d21ccaee5c3a79afe79e140" }, "downloads": -1, "filename": "lambdas-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7bcb33cc74df722deb1843734f447908", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 4335, "upload_time": "2019-10-20T13:39:58", "url": "https://files.pythonhosted.org/packages/ae/8e/fca52d7944063d05659382921110946272feec474123b954821a4e4e8fcb/lambdas-0.1.0.tar.gz" } ] }