{"id":20098478,"url":"https://github.com/fluentpython/abacus","last_synced_at":"2025-05-06T05:32:08.895Z","repository":{"id":223524126,"uuid":"760524682","full_name":"fluentpython/abacus","owner":"fluentpython","description":"Metaprogramming in service of user experience","archived":false,"fork":false,"pushed_at":"2024-02-20T19:16:38.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T09:11:20.509Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluentpython.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-20T15:24:01.000Z","updated_at":"2024-02-21T22:44:22.000Z","dependencies_parsed_at":"2024-02-20T18:26:04.637Z","dependency_job_id":"6f1a6def-27b2-4b85-b1f7-8578d007e97c","html_url":"https://github.com/fluentpython/abacus","commit_stats":null,"previous_names":["ramalho/abacus"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentpython%2Fabacus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentpython%2Fabacus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentpython%2Fabacus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentpython%2Fabacus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluentpython","download_url":"https://codeload.github.com/fluentpython/abacus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252629232,"owners_count":21779171,"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":[],"created_at":"2024-11-13T17:04:00.108Z","updated_at":"2025-05-06T05:32:08.490Z","avatar_url":"https://github.com/fluentpython.png","language":"Python","readme":"# abacus\n\nThe `abacus` module is an example of module metaprogramming\nin service of developer experience.\n\nThe end-user APIs for `plain_abacus` and `abacus` are the same.\nPlease view their module-level docstrings for examples.\n\nBut `abacus` uses metaprogramming to elliminate the code\nduplication in the `add` and `sub` functions of `plain_abacus`.\n\nThe metaprogramming features are:\n\n* `@command`: decorator to register a method name as a command;\n* `@command_alias`: decorator to register a method name and aliases as a command;\n* `_make_command`: builds a stand-alone function from an `Abacus` method;\n* `_install_commands`: makes commands and installs them as global functions;\n\n**Note**:\n`abacus` has more lines of code and is much harder to understand than `plain_abacus`.\nHowever, this example was inspired by the\n[jupyturtle](https://github.com/ramalho/jupyturtle) project,\nwhere the `Turtle` class has many more methods than `Abacus`,\ntherefore coding each global function by hand would require\na lot of duplication and many more lines of code.\n\nWhen using metaprogramming, it's always a good idea to consider\nwhether the added complexity is worthwhile.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluentpython%2Fabacus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluentpython%2Fabacus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluentpython%2Fabacus/lists"}