{"id":46274285,"url":"https://github.com/daireto/simple-result","last_synced_at":"2026-03-04T04:01:14.425Z","repository":{"id":324618403,"uuid":"1097859165","full_name":"daireto/simple-result","owner":"daireto","description":"A very simple, fully typed Rust-like Result type for Python 3.","archived":false,"fork":false,"pushed_at":"2025-12-16T20:13:08.000Z","size":42,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-20T08:55:05.131Z","etag":null,"topics":["python","python3","result","result-pattern","rust","rust-like","strongly-typed","type-narrowing"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/simple-result/","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/daireto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-16T23:57:57.000Z","updated_at":"2025-12-18T12:49:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/daireto/simple-result","commit_stats":null,"previous_names":["daireto/simple-result"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/daireto/simple-result","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daireto%2Fsimple-result","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daireto%2Fsimple-result/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daireto%2Fsimple-result/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daireto%2Fsimple-result/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daireto","download_url":"https://codeload.github.com/daireto/simple-result/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daireto%2Fsimple-result/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30071670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T03:25:38.285Z","status":"ssl_error","status_checked_at":"2026-03-04T03:25:05.086Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["python","python3","result","result-pattern","rust","rust-like","strongly-typed","type-narrowing"],"created_at":"2026-03-04T04:01:13.736Z","updated_at":"2026-03-04T04:01:14.417Z","avatar_url":"https://github.com/daireto.png","language":"Python","readme":"# simple-result\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pypi.org/project/simple-result\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/pyversions/simple-result\" alt=\"Supported Python versions\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/simple-result\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/v/simple-result\" alt=\"Package version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/daireto/simple-result/actions\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://github.com/daireto/simple-result/actions/workflows/publish.yml/badge.svg\" alt=\"Publish\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"/LICENSE\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-green\" alt=\"License\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nA very simple, fully typed Rust-like Result type for Python 3.\n\nIf you need a Result type only for checking if an operation succeeded or failed,\nand don't need to perform special actions like chaining operations, mapping, etc.,\nthen this library is for you.\n\nIf you are looking for a more feature-rich Result type, check out\n[rustedpy/result](https://github.com/rustedpy/result).\n\n## Installation\n\n```bash\n# Using pip\npip install simple-result\n\n# Using Poetry\npoetry add simple-result\n\n# Using uv\nuv add simple-result\n```\n\n## Usage\n\n```python\nimport random\n\nfrom simple_result import Err, Ok, Result\n\ndef fetch_data() -\u003e Result[str, ConnectionError]:\n    fetched = random.choice([True, False])\n    if fetched:\n        return Ok('Data fetched!')\n    return Err(ConnectionError('Error fetching data!'))\n```\n\nCheck if the result is Ok or Err using type narrowing:\n\n```python\nif res := fetch_data():\n    print(res.value) # \"Data fetched!\"\n    print(res.error) # None\nelse:\n    print(res.error) # \"Error fetching data!\"\n    print(res.value) # None\n```\n\nOr using `match`:\n\n```python\nmatch fetch_data():\n    case Ok(data):\n        print(data) # \"Data fetched!\"\n    case Err(error):\n        print(error) # \"Error fetching data!\"\n\nmatch fetch_data():\n    case Ok(data):\n        print(data) # \"Data fetched!\"\n    case Err(error, code):\n        print(error, code) # \"Error fetching data! 1\"\n```\n\nCall `.unwrap_value()` to get the value or raise an `UnwrapError` if the result\nis `Err`:\n\n```python\nfrom simple_result import UnwrapError\n\ntry:\n    res = Err(ConnectionError('Error fetching data!'))\n    print(res.unwrap_value())\nexcept UnwrapError as exc:\n    print(str(exc)) # called `Result.unwrap_value()` on an `Err` value\n    print(exc.result.error) # \"Error fetching data!\"\n```\n\nCall `.unwrap_error()` to get the error or raise an `UnwrapError` if the result\nis `Ok`:\n\n```python\ntry:\n    res = Ok('Data fetched!')\n    print(res.unwrap_error())\nexcept UnwrapError as exc:\n    print(str(exc)) # called `Result.unwrap_error()` on an `Ok` value\n    print(exc.result.value) # \"Data fetched!\"\n```\n\nCompare results:\n\n```python\nassert Ok(1) == Ok(1)\nassert Ok(1) != Ok(2)\n\nexc = ValueError('error')\nassert Err(exc) == Err(exc)\n\nother_exc = ValueError('other error')\nassert Err(exc) != Err(other_exc)\n```\n\nCheck if the result is `Ok` or `Err` using `isinstance`:\n\n```python\nfrom simple_result import ResultOption\n\nres = fetch_data()\nassert isinstance(res, ResultOption)\nassert isinstance(res, (Ok, Err))\n```\n\n## Contributing\n\nSee the [contribution guidelines](CONTRIBUTING.md).\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE)\nfile for details.\n\n## Support\n\nIf you find this project useful, give it a ⭐ on GitHub!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaireto%2Fsimple-result","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaireto%2Fsimple-result","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaireto%2Fsimple-result/lists"}