{"id":18656602,"url":"https://github.com/zendesk/pakkr","last_synced_at":"2025-04-11T18:30:57.050Z","repository":{"id":44866597,"uuid":"188324036","full_name":"zendesk/pakkr","owner":"zendesk","description":"Python pipeline utility library","archived":true,"fork":false,"pushed_at":"2023-07-25T20:08:42.000Z","size":201,"stargazers_count":18,"open_issues_count":5,"forks_count":4,"subscribers_count":245,"default_branch":"master","last_synced_at":"2025-03-13T08:04:17.801Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zendesk.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":"2019-05-24T00:15:06.000Z","updated_at":"2024-11-23T16:33:46.000Z","dependencies_parsed_at":"2023-01-25T11:00:26.508Z","dependency_job_id":null,"html_url":"https://github.com/zendesk/pakkr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fpakkr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fpakkr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fpakkr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fpakkr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zendesk","download_url":"https://codeload.github.com/zendesk/pakkr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247941702,"owners_count":21022036,"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-07T07:24:18.464Z","updated_at":"2025-04-11T18:30:56.626Z","avatar_url":"https://github.com/zendesk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![repo-checks](https://github.com/zendesk/pakkr/workflows/repo-checks/badge.svg)\n# PAKKR\nPython pipeline utility library\n\n# Description\nIn the process of building machine learning things at Zendesk, we have noticed that a lot of the steps are sequential where later steps rely on outputs of previous steps. Because Python functions only return a single value (`return` with multiple values are returned as a tuple), deconstructing and keeping track of return values becomes tedious for long sequences of steps, especially when inputs are not returned from the immediately previous step.\n\nPAKKR is an utility created to remediate these pain points; it provides the user with a way to specify how return values should be interpreted and optionally caches results and injects them in later steps automatically.\n\n# Install from PyPi\n```bash\npip install pakkr\n```\n\n# Install from source\n```bash\ngit clone git@github.com:zendesk/pakkr.git\ncd pakkr\npython setup.py install\n```\n\n# Usage\n```python\nfrom pakkr import Pipeline, returns\n\n@returns(int, original_num_as_string=str)  # this function returns an integer and insert original_num_as_string into the meta cache\ndef times_two(n):\n  return n*2, {'original_num_as_string': str(n)}\n\n@returns(int, int)  # this functions returns two integers and will be passed on as two arguments\ndef plus_five_and_three(n):\n  return n + 5, n + 3\n\n@returns(str)\ndef summary(a, b, original_num_as_string):  # a and b are passed in as positional arguments,\n                                            # but original_num_as_string would be injected from the meta cache\n  return f'Original input was {original_num_as_string} and it became {str(a)} and {str(b)} after processing'\n\npipeline = Pipeline(times_two, plus_five_and_three, summary, _name='process_int')\nprint(pipeline(3))\n```\nRunning the above code should print:\n```\nOriginal input was 3 and it became 11 and 9 after processing\n```\n\n## What's going on?\n`returns` is used to indicate how the return values should be interpreted; `@returns(int, str, x=bool)` means the `Callable` should be returning something like `return 10, 'hello', {'x': True}` and the `10` and `'hello'` will be passed as two positional arguments into the next `Callable` while `x` would be cached in the meta space and be injected if any following `Callable`s require `x` but not being given as positional argument from the previous `Callable`.\n\n\n# Development\nThis project uses `tox` to manage testing on multiple Python versions assuming the required Python versions are available.\n```\ngit clone git@github.com:zendesk/pakkr.git\ncd pakkr\npip install tox\ntox\n```\n\nOptionally, uses `pyenv` and `pipenv` to manage Python installation and development dependencies.\n```bash\ngit clone git@github.com:zendesk/pakkr.git\ncd pakkr\n\n# Install pyenv, see instructions in https://github.com/pyenv/pyenv\n# Install Python versions supported by pakkr if not available locally\n# pyenv install 3.6.10\n# pyenv install 3.7.6\n# pyenv install 3.8.1\n\n# Set available Python verions\npyenv local 3.6.10 3.7.6 3.8.1\n\n# Install pipenv\npip install pipenv\npipenv sync --dev\n\n# Run tests\npipenv run tox\n```\n\n# Reporting Bugs\nPlease [raise an issue](https://github.com/zendesk/pakkr/issues/new) via GitHub.\n\n\n# Contributing\nImprovements are always welcome. Please follow these steps to contribute\n\n1. Submit a Pull Request with a detailed explanation of changes\n2. Receive approval from maintainers\n3. Maintainers will merge your changes\n\n# License\nUse of this software is subject to important terms and conditions as set forth in the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzendesk%2Fpakkr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzendesk%2Fpakkr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzendesk%2Fpakkr/lists"}