%global _empty_manifest_terminate_build 0 Name: python-aioddd Version: 1.3.8 Release: 1 Summary: Async Python DDD utilities library. License: MIT URL: https://pypi.org/project/aioddd/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/fc/8e/eee68ad9f8d0e53eaab70b7efc207fb8370fa42b34916f242732438b1ec3/aioddd-1.3.8.tar.gz BuildArch: noarch Requires: python3-build Requires: python3-setuptools Requires: python3-twine Requires: python3-wheel Requires: python3-pre-commit Requires: python3-tomli Requires: python3-types-backports Requires: python3-types-toml Requires: python3-mkdocs Requires: python3-mkdocs-material Requires: python3-black Requires: python3-isort Requires: python3-bandit Requires: python3-liccheck Requires: python3-mypy Requires: python3-pylint Requires: python3-nest-asyncio Requires: python3-psutil Requires: python3-pytest Requires: python3-pytest-asyncio Requires: python3-pytest-cov Requires: python3-pytest-xdist %description # Async Python DDD utilities library [![PyPI version](https://badge.fury.io/py/aioddd.svg)](https://badge.fury.io/py/aioddd) [![PyPIDownloads](https://static.pepy.tech/badge/aioddd)](https://pepy.tech/project/aioddd) [![CI](https://github.com/aiopy/python-aioddd/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/aiopy/python-aioddd/actions/workflows/ci.yml) aioddd is an async Python DDD utilities library. ## Installation Use the package manager [pip](https://pypi.org/project/aioddd/) to install aioddd. ```bash pip install aioddd ``` ## Documentation - Visit [aioddd docs](https://aiopy.github.io/python-aioddd/). ## Usage ```python from asyncio import get_event_loop from dataclasses import dataclass from typing import Type from aioddd import NotFoundError, \ Command, CommandHandler, SimpleCommandBus, \ Query, QueryHandler, OptionalResponse, SimpleQueryBus, Event _products = [] class ProductStored(Event): @dataclass class Attributes: ref: str attributes: Attributes class StoreProductCommand(Command): def __init__(self, ref: str): self.ref = ref class StoreProductCommandHandler(CommandHandler): def subscribed_to(self) -> Type[Command]: return StoreProductCommand async def handle(self, command: StoreProductCommand) -> None: _products.append(command.ref) class ProductNotFoundError(NotFoundError): _code = 'product_not_found' _title = 'Product not found' class FindProductQuery(Query): def __init__(self, ref: str): self.ref = ref class FindProductQueryHandler(QueryHandler): def subscribed_to(self) -> Type[Query]: return FindProductQuery async def handle(self, query: FindProductQuery) -> OptionalResponse: if query.ref != '123': raise ProductNotFoundError.create(detail={'ref': query.ref}) return {'ref': query.ref} async def main() -> None: commands_bus = SimpleCommandBus([StoreProductCommandHandler()]) await commands_bus.dispatch(StoreProductCommand('123')) query_bus = SimpleQueryBus([FindProductQueryHandler()]) response = await query_bus.ask(FindProductQuery('123')) print(response) if __name__ == '__main__': get_event_loop().run_until_complete(main()) ``` ## Requirements - Python >= 3.7 ## Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate. ## License [MIT](https://github.com/aiopy/python-aioddd/blob/master/LICENSE) %package -n python3-aioddd Summary: Async Python DDD utilities library. Provides: python-aioddd BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-aioddd # Async Python DDD utilities library [![PyPI version](https://badge.fury.io/py/aioddd.svg)](https://badge.fury.io/py/aioddd) [![PyPIDownloads](https://static.pepy.tech/badge/aioddd)](https://pepy.tech/project/aioddd) [![CI](https://github.com/aiopy/python-aioddd/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/aiopy/python-aioddd/actions/workflows/ci.yml) aioddd is an async Python DDD utilities library. ## Installation Use the package manager [pip](https://pypi.org/project/aioddd/) to install aioddd. ```bash pip install aioddd ``` ## Documentation - Visit [aioddd docs](https://aiopy.github.io/python-aioddd/). ## Usage ```python from asyncio import get_event_loop from dataclasses import dataclass from typing import Type from aioddd import NotFoundError, \ Command, CommandHandler, SimpleCommandBus, \ Query, QueryHandler, OptionalResponse, SimpleQueryBus, Event _products = [] class ProductStored(Event): @dataclass class Attributes: ref: str attributes: Attributes class StoreProductCommand(Command): def __init__(self, ref: str): self.ref = ref class StoreProductCommandHandler(CommandHandler): def subscribed_to(self) -> Type[Command]: return StoreProductCommand async def handle(self, command: StoreProductCommand) -> None: _products.append(command.ref) class ProductNotFoundError(NotFoundError): _code = 'product_not_found' _title = 'Product not found' class FindProductQuery(Query): def __init__(self, ref: str): self.ref = ref class FindProductQueryHandler(QueryHandler): def subscribed_to(self) -> Type[Query]: return FindProductQuery async def handle(self, query: FindProductQuery) -> OptionalResponse: if query.ref != '123': raise ProductNotFoundError.create(detail={'ref': query.ref}) return {'ref': query.ref} async def main() -> None: commands_bus = SimpleCommandBus([StoreProductCommandHandler()]) await commands_bus.dispatch(StoreProductCommand('123')) query_bus = SimpleQueryBus([FindProductQueryHandler()]) response = await query_bus.ask(FindProductQuery('123')) print(response) if __name__ == '__main__': get_event_loop().run_until_complete(main()) ``` ## Requirements - Python >= 3.7 ## Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate. ## License [MIT](https://github.com/aiopy/python-aioddd/blob/master/LICENSE) %package help Summary: Development documents and examples for aioddd Provides: python3-aioddd-doc %description help # Async Python DDD utilities library [![PyPI version](https://badge.fury.io/py/aioddd.svg)](https://badge.fury.io/py/aioddd) [![PyPIDownloads](https://static.pepy.tech/badge/aioddd)](https://pepy.tech/project/aioddd) [![CI](https://github.com/aiopy/python-aioddd/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/aiopy/python-aioddd/actions/workflows/ci.yml) aioddd is an async Python DDD utilities library. ## Installation Use the package manager [pip](https://pypi.org/project/aioddd/) to install aioddd. ```bash pip install aioddd ``` ## Documentation - Visit [aioddd docs](https://aiopy.github.io/python-aioddd/). ## Usage ```python from asyncio import get_event_loop from dataclasses import dataclass from typing import Type from aioddd import NotFoundError, \ Command, CommandHandler, SimpleCommandBus, \ Query, QueryHandler, OptionalResponse, SimpleQueryBus, Event _products = [] class ProductStored(Event): @dataclass class Attributes: ref: str attributes: Attributes class StoreProductCommand(Command): def __init__(self, ref: str): self.ref = ref class StoreProductCommandHandler(CommandHandler): def subscribed_to(self) -> Type[Command]: return StoreProductCommand async def handle(self, command: StoreProductCommand) -> None: _products.append(command.ref) class ProductNotFoundError(NotFoundError): _code = 'product_not_found' _title = 'Product not found' class FindProductQuery(Query): def __init__(self, ref: str): self.ref = ref class FindProductQueryHandler(QueryHandler): def subscribed_to(self) -> Type[Query]: return FindProductQuery async def handle(self, query: FindProductQuery) -> OptionalResponse: if query.ref != '123': raise ProductNotFoundError.create(detail={'ref': query.ref}) return {'ref': query.ref} async def main() -> None: commands_bus = SimpleCommandBus([StoreProductCommandHandler()]) await commands_bus.dispatch(StoreProductCommand('123')) query_bus = SimpleQueryBus([FindProductQueryHandler()]) response = await query_bus.ask(FindProductQuery('123')) print(response) if __name__ == '__main__': get_event_loop().run_until_complete(main()) ``` ## Requirements - Python >= 3.7 ## Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate. ## License [MIT](https://github.com/aiopy/python-aioddd/blob/master/LICENSE) %prep %autosetup -n aioddd-1.3.8 %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-aioddd -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 1.3.8-1 - Package Spec generated