%global _empty_manifest_terminate_build 0 Name: python-anyioc Version: 0.15.0 Release: 1 Summary: Another simple ioc framework for python License: MIT URL: https://pypi.org/project/anyioc/ Source0: https://mirrors.aliyun.com/pypi/web/packages/c5/20/839c0b651df9e4dec0d5dd0c591a9a2c1cf2314b47e9852d66f5712e011e/anyioc-0.15.0.tar.gz BuildArch: noarch %description # anyioc ![GitHub](https://img.shields.io/github/license/Cologler/anyioc-python.svg) [![Testing](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml/badge.svg)](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml) [![PyPI](https://img.shields.io/pypi/v/anyioc.svg)](https://pypi.org/project/anyioc/) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Cologler/anyioc-python) Another simple ioc framework for python. ## Usage ``` py from anyioc import ServiceProvider provider = ServiceProvider() provider.register_singleton('the key', lambda ioc: 102) # ioc will be a `IServiceProvider` value = provider.get('the key') assert value == 102 ``` ## Register and resolve By default, you can use following methods to register services: - `ServiceProvider.register_singleton(key, factory)` - `ServiceProvider.register_scoped(key, factory)` - `ServiceProvider.register_transient(key, factory)` - `ServiceProvider.register(key, factory, lifetime)` - `ServiceProvider.register_value(key, value)` - `ServiceProvider.register_group(key, keys)` - `ServiceProvider.register_bind(new_key, target_key)` And use following methods to resolve services: - `ServiceProvider.__getitem__(key)` - `ServiceProvider.get(key)` - `ServiceProvider.get_many(key)` *`get` return `None` if the service was not found, but `__getitem__` will raise a `ServiceNotFoundError`.* Read full [documentation](https://github.com/Cologler/anyioc-python/wiki). %package -n python3-anyioc Summary: Another simple ioc framework for python Provides: python-anyioc BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-anyioc # anyioc ![GitHub](https://img.shields.io/github/license/Cologler/anyioc-python.svg) [![Testing](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml/badge.svg)](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml) [![PyPI](https://img.shields.io/pypi/v/anyioc.svg)](https://pypi.org/project/anyioc/) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Cologler/anyioc-python) Another simple ioc framework for python. ## Usage ``` py from anyioc import ServiceProvider provider = ServiceProvider() provider.register_singleton('the key', lambda ioc: 102) # ioc will be a `IServiceProvider` value = provider.get('the key') assert value == 102 ``` ## Register and resolve By default, you can use following methods to register services: - `ServiceProvider.register_singleton(key, factory)` - `ServiceProvider.register_scoped(key, factory)` - `ServiceProvider.register_transient(key, factory)` - `ServiceProvider.register(key, factory, lifetime)` - `ServiceProvider.register_value(key, value)` - `ServiceProvider.register_group(key, keys)` - `ServiceProvider.register_bind(new_key, target_key)` And use following methods to resolve services: - `ServiceProvider.__getitem__(key)` - `ServiceProvider.get(key)` - `ServiceProvider.get_many(key)` *`get` return `None` if the service was not found, but `__getitem__` will raise a `ServiceNotFoundError`.* Read full [documentation](https://github.com/Cologler/anyioc-python/wiki). %package help Summary: Development documents and examples for anyioc Provides: python3-anyioc-doc %description help # anyioc ![GitHub](https://img.shields.io/github/license/Cologler/anyioc-python.svg) [![Testing](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml/badge.svg)](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml) [![PyPI](https://img.shields.io/pypi/v/anyioc.svg)](https://pypi.org/project/anyioc/) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Cologler/anyioc-python) Another simple ioc framework for python. ## Usage ``` py from anyioc import ServiceProvider provider = ServiceProvider() provider.register_singleton('the key', lambda ioc: 102) # ioc will be a `IServiceProvider` value = provider.get('the key') assert value == 102 ``` ## Register and resolve By default, you can use following methods to register services: - `ServiceProvider.register_singleton(key, factory)` - `ServiceProvider.register_scoped(key, factory)` - `ServiceProvider.register_transient(key, factory)` - `ServiceProvider.register(key, factory, lifetime)` - `ServiceProvider.register_value(key, value)` - `ServiceProvider.register_group(key, keys)` - `ServiceProvider.register_bind(new_key, target_key)` And use following methods to resolve services: - `ServiceProvider.__getitem__(key)` - `ServiceProvider.get(key)` - `ServiceProvider.get_many(key)` *`get` return `None` if the service was not found, but `__getitem__` will raise a `ServiceNotFoundError`.* Read full [documentation](https://github.com/Cologler/anyioc-python/wiki). %prep %autosetup -n anyioc-0.15.0 %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-anyioc -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri Jun 09 2023 Python_Bot - 0.15.0-1 - Package Spec generated