{"id":13500129,"url":"https://github.com/orsinium-labs/eff","last_synced_at":"2025-08-04T23:13:31.026Z","repository":{"id":65603705,"uuid":"313282890","full_name":"orsinium-labs/eff","owner":"orsinium-labs","description":"Python library to work with algebraic effects","archived":false,"fork":false,"pushed_at":"2020-11-17T15:18:29.000Z","size":5,"stargazers_count":74,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-17T16:54:24.959Z","etag":null,"topics":["algebraic-effects","dependency-injection","effects","python","side-effects"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"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/orsinium-labs.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":"2020-11-16T11:38:45.000Z","updated_at":"2025-05-24T05:14:47.000Z","dependencies_parsed_at":"2023-01-31T10:45:15.011Z","dependency_job_id":null,"html_url":"https://github.com/orsinium-labs/eff","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/orsinium-labs/eff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Feff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Feff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Feff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Feff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orsinium-labs","download_url":"https://codeload.github.com/orsinium-labs/eff/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orsinium-labs%2Feff/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265872279,"owners_count":23842155,"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":["algebraic-effects","dependency-injection","effects","python","side-effects"],"created_at":"2024-07-31T22:00:51.569Z","updated_at":"2025-08-04T23:13:30.998Z","avatar_url":"https://github.com/orsinium-labs.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Eff\n\nEff is a Python library to work with algebraic effects.\n\nAlgbraic effects are all side-effects of a piece of code, like reading a user input, writing a text on the screen, doing network requests, reading a file etc. Eff allows to easily handle such effects making the code cleaner and testing easier.\n\nFeatures:\n\n+ **Easy to understand**. You don't need to read long scientific papers to understand how to use the library and what it does.\n+ **Easy to integrate**. If you decided to add a logger into a function, changes will be minimal, no need to pass the logger down through the whole call stack.\n+ **Fast**. The classic approach for handling algebraic effects is using coroutines or exceptions. This library uses global shared state instead which doesn't require to unwrap the whole call stack at runtime.\n+ **Type-safe**. Effect handlers container is just a class. Annotate effect handlers type to make their usage type-safe.\n\n## Installation\n\n```bash\npython3 -m pip install --user eff\n```\n\n## Usage\n\n```python\nfrom io import StringIO\nfrom typing import Callable\n\nimport eff\n\nclass Eff(eff.ects):\n    show: Callable\n\n# Use global effects manager in a function.\ndef greet(username: str) -\u003e None:\n    Eff.show(f'Hello, {username}!')\n\n# Provide actual side-effects handlers\n# for the project prod entry point.\ndef main() -\u003e None:\n    with Eff(show=print):\n        greet('World')\n\n# Mock side-effects in tests.\ndef test_greet() -\u003e None:\n    stream = StringIO()\n    with Eff(show=stream.write):\n        greet('World')\n    stream.seek(0)\n    assert stream.read() == 'Hello, World!'\n\nif __name__ == '__main__':\n    main()\n```\n\n## Further reading\n\nYou don't have to read it but it's a good reading for better understanding of the motivation behind the library.\n\n+ [Why PLs Should Have Effect Handlers](https://robotlolita.me/diary/2018/10/why-pls-need-effects/)\n+ [Algebraic Effects for the Rest of Us](https://overreacted.io/algebraic-effects-for-the-rest-of-us/)\n+ [What does algebraic effects mean in FP?](https://stackoverflow.com/a/57280373)\n+ [Eff programming language](https://www.eff-lang.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forsinium-labs%2Feff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forsinium-labs%2Feff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forsinium-labs%2Feff/lists"}