{"id":17236869,"url":"https://github.com/redodo/formats","last_synced_at":"2025-04-14T02:24:26.319Z","repository":{"id":24555579,"uuid":"27962667","full_name":"redodo/formats","owner":"redodo","description":"Support multiple formats with ease.","archived":false,"fork":false,"pushed_at":"2015-02-11T21:30:25.000Z","size":176,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-06T05:34:30.755Z","etag":null,"topics":[],"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/redodo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-13T14:16:42.000Z","updated_at":"2018-05-22T03:01:39.000Z","dependencies_parsed_at":"2022-08-22T23:40:32.310Z","dependency_job_id":null,"html_url":"https://github.com/redodo/formats","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redodo%2Fformats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redodo%2Fformats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redodo%2Fformats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redodo%2Fformats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redodo","download_url":"https://codeload.github.com/redodo/formats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240142740,"owners_count":19754633,"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":[],"created_at":"2024-10-15T05:37:07.940Z","updated_at":"2025-02-24T14:31:39.642Z","avatar_url":"https://github.com/redodo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Formats\n=======\n\n[\u003cimg src=\"https://img.shields.io/pypi/v/formats.svg?style=flat\"\u003e](https://pypi.python.org/pypi/formats)\n[\u003cimg src=\"https://img.shields.io/pypi/l/formats.svg?style=flat\"\u003e](https://github.com/redodo/formats/blob/master/LICENSE)\n\n*Support multiple formats with ease.*\n\n\nInstallation via PIP:\n\n```bash\npip install --pre formats\n```\n\n\nQuick usage overview:\n\n```python\n\u003e\u003e\u003e import formats\n\u003e\u003e\u003e formats.discover()\n\u003e\u003e\u003e text = '''\n...     awesome_things:\n...     - dodos\n...     - pythons\n... '''\n\u003e\u003e\u003e formats.parse('yaml', text)\n{'awesome_things': ['dodos', 'pythons']}\n\u003e\u003e\u003e formats.convert('yaml', 'json', text)\n'{\"awesome_things\": [\"dodos\", \"pythons\"]}'\n```\n\n\nThe Basics\n----------\n\nFormats will provide you with a consistent API to parse and compose\ndata.\n\n\nRegistering new formats\n-----------------------\n\n```python\nimport formats\nimport someformat\n\nformats.register('someformat', someformat.loads, someformat.dumps)\n# or\nformats.register_parser('someformat', someformat.loads)\nformats.register_composer('someformat', someformat.dumps)\n```\n\n\nCreating your own formats\n-------------------------\n\nYou could of course use the `register` method to register your own\nparser, but decorators are much more fun!\n\n```python\nimport formats\n\n@formats.parser('text')\ndef text_parser(text):\n    return text\n\n@formats.composer('text')\ndef text_composer(text):\n    return text\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredodo%2Fformats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredodo%2Fformats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredodo%2Fformats/lists"}