{"id":17274176,"url":"https://github.com/kristiker/keyvalues3","last_synced_at":"2025-04-14T08:31:50.053Z","repository":{"id":75577582,"uuid":"567923358","full_name":"kristiker/keyvalues3","owner":"kristiker","description":"Source2 KeyValues3 library for Python","archived":false,"fork":false,"pushed_at":"2025-01-18T16:25:05.000Z","size":142,"stargazers_count":13,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T22:04:49.480Z","etag":null,"topics":["json-like","keyvalues","kv3","source2","valve"],"latest_commit_sha":null,"homepage":"https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/KeyValues3","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/kristiker.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-18T22:58:15.000Z","updated_at":"2025-03-15T08:14:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"82ea9edf-7504-466d-a777-d9df5e1ae6cb","html_url":"https://github.com/kristiker/keyvalues3","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/kristiker%2Fkeyvalues3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristiker%2Fkeyvalues3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristiker%2Fkeyvalues3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristiker%2Fkeyvalues3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kristiker","download_url":"https://codeload.github.com/kristiker/keyvalues3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248845678,"owners_count":21170833,"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":["json-like","keyvalues","kv3","source2","valve"],"created_at":"2024-10-15T08:53:17.164Z","updated_at":"2025-04-14T08:31:50.023Z","avatar_url":"https://github.com/kristiker.png","language":"Python","readme":"## keyvalues3\nKeyValues3 is a Valve developed data format. It is similar in structure to JSON, but supports binary encodings, versioning, and data annotations. The text syntax also has some minor ergonomic improvements (support for single- and multi-line comments, trailing commas, and multi-line strings.)\n\n## Usage\n```py\nimport keyvalues3 as kv3\nbt_config = kv3.read(\"tests/documents/bt_config.kv3\")\n\n\u003e\u003e\u003e bt_config.keys()\ndict_keys(['default', 'low', 'fair', 'normal', 'tough', 'hard', 'very_hard', 'expert', 'elite'])\n\n\u003e\u003e\u003e bt_config[\"elite\"][\"reaction_time\"]\n0.12\n```\n\n```py\n# The root value is most of the time a dict\n\u003e\u003e\u003e type(bt_config.value)\n\u003cclass 'dict'\u003e\n\n\u003e\u003e\u003e bt_config.original_encoding\nEncoding(name='text', version=UUID('e21c7f3c-8a33-41c5-9977-a76d3a32aa0d'))\n\n\u003e\u003e\u003e bt_config.format\nFormat(name='generic', version=UUID('7412167c-06e9-4698-aff2-e63eb59037e7'))\n\n# To write it back\n\u003e\u003e\u003e kv3.write(bt_config, \"tests/documents/bt_config.kv3\", use_original_encoding=True)\n\n# Write to a stream\n\u003e\u003e\u003e import sys\n\u003e\u003e\u003e kv3.write({\"key\": [1,2,3]}, sys.stdout)\n\u003c!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} --\u003e\n{\n        key = [1, 2, 3]\n}\n```\n\n## Install  [![PyPI version](https://badge.fury.io/py/keyvalues3.svg)](https://badge.fury.io/py/keyvalues3)\n```bash\npip install keyvalues3\n```\n\n## Supported encodings\n| Encoding 👩‍💻 | Read 📖 | Write ✍️ |\n| ----------- | :-----: | :-------: |\n| Text UTF-8 | Yes ✔️ | Yes ✔️ |\n| Text UTF-8 Headerless | Yes ✔️ | Yes ✔️ |\n| Binary Uncompressed | No ⛔ | Yes ✔️ |\n| Binary LZ4 | No ⛔ | Yes ✔️ |\n| Binary (Other newer) | No ⛔ | No ⛔ |\n\n## Using dataclasses\nDataclasses (marked with `@dataclass`) are also supported for serialization (uses `asdict()`)\n```py\n@dataclass\nclass RenderMeshFile(_Node):  # _Node defines _class, name, notes, and children (+ helper methods)\n    filename: resourcepath = \"\"\n    import_translation: list[float] = field(default_factory=lambda: [0, 0, 0])\n    import_rotation: list[float] = field(default_factory=lambda: [0, 0, 0])\n    import_scale: float = 1.0\n    align_origin_x_type: str = \"None\"\n    align_origin_y_type: str = \"None\"\n    align_origin_z_type: str = \"None\"\n    parent_bone: namelink = \"\"\n    import_filter: dict = field(\n        default_factory=lambda:dict(\n            exclude_by_default = False,\n            exception_list = [  ]\n        )\n    )\n```\nYou can find more ModelDoc dataclasses [here](https://github.com/kristiker/source1import/blob/6644b3133cc79b3c455cc91ab4259f3f0e27d797/utils/shared/modeldoc.py#L61-L88).\n\n\n## Credits\nValve Corporation® for making KeyValues3.  \n[ValveResourceFormat](https://github.com/ValveResourceFormat/ValveResourceFormat/blob/master/ValveResourceFormat/Resource/ResourceTypes/BinaryKV3.cs) for reverse engineering the binary formats.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristiker%2Fkeyvalues3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkristiker%2Fkeyvalues3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristiker%2Fkeyvalues3/lists"}