{"id":19001143,"url":"https://github.com/wemake-services/safe-assert","last_synced_at":"2025-07-27T15:04:49.733Z","repository":{"id":48538488,"uuid":"217622023","full_name":"wemake-services/safe-assert","owner":"wemake-services","description":"Safe and composable assert for Python that can be used together with optimised mode","archived":false,"fork":false,"pushed_at":"2025-07-15T13:52:41.000Z","size":906,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-23T15:45:47.618Z","etag":null,"topics":["assert","mypy","mypy-stubs","pep561","python","python3","type-safety","utility"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/safe-assert/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wemake-services.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"wemake-services","custom":"https://boosty.to/sobolevn"}},"created_at":"2019-10-25T22:15:01.000Z","updated_at":"2025-07-15T13:52:38.000Z","dependencies_parsed_at":"2024-03-06T16:28:31.568Z","dependency_job_id":"ce84f95a-893d-4934-a843-d2ca939c4581","html_url":"https://github.com/wemake-services/safe-assert","commit_stats":{"total_commits":119,"total_committers":5,"mean_commits":23.8,"dds":0.2773109243697479,"last_synced_commit":"c85559bdf614523c2f3a0a29776beba00552825f"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/wemake-services/safe-assert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fsafe-assert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fsafe-assert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fsafe-assert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fsafe-assert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wemake-services","download_url":"https://codeload.github.com/wemake-services/safe-assert/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wemake-services%2Fsafe-assert/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267375522,"owners_count":24077286,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["assert","mypy","mypy-stubs","pep561","python","python3","type-safety","utility"],"created_at":"2024-11-08T18:10:05.410Z","updated_at":"2025-07-27T15:04:49.699Z","avatar_url":"https://github.com/wemake-services.png","language":"Python","funding_links":["https://github.com/sponsors/wemake-services","https://boosty.to/sobolevn"],"categories":[],"sub_categories":[],"readme":"# safe-assert\n\n[![wemake.services](https://img.shields.io/badge/%20-wemake.services-green.svg?label=%20\u0026logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC%2FxhBQAAAAFzUkdCAK7OHOkAAAAbUExURQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP%2F%2F%2F5TvxDIAAAAIdFJOUwAjRA8xXANAL%2Bv0SAAAADNJREFUGNNjYCAIOJjRBdBFWMkVQeGzcHAwksJnAPPZGOGAASzPzAEHEGVsLExQwE7YswCb7AFZSF3bbAAAAABJRU5ErkJggg%3D%3D)](https://wemake.services)\n[![test](https://github.com/wemake-services/safe-assert/workflows/test/badge.svg?branch=master\u0026event=push)](https://github.com/wemake-services/safe-assert/actions?query=workflow%3Atest)\n[![codecov](https://codecov.io/gh/wemake-services/safe-assert/branch/master/graph/badge.svg)](https://codecov.io/gh/wemake-services/safe-assert)\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]) -\u003e List[int]:\n    safe_assert(all(num \u003e= 0 for num in numbers), 'found negative')\n    return sorted(numbers)\n\nsort_positive_numbers([1, 2, 3])  # =\u003e will work\nsort_positive_numbers([-1, 2, 3])\n# =\u003e 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 conjunction 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/wemake-services/safe-assert/blob/master/safe_assert/__init__.py) to learn more.\n\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwemake-services%2Fsafe-assert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwemake-services%2Fsafe-assert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwemake-services%2Fsafe-assert/lists"}