{ "info": { "author": "sobolevn", "author_email": "mail@sobolevn.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "# safe-assert\n\n[![wemake.services](https://img.shields.io/badge/%20-wemake.services-green.svg?label=%20&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC%2FxhBQAAAAFzUkdCAK7OHOkAAAAbUExURQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP%2F%2F%2F5TvxDIAAAAIdFJOUwAjRA8xXANAL%2Bv0SAAAADNJREFUGNNjYCAIOJjRBdBFWMkVQeGzcHAwksJnAPPZGOGAASzPzAEHEGVsLExQwE7YswCb7AFZSF3bbAAAAABJRU5ErkJggg%3D%3D)](https://wemake.services)\n[![Build Status](https://travis-ci.com/sobolevn/safe-assert.svg?branch=master)](https://travis-ci.com/sobolevn/safe-assert)\n[![Coverage](https://coveralls.io/repos/github/sobolevn/safe-assert/badge.svg?branch=master)](https://coveralls.io/github/sobolevn/safe-assert?branch=master)\n[![Python Version](https://img.shields.io/pypi/pyversions/safe-assert.svg)](https://pypi.org/project/safe-assert/)\n[![wemake-python-styleguide](https://img.shields.io/badge/style-wemake-000000.svg)](https://github.com/wemake-services/wemake-python-styleguide)\n\nAllows users to write composable `assert`s that are not stripped away in [optimized mode](https://docs.python.org/3/using/cmdline.html#cmdoption-o).\n\n\n## Features\n\n- Single simple, pythonic, fast, tested, typed, documented function. That's it!\n- Because `safe_assert` is a function, it can be easily composed with other functions\n- Fully typed with annotations and checked with mypy, [PEP561 compatible](https://www.python.org/dev/peps/pep-0561/)\n\n\n## Installation\n\n```bash\npip install safe-assert\n```\n\n\n## Examples\n\nThe usage is identical to `assert` keyword, but a function:\n\n```python\nfrom safe_assert import safe_assert\n\ndef sort_positive_numbers(numbers: List[int]) -> List[int]:\n safe_assert(all(num >= 0 for num in numbers), 'found negative')\n return sorted(numbers)\n\nsort_positive_numbers([1, 2, 3]) # => will work\nsort_positive_numbers([-1, 2, 3])\n# => will fail in runtime with `AssertionError`\n```\n\nHow is it different from regular `assert`?\nThe major one is that it would not be stripped away with `-O` flag.\nSo, it still allows to write declarative checks that are safe in production.\n\nThe second one is that you can compose it as any other regular function.\nUseful in conjuction with [`dry-python`](https://github.com/dry-python) projects.\n\n\n## Internals\n\nHow does it work internally?\nIt internally raises [`AssertionError`](https://docs.python.org/3/library/exceptions.html#AssertionError) that is also used by the `assert` keyword itself.\n\nSee [docs](https://github.com/sobolevn/safe-assert/blob/master/safe_assert/__init__.py) to learn more.\n\n\n## License\n\nMIT.\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sobolevn/safe-assert", "keywords": "assert,utility,helper,optimized mode", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "safe-assert", "package_url": "https://pypi.org/project/safe-assert/", "platform": "", "project_url": "https://pypi.org/project/safe-assert/", "project_urls": { "Homepage": "https://github.com/sobolevn/safe-assert", "Repository": "https://github.com/sobolevn/safe-assert" }, "release_url": "https://pypi.org/project/safe-assert/0.2.0/", "requires_dist": null, "requires_python": ">=3.6,<4.0", "summary": "Safe assert for Python that can be used together with optimised mode", "version": "0.2.0", "yanked": false, "yanked_reason": null }, "last_serial": 7203115, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "cc39dd69ea750f9b16415d20ea22bd68", "sha256": "78362c92bf0058f637cf69940ee0b43542413532632573b3a54e47fbac033aa7" }, "downloads": -1, "filename": "safe_assert-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "cc39dd69ea750f9b16415d20ea22bd68", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 4191, "upload_time": "2019-10-26T09:27:15", "upload_time_iso_8601": "2019-10-26T09:27:15.035684Z", "url": "https://files.pythonhosted.org/packages/d8/3a/2aa8b49cbcfe58a7baa363447e32f4282e4debd0888c8b67d67fc829fa2a/safe_assert-0.1.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "7e3277264b03d51c314513a8459e77fb", "sha256": "581ded9f0116d3667bc3486d8010a4f19195ffe62c9e82b710fe037ca54d1f1c" }, "downloads": -1, "filename": "safe-assert-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7e3277264b03d51c314513a8459e77fb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 4055, "upload_time": "2019-10-26T09:27:13", "upload_time_iso_8601": "2019-10-26T09:27:13.005714Z", "url": "https://files.pythonhosted.org/packages/6d/8e/53c66a672f809ef96dc6b33397f7293cf6b4929770c0119f7d6640294b45/safe-assert-0.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "90806dc090ae49e4329c70d5ddd28cab", "sha256": "5f8138562945aa1e102159b64d5db33c32133b7a55de2dcda45d018018eb4c84" }, "downloads": -1, "filename": "safe_assert-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "90806dc090ae49e4329c70d5ddd28cab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 4224, "upload_time": "2020-05-09T09:55:20", "upload_time_iso_8601": "2020-05-09T09:55:20.443819Z", "url": "https://files.pythonhosted.org/packages/be/4b/4336537c0eecea67b743bc744ff1a5200af970e1da9f5751f9f2123b4869/safe_assert-0.2.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "5231b365a095b3884149c3a53c1ca5ec", "sha256": "ac010a2544a993c3b17f60e54e14e7c82c64a8d4ced810fbbef05b6efc855931" }, "downloads": -1, "filename": "safe-assert-0.2.0.tar.gz", "has_sig": false, "md5_digest": "5231b365a095b3884149c3a53c1ca5ec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 4155, "upload_time": "2020-05-09T09:55:19", "upload_time_iso_8601": "2020-05-09T09:55:19.419879Z", "url": "https://files.pythonhosted.org/packages/25/ac/1321abe0a2397019bb2b2d225c5af9479f82d306983c79070d88564990ca/safe-assert-0.2.0.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "90806dc090ae49e4329c70d5ddd28cab", "sha256": "5f8138562945aa1e102159b64d5db33c32133b7a55de2dcda45d018018eb4c84" }, "downloads": -1, "filename": "safe_assert-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "90806dc090ae49e4329c70d5ddd28cab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 4224, "upload_time": "2020-05-09T09:55:20", "upload_time_iso_8601": "2020-05-09T09:55:20.443819Z", "url": "https://files.pythonhosted.org/packages/be/4b/4336537c0eecea67b743bc744ff1a5200af970e1da9f5751f9f2123b4869/safe_assert-0.2.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "5231b365a095b3884149c3a53c1ca5ec", "sha256": "ac010a2544a993c3b17f60e54e14e7c82c64a8d4ced810fbbef05b6efc855931" }, "downloads": -1, "filename": "safe-assert-0.2.0.tar.gz", "has_sig": false, "md5_digest": "5231b365a095b3884149c3a53c1ca5ec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 4155, "upload_time": "2020-05-09T09:55:19", "upload_time_iso_8601": "2020-05-09T09:55:19.419879Z", "url": "https://files.pythonhosted.org/packages/25/ac/1321abe0a2397019bb2b2d225c5af9479f82d306983c79070d88564990ca/safe-assert-0.2.0.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }