diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-10 05:33:47 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 05:33:47 +0000 |
commit | 730ff76f9b5508772c60ef6d55960e328f3e0fd3 (patch) | |
tree | d9001519b7418b75cf4cbb70cc01d8166be9350c | |
parent | 37089f49ee288f80e769b6d97a9b3b4b76eff60f (diff) |
automatic import of python-zookeeperopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-zookeeper.spec | 463 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 465 insertions, 0 deletions
@@ -0,0 +1 @@ +/zookeeper-1.3.3.tar.gz diff --git a/python-zookeeper.spec b/python-zookeeper.spec new file mode 100644 index 0000000..68033d8 --- /dev/null +++ b/python-zookeeper.spec @@ -0,0 +1,463 @@ +%global _empty_manifest_terminate_build 0 +Name: python-zookeeper +Version: 1.3.3 +Release: 1 +Summary: A small library for managing deep learning models, hyper-parameters and datasets +License: Apache 2.0 +URL: https://github.com/larq/zookeeper +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3b/63/43ad867c4ec7d9c6cd8ee68b815fc37e5dc742b0d9bcdef5d80cf207785d/zookeeper-1.3.3.tar.gz +BuildArch: noarch + +Requires: python3-click +Requires: python3-tensorflow-datasets +Requires: python3-typeguard +Requires: python3-importlib-metadata +Requires: python3-tensorflow +Requires: python3-tensorflow-gpu +Requires: python3-black +Requires: python3-docformatter +Requires: python3-flake8 +Requires: python3-isort +Requires: python3-pytest +Requires: python3-pytest-cov +Requires: python3-pytype + +%description +# Zookeeper + +[](https://github.com/larq/zookeeper/actions?workflow=Unittest) [](https://codecov.io/github/larq/zookeeper?branch=main) [](https://pypi.org/project/zookeeper/) [](https://pypi.org/project/zookeeper/) [](https://github.com/plumerai/zookeeper/blob/main/LICENSE) [](https://github.com/ambv/black) + +A small library for configuring modular applications. + +### Installation + +```console +pip install zookeeper +``` + +### Components + +The fundamental building blocks of Zookeeper are components. The +[`@component`](zookeeper/component.py) decorator is used to turn classes into +components. These component classes can have configurable fields, which are +declared with the `Field` constructor and class-level type annotations. Fields +can be created with or without default values. Components can also be nested, +with `ComponentField`s, such that child componenents can access the field values +defined on their parents. + +For example: + +```python +from zookeeper import component + +@component +class ChildComponent: + a: int = Field() # An `int` field with no default set + b: str = Field("foo") # A `str` field with default value `"foo"` + +@component +class ParentComponent: + a: int = Field() # The same `int` field as the child + child: ChildComponent = ComponentField() # A nested component field, of type `ChildComponent` +``` + +After instantiation, components can be 'configured' with a configuration +dictionary, containing values for a tree of nested fields. This process +automatically injects the correct values into each field. + +If a child sub-component declares a field which already exists in some +containing ancestor component, then it will pick up the value that's set on the +parent, unless a 'scoped' value is set on the child. + +For example: + +``` +from zookeeper import configure + +p = ParentComponent() + +configure( + p, + { + "a": 5, + "child.a": 4, + } +) + +>>> 'ChildComponent' is the only concrete component class that satisfies the type +>>> of the annotated parameter 'ParentComponent.child'. Using an instance of this +>>> class by default. + +print(p) + +>>> ParentComponent( +>>> a = 5, +>>> child = ChildComponent( +>>> a = 4, +>>> b = "foo" +>>> ) +>>> ) +``` + +### Tasks and the CLI + +The [`@task`](zookeeper/task.py) decorator is used to define Zookeeper tasks and +can be applied to any class that implements an argument-less `run` method. Such +tasks can be run through the Zookeeper CLI, with parameter values passed in +through CLI arguments (`configure` is implicitly called). + +For example: + +```python +from zookeeper import cli, task + +@task +class UseChildA: + parent: ParentComponent = ComponentField() + def run(self): + print(self.parent.child.a) + +@task +class UseParentA(UseChildA): + def run(self): + print(self.parent.a) + +if __name__ == "__main__": + cli() +``` + +Running the above file then gives a nice CLI interface: + +``` +python test.py use_child_a +>>> ValueError: No configuration value found for annotated parameter 'UseChildA.parent.a' of type 'int'. + +python test.py use_child_a a=5 +>>> 5 + +python test.py use_child_a a=5 child.a=3 +>>> 3 + +python test.py use_parent_a a=5 child.a=3 +>>> 5 +``` + +### Using Zookeeper to define Larq or Keras experiments + +See [examples/larq_experiment.py](examples/larq_experiment.py) for an example of +how to use Zookeeper to define all the necessary components (dataset, +preprocessing, and model) of a Larq experiment: training a BinaryNet on +MNIST. This example can be easily adapted to other Larq or Keras models and +other datasets. + + +%package -n python3-zookeeper +Summary: A small library for managing deep learning models, hyper-parameters and datasets +Provides: python-zookeeper +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-zookeeper +# Zookeeper + +[](https://github.com/larq/zookeeper/actions?workflow=Unittest) [](https://codecov.io/github/larq/zookeeper?branch=main) [](https://pypi.org/project/zookeeper/) [](https://pypi.org/project/zookeeper/) [](https://github.com/plumerai/zookeeper/blob/main/LICENSE) [](https://github.com/ambv/black) + +A small library for configuring modular applications. + +### Installation + +```console +pip install zookeeper +``` + +### Components + +The fundamental building blocks of Zookeeper are components. The +[`@component`](zookeeper/component.py) decorator is used to turn classes into +components. These component classes can have configurable fields, which are +declared with the `Field` constructor and class-level type annotations. Fields +can be created with or without default values. Components can also be nested, +with `ComponentField`s, such that child componenents can access the field values +defined on their parents. + +For example: + +```python +from zookeeper import component + +@component +class ChildComponent: + a: int = Field() # An `int` field with no default set + b: str = Field("foo") # A `str` field with default value `"foo"` + +@component +class ParentComponent: + a: int = Field() # The same `int` field as the child + child: ChildComponent = ComponentField() # A nested component field, of type `ChildComponent` +``` + +After instantiation, components can be 'configured' with a configuration +dictionary, containing values for a tree of nested fields. This process +automatically injects the correct values into each field. + +If a child sub-component declares a field which already exists in some +containing ancestor component, then it will pick up the value that's set on the +parent, unless a 'scoped' value is set on the child. + +For example: + +``` +from zookeeper import configure + +p = ParentComponent() + +configure( + p, + { + "a": 5, + "child.a": 4, + } +) + +>>> 'ChildComponent' is the only concrete component class that satisfies the type +>>> of the annotated parameter 'ParentComponent.child'. Using an instance of this +>>> class by default. + +print(p) + +>>> ParentComponent( +>>> a = 5, +>>> child = ChildComponent( +>>> a = 4, +>>> b = "foo" +>>> ) +>>> ) +``` + +### Tasks and the CLI + +The [`@task`](zookeeper/task.py) decorator is used to define Zookeeper tasks and +can be applied to any class that implements an argument-less `run` method. Such +tasks can be run through the Zookeeper CLI, with parameter values passed in +through CLI arguments (`configure` is implicitly called). + +For example: + +```python +from zookeeper import cli, task + +@task +class UseChildA: + parent: ParentComponent = ComponentField() + def run(self): + print(self.parent.child.a) + +@task +class UseParentA(UseChildA): + def run(self): + print(self.parent.a) + +if __name__ == "__main__": + cli() +``` + +Running the above file then gives a nice CLI interface: + +``` +python test.py use_child_a +>>> ValueError: No configuration value found for annotated parameter 'UseChildA.parent.a' of type 'int'. + +python test.py use_child_a a=5 +>>> 5 + +python test.py use_child_a a=5 child.a=3 +>>> 3 + +python test.py use_parent_a a=5 child.a=3 +>>> 5 +``` + +### Using Zookeeper to define Larq or Keras experiments + +See [examples/larq_experiment.py](examples/larq_experiment.py) for an example of +how to use Zookeeper to define all the necessary components (dataset, +preprocessing, and model) of a Larq experiment: training a BinaryNet on +MNIST. This example can be easily adapted to other Larq or Keras models and +other datasets. + + +%package help +Summary: Development documents and examples for zookeeper +Provides: python3-zookeeper-doc +%description help +# Zookeeper + +[](https://github.com/larq/zookeeper/actions?workflow=Unittest) [](https://codecov.io/github/larq/zookeeper?branch=main) [](https://pypi.org/project/zookeeper/) [](https://pypi.org/project/zookeeper/) [](https://github.com/plumerai/zookeeper/blob/main/LICENSE) [](https://github.com/ambv/black) + +A small library for configuring modular applications. + +### Installation + +```console +pip install zookeeper +``` + +### Components + +The fundamental building blocks of Zookeeper are components. The +[`@component`](zookeeper/component.py) decorator is used to turn classes into +components. These component classes can have configurable fields, which are +declared with the `Field` constructor and class-level type annotations. Fields +can be created with or without default values. Components can also be nested, +with `ComponentField`s, such that child componenents can access the field values +defined on their parents. + +For example: + +```python +from zookeeper import component + +@component +class ChildComponent: + a: int = Field() # An `int` field with no default set + b: str = Field("foo") # A `str` field with default value `"foo"` + +@component +class ParentComponent: + a: int = Field() # The same `int` field as the child + child: ChildComponent = ComponentField() # A nested component field, of type `ChildComponent` +``` + +After instantiation, components can be 'configured' with a configuration +dictionary, containing values for a tree of nested fields. This process +automatically injects the correct values into each field. + +If a child sub-component declares a field which already exists in some +containing ancestor component, then it will pick up the value that's set on the +parent, unless a 'scoped' value is set on the child. + +For example: + +``` +from zookeeper import configure + +p = ParentComponent() + +configure( + p, + { + "a": 5, + "child.a": 4, + } +) + +>>> 'ChildComponent' is the only concrete component class that satisfies the type +>>> of the annotated parameter 'ParentComponent.child'. Using an instance of this +>>> class by default. + +print(p) + +>>> ParentComponent( +>>> a = 5, +>>> child = ChildComponent( +>>> a = 4, +>>> b = "foo" +>>> ) +>>> ) +``` + +### Tasks and the CLI + +The [`@task`](zookeeper/task.py) decorator is used to define Zookeeper tasks and +can be applied to any class that implements an argument-less `run` method. Such +tasks can be run through the Zookeeper CLI, with parameter values passed in +through CLI arguments (`configure` is implicitly called). + +For example: + +```python +from zookeeper import cli, task + +@task +class UseChildA: + parent: ParentComponent = ComponentField() + def run(self): + print(self.parent.child.a) + +@task +class UseParentA(UseChildA): + def run(self): + print(self.parent.a) + +if __name__ == "__main__": + cli() +``` + +Running the above file then gives a nice CLI interface: + +``` +python test.py use_child_a +>>> ValueError: No configuration value found for annotated parameter 'UseChildA.parent.a' of type 'int'. + +python test.py use_child_a a=5 +>>> 5 + +python test.py use_child_a a=5 child.a=3 +>>> 3 + +python test.py use_parent_a a=5 child.a=3 +>>> 5 +``` + +### Using Zookeeper to define Larq or Keras experiments + +See [examples/larq_experiment.py](examples/larq_experiment.py) for an example of +how to use Zookeeper to define all the necessary components (dataset, +preprocessing, and model) of a Larq experiment: training a BinaryNet on +MNIST. This example can be easily adapted to other Larq or Keras models and +other datasets. + + +%prep +%autosetup -n zookeeper-1.3.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-zookeeper -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3.3-1 +- Package Spec generated @@ -0,0 +1 @@ +1001b6f96f2ffd60b5050fdbeee80d19 zookeeper-1.3.3.tar.gz |