{"id":17384296,"url":"https://github.com/panagiks/yaab","last_synced_at":"2025-04-15T10:13:30.213Z","repository":{"id":46083448,"uuid":"235215536","full_name":"panagiks/yaab","owner":"panagiks","description":"Yet Another Adapter Base","archived":false,"fork":false,"pushed_at":"2022-12-26T21:00:44.000Z","size":38,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T19:11:15.972Z","etag":null,"topics":["adapter-pattern","dataclasses","development","mixins","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/panagiks.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-20T23:05:22.000Z","updated_at":"2024-01-30T23:46:31.000Z","dependencies_parsed_at":"2023-01-31T01:45:54.578Z","dependency_job_id":null,"html_url":"https://github.com/panagiks/yaab","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panagiks%2Fyaab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panagiks%2Fyaab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panagiks%2Fyaab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panagiks%2Fyaab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panagiks","download_url":"https://codeload.github.com/panagiks/yaab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670506,"owners_count":21142896,"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":["adapter-pattern","dataclasses","development","mixins","python3"],"created_at":"2024-10-16T07:45:04.246Z","updated_at":"2025-04-15T10:13:30.195Z","avatar_url":"https://github.com/panagiks.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"========================\nYet Another Adapter Base\n========================\n\n\n.. image:: https://img.shields.io/pypi/v/yaab.svg\n        :target: https://pypi.python.org/pypi/yaab\n\n.. image:: https://img.shields.io/travis/panagiks/yaab.svg\n        :target: https://travis-ci.org/panagiks/yaab\n\n.. image:: https://pepy.tech/badge/yaab\n        :target: https://pepy.tech/project/yaab\n\n.. image:: https://readthedocs.org/projects/yaab/badge/?version=latest\n        :target: https://yaab.readthedocs.io/en/latest/?badge=latest\n        :alt: Documentation Status\n\n\n\n\nYAAB aims to provide a flexible base for Adapter Design Pattern implementations based on dataclasses.\n\n\n* Free software: MIT license\n* Documentation: https://yaab.readthedocs.io.\n\n\nExample Usage\n-------------\n\nLet's assume that you are interfacing an API that returns a `JSON` object with the following structure:\n\n.. code-block:: json\n\n    {\n        \"weird_name\": \"My name\",\n        \"oid\": \"3\"\n    }\n\nAnd you would like to transform it into a schema that fits the rest of your API, let's assume:\n\n.. code-block:: json\n\n    {\n        \"name\": \"My name\",\n        \"id\": 3\n    }\n\nThen you would define and use your model in the following way:\n\n::\n\n    \u003e\u003e\u003e from dataclasses import asdict, dataclass, field\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e from yaab.adapter import BaseAdapter\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e @dataclass\n    ... class MyModel(BaseAdapter):\n    ...     id: int = field(metadata={\"transformations\": (\"oid\", int)})\n    ...     name: str = field(metadata={\"transformations\": (\"weird_name\", )})\n    ...\n    \u003e\u003e\u003e m = MyModel.from_dict({\"weird_name\": \"My name\", \"oid\": \"3\"})\n    \u003e\u003e\u003e print(m)\n    MyModel(id=3, name='My name')\n    \u003e\u003e\u003e asdict(m)\n    {'id': 3, 'name': 'My name'}\n\n\nFeatures\n--------\n\n* TODO\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanagiks%2Fyaab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanagiks%2Fyaab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanagiks%2Fyaab/lists"}