{"id":15065036,"url":"https://github.com/larq/zookeeper","last_synced_at":"2025-06-25T06:07:18.741Z","repository":{"id":34977434,"uuid":"184554869","full_name":"larq/zookeeper","owner":"larq","description":"A small library for managing deep learning models, hyperparameters and datasets","archived":false,"fork":false,"pushed_at":"2024-02-05T05:19:12.000Z","size":4388,"stargazers_count":24,"open_issues_count":14,"forks_count":10,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-15T10:09:42.150Z","etag":null,"topics":["command-line-interface","deep-learning","hyperparameter","keras","machine-learning","python","tensorflow","tensorflow-datasets"],"latest_commit_sha":null,"homepage":"","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/larq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2019-05-02T09:32:55.000Z","updated_at":"2025-05-07T11:25:04.000Z","dependencies_parsed_at":"2024-06-19T02:09:25.712Z","dependency_job_id":null,"html_url":"https://github.com/larq/zookeeper","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/larq/zookeeper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larq%2Fzookeeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larq%2Fzookeeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larq%2Fzookeeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larq%2Fzookeeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/larq","download_url":"https://codeload.github.com/larq/zookeeper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larq%2Fzookeeper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260453564,"owners_count":23011559,"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":["command-line-interface","deep-learning","hyperparameter","keras","machine-learning","python","tensorflow","tensorflow-datasets"],"created_at":"2024-09-25T00:29:52.791Z","updated_at":"2025-06-25T06:07:18.721Z","avatar_url":"https://github.com/larq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zookeeper\n\n[![GitHub Actions](https://github.com/larq/zookeeper/workflows/Unittest/badge.svg)](https://github.com/larq/zookeeper/actions?workflow=Unittest) [![Codecov](https://img.shields.io/codecov/c/github/larq/zookeeper)](https://codecov.io/github/larq/zookeeper?branch=main) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/zookeeper.svg)](https://pypi.org/project/zookeeper/) [![PyPI](https://img.shields.io/pypi/v/zookeeper.svg)](https://pypi.org/project/zookeeper/) [![PyPI - License](https://img.shields.io/pypi/l/zookeeper.svg)](https://github.com/plumerai/zookeeper/blob/main/LICENSE) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\nA small library for configuring modular applications.\n\n### Installation\n\n```console\npip install zookeeper\n```\n\n### Components\n\nThe fundamental building blocks of Zookeeper are components. The\n[`@component`](zookeeper/component.py) decorator is used to turn classes into\ncomponents. These component classes can have configurable fields, which are\ndeclared with the `Field` constructor and class-level type annotations. Fields\ncan be created with or without default values. Components can also be nested,\nwith `ComponentField`s, such that child componenents can access the field values\ndefined on their parents.\n\nFor example:\n\n```python\nfrom zookeeper import component\n\n@component\nclass ChildComponent:\n    a: int = Field()                          # An `int` field with no default set\n    b: str = Field(\"foo\")                     # A `str` field with default value `\"foo\"`\n\n@component\nclass ParentComponent:\n    a: int = Field()                          # The same `int` field as the child\n    child: ChildComponent = ComponentField()  # A nested component field, of type `ChildComponent`\n```\n\nAfter instantiation, components can be 'configured' with a configuration\ndictionary, containing values for a tree of nested fields. This process\nautomatically injects the correct values into each field.\n\nIf a child sub-component declares a field which already exists in some\ncontaining ancestor component, then it will pick up the value that's set on the\nparent, unless a 'scoped' value is set on the child.\n\nFor example:\n\n```\nfrom zookeeper import configure\n\np = ParentComponent()\n\nconfigure(\n    p,\n    {\n        \"a\": 5,\n        \"child.a\": 4,\n    }\n)\n\n\u003e\u003e\u003e 'ChildComponent' is the only concrete component class that satisfies the type\n\u003e\u003e\u003e of the annotated parameter 'ParentComponent.child'. Using an instance of this\n\u003e\u003e\u003e class by default.\n\nprint(p)\n\n\u003e\u003e\u003e ParentComponent(\n\u003e\u003e\u003e     a = 5,\n\u003e\u003e\u003e     child = ChildComponent(\n\u003e\u003e\u003e         a = 4,\n\u003e\u003e\u003e         b = \"foo\"\n\u003e\u003e\u003e     )\n\u003e\u003e\u003e )\n```\n\n### Tasks and the CLI\n\nThe [`@task`](zookeeper/task.py) decorator is used to define Zookeeper tasks and\ncan be applied to any class that implements an argument-less `run` method. Such\ntasks can be run through the Zookeeper CLI, with parameter values passed in\nthrough CLI arguments (`configure` is implicitly called).\n\nFor example:\n\n```python\nfrom zookeeper import cli, task\n\n@task\nclass UseChildA:\n    parent: ParentComponent = ComponentField()\n    def run(self):\n        print(self.parent.child.a)\n\n@task\nclass UseParentA(UseChildA):\n    def run(self):\n        print(self.parent.a)\n\nif __name__ == \"__main__\":\n    cli()\n```\n\nRunning the above file then gives a nice CLI interface:\n\n```\npython test.py use_child_a\n\u003e\u003e\u003e ValueError: No configuration value found for annotated parameter 'UseChildA.parent.a' of type 'int'.\n\npython test.py use_child_a a=5\n\u003e\u003e\u003e 5\n\npython test.py use_child_a a=5 child.a=3\n\u003e\u003e\u003e 3\n\npython test.py use_parent_a a=5 child.a=3\n\u003e\u003e\u003e 5\n```\n\n### Using Zookeeper to define Larq or Keras experiments\n\nSee [examples/larq_experiment.py](examples/larq_experiment.py) for an example of\nhow to use Zookeeper to define all the necessary components (dataset,\npreprocessing, and model) of a Larq experiment: training a BinaryNet on\nMNIST. This example can be easily adapted to other Larq or Keras models and\nother datasets.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarq%2Fzookeeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarq%2Fzookeeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarq%2Fzookeeper/lists"}