{"id":20033204,"url":"https://github.com/tbabej/taskpirate","last_synced_at":"2025-05-05T05:31:02.884Z","repository":{"id":30010434,"uuid":"33558567","full_name":"tbabej/taskpirate","owner":"tbabej","description":"A pluggable system for tasklib based TaskWarrior hooks. Faster, less boilerplate code!","archived":false,"fork":false,"pushed_at":"2024-12-05T00:32:09.000Z","size":14,"stargazers_count":50,"open_issues_count":4,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-26T23:28:45.588Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tbabej.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-07T17:42:57.000Z","updated_at":"2025-04-14T14:42:24.000Z","dependencies_parsed_at":"2022-09-03T21:30:18.945Z","dependency_job_id":null,"html_url":"https://github.com/tbabej/taskpirate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbabej%2Ftaskpirate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbabej%2Ftaskpirate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbabej%2Ftaskpirate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbabej%2Ftaskpirate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tbabej","download_url":"https://codeload.github.com/tbabej/taskpirate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252445797,"owners_count":21749119,"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-13T09:44:57.615Z","updated_at":"2025-05-05T05:31:02.877Z","avatar_url":"https://github.com/tbabej.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Taskpirate\n----------\n\nTaskpirate is a pluggable system for TaskWarrior python hooks.\n\nWhy?\n----\n\nSimpler hooks:\n\n    def hook_example(task):\n        task['description'] += \"changed by a hook\"\n\nThe above is fully working example, no more boilerplate needed.\n\nMuch faster execution time in case of multiple hooks (see [more details](#more-details)).\n\nInstall\n-------\n\nYou'll need tasklib as a dependency:\n\n    pip install tasklib\n\nThen you need to save `on-add-pirate` and `on-modify-pirate` from this repository into ~/.task/hooks/.\n\nAfter that, you can just clone any taskpirate-enabled hook as a subfolder into ~/.task/hooks/:\n\n    git clone https://github.com/tbabej/task.default-date-time ~/.task/hooks/default-date-time/\n\nHow to write a taskpirate hook\n------------------------------\n\nIn your hook's repository, any file matching `pirate_add*.py` will be searched for hooks in on-add event. In the same sense, any file matching `pirate_mod*.py` will be searched for hooks in on-modify event.\n\nNow, the pirate_add_example.py might look as follows:\n\n    def hook_example(task):\n        task['description'] += \"changed by a hook\"\n\nAny function in pirate_add_example that is called `hook_*` will be considered as a hook in on-add event. It will be passed the `Task` object corresponding to the current state of the task being added (as modified by the previous hooks).\n\nFor examples, look into my [task.default-date-time](https://github.com/tbabej/task.default-date-time) or [task.shift-recurrence](https://github.com/tbabej/task.shift-recurrence) hooks.\n\nMore details\n------------\n\nTaskWarrior hooks are intended to be simple, but they involve writing some boilerplate code (parsing/formatting json). To allow users to write dead simple code, they can leverage tasklib.\n\nUsing tasklib simplifies things a lot, however, it's not a super-lightweight - usage of tasklib can slow down the hook by as much as 30-50ms (usual python hook can probably run in under 40ms), since it imports multiple libraries.\n\nThis becomes a problem when user has multiple tasklib-based hooks, since the import time adds up.\n\nAlso, note that taskpirate with arbitrary number of hooks will be most likely faster than 2-3 regular python hooks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbabej%2Ftaskpirate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftbabej%2Ftaskpirate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbabej%2Ftaskpirate/lists"}