{"id":17679387,"url":"https://github.com/tmck-code/asv-python","last_synced_at":"2025-03-30T18:28:12.746Z","repository":{"id":43147490,"uuid":"397253845","full_name":"tmck-code/asv-python","owner":"tmck-code","description":"Reader \u0026 Writer for \"ASCII-Separated Value\" file format","archived":false,"fork":false,"pushed_at":"2022-04-17T02:01:34.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T20:59:52.258Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmck-code.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":"2021-08-17T12:47:05.000Z","updated_at":"2022-03-16T12:36:23.000Z","dependencies_parsed_at":"2022-09-22T07:03:59.150Z","dependency_job_id":null,"html_url":"https://github.com/tmck-code/asv-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmck-code%2Fasv-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmck-code%2Fasv-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmck-code%2Fasv-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmck-code%2Fasv-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmck-code","download_url":"https://codeload.github.com/tmck-code/asv-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246361332,"owners_count":20764908,"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-24T08:22:17.216Z","updated_at":"2025-03-30T18:28:12.737Z","avatar_url":"https://github.com/tmck-code.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# asv-python\n\u003e *Reader \u0026amp; Writer for \"ASCII-Separated Value\" file format*\n\nThe CSV format has one main advantage over other plain-text serialisations: **the size** that it produces.\n\nJSON/XML have advantages around typing, however in many cases this is not actually very useful. e.g. any single json field is not actually guaranteed to be the same type between successive records\n\nThis advantage is entirely wasted due to the lax specification around fields containing newlines, and other characters that need to be escaped. This results in a smorgasbord of different formats that any CSV parser must implement.\n\n---\n\n## ASCII Separated Values\n\n\u003e See https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text\n\nThe ASCII format, since the beginning of time, has defined **characters that are reserved for unit (cell) and record (row) separation**\n\n- `30 == \"record separator\"`, signals the end of a record or row\n- `31 == \"unit separator\"`, Between fields of a record, or members of a row. \n\nUsing these mitigates every problem with value escaping that are encountered with the current format.\n\n- When writing: No need to escape anything, or quote cells, and newlines are permitted\n- When reading: Just detect the 2 characters, and split on them\n\n---\n\n## Example Usage\n\n```python\nfrom asv import asv\n\ndata = [\n    [\"id\", \"name\", \"value\", \"other\"],\n    [\"123\", \"Tom\", \"xxx\", \"\"],\n    [\"124\", \"Laura\", \"yyy\", \"some note here\"],\n]\n\nwith asv.ASVWriter(\"data.asv\") as writer:\n    for row in data:\n        writer.write_row(row)\n\nopen('test/data.asv').read()\n# 'id\\x1fname\\x1fvalue\\x1fother\\x1e\\n123\\x1fTom\\x1fxxx\\x1f\\x1e\\n124\\x1fLaura\\x1fyyy\\x1fsome note here\\x1e\\n'\n\nwith asv.ASVReader('test/data.asv') as reader:\n    for row in data:\n        print(row)\n\n# ['id', 'name', 'value', 'other']\n# ['123', 'Tom', 'xxx', '']\n# ['124', 'Laura', 'yyy', 'some note here']\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmck-code%2Fasv-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmck-code%2Fasv-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmck-code%2Fasv-python/lists"}