keyvalues3


Namekeyvalues3 JSON
Version 0.1 PyPI version JSON
download
home_pageNone
SummaryRead and write Valve's KeyValues3 format
upload_time2023-07-26 07:49:39
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords parser kv3 keyvalues keyvalues3 valve
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## keyvalues3
KeyValues3 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.)

## Usage
```py
import keyvalues3 as kv3
bt_config = kv3.read("tests/documents/bt_config.kv3")

>>> bt_config.keys()
dict_keys(['default', 'low', 'fair', 'normal', 'tough', 'hard', 'very_hard', 'expert', 'elite'])

>>> bt_config["elite"]["reaction_time"]
0.12
```

```py
# The root value is most of the time a dict
>>> type(bt_config.value)
<class 'dict'>

>>> bt_config.original_encoding
Encoding(name='text', version=UUID('e21c7f3c-8a33-41c5-9977-a76d3a32aa0d'))

>>> bt_config.format
Format(name='generic', version=UUID('7412167c-06e9-4698-aff2-e63eb59037e7'))

# To write it back
>>> kv3.write(bt_config, "tests/documents/bt_config.kv3", use_original_encoding=True)

# Write to a stream
>>> import sys
>>> kv3.write({"key": [1,2,3]}, sys.stdout)
<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
        key = [1, 2, 3]
}
```

## Install  [![PyPI version](https://badge.fury.io/py/keyvalues3.svg)](https://badge.fury.io/py/keyvalues3)
```bash
pip install keyvalues3
```

## Supported encodings
| Encoding 👩‍💻 | Read 📖 | Write ✍️ |
| ----------- | :-----: | :-------: |
| Text UTF-8 | Yes ✔️ | Yes ✔️ |
| Text UTF-8 Headerless | Yes ✔️ | Yes ✔️ |
| Binary Uncompressed | No ⛔ | Yes ✔️ |
| Binary LZ4 | No ⛔ | Yes ✔️ |
| Binary (Other newer) | No ⛔ | No ⛔ |

## Credits
Valve Corporation for making KeyValues3.  
[SteamDatabase/ValveResourceFormat](https://github.com/SteamDatabase/ValveResourceFormat/blob/master/ValveResourceFormat/Resource/ResourceTypes/BinaryKV3.cs) for reversing the binary formats.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "keyvalues3",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "parser,kv3,keyvalues,keyvalues3,valve",
    "author": null,
    "author_email": "kristiker <kristik06@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/3c/17/9342628f857f59c7e96de1973e3614825e3a6f400e47c801e42a4f788847/keyvalues3-0.1.tar.gz",
    "platform": null,
    "description": "## 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>>> bt_config.keys()\ndict_keys(['default', 'low', 'fair', 'normal', 'tough', 'hard', 'very_hard', 'expert', 'elite'])\n\n>>> bt_config[\"elite\"][\"reaction_time\"]\n0.12\n```\n\n```py\n# The root value is most of the time a dict\n>>> type(bt_config.value)\n<class 'dict'>\n\n>>> bt_config.original_encoding\nEncoding(name='text', version=UUID('e21c7f3c-8a33-41c5-9977-a76d3a32aa0d'))\n\n>>> bt_config.format\nFormat(name='generic', version=UUID('7412167c-06e9-4698-aff2-e63eb59037e7'))\n\n# To write it back\n>>> kv3.write(bt_config, \"tests/documents/bt_config.kv3\", use_original_encoding=True)\n\n# Write to a stream\n>>> import sys\n>>> kv3.write({\"key\": [1,2,3]}, sys.stdout)\n<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->\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 \ud83d\udc69\u200d\ud83d\udcbb | Read \ud83d\udcd6 | Write \u270d\ufe0f |\n| ----------- | :-----: | :-------: |\n| Text UTF-8 | Yes \u2714\ufe0f | Yes \u2714\ufe0f |\n| Text UTF-8 Headerless | Yes \u2714\ufe0f | Yes \u2714\ufe0f |\n| Binary Uncompressed | No \u26d4 | Yes \u2714\ufe0f |\n| Binary LZ4 | No \u26d4 | Yes \u2714\ufe0f |\n| Binary (Other newer) | No \u26d4 | No \u26d4 |\n\n## Credits\nValve Corporation for making KeyValues3.  \n[SteamDatabase/ValveResourceFormat](https://github.com/SteamDatabase/ValveResourceFormat/blob/master/ValveResourceFormat/Resource/ResourceTypes/BinaryKV3.cs) for reversing the binary formats.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Read and write Valve's KeyValues3 format",
    "version": "0.1",
    "project_urls": {
        "Source": "https://github.com/kristiker/keyvalues3"
    },
    "split_keywords": [
        "parser",
        "kv3",
        "keyvalues",
        "keyvalues3",
        "valve"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1a7b3ccec819b490033a28475e62073bb130a136ff758873f752de5882e2c712",
                "md5": "225a79879329fcb3f8c5339891962d92",
                "sha256": "0a20354d3fcab856d84386bddf186e29b113a785a7253dfee705494078d20539"
            },
            "downloads": -1,
            "filename": "keyvalues3-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "225a79879329fcb3f8c5339891962d92",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 12278,
            "upload_time": "2023-07-26T07:49:38",
            "upload_time_iso_8601": "2023-07-26T07:49:38.065538Z",
            "url": "https://files.pythonhosted.org/packages/1a/7b/3ccec819b490033a28475e62073bb130a136ff758873f752de5882e2c712/keyvalues3-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3c179342628f857f59c7e96de1973e3614825e3a6f400e47c801e42a4f788847",
                "md5": "0ac19f90394bd301315e023efd58d16c",
                "sha256": "37b894c71cfa071758895401f833d0ccacd5fdb99063a72681ab6079a674c2a1"
            },
            "downloads": -1,
            "filename": "keyvalues3-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0ac19f90394bd301315e023efd58d16c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 56125,
            "upload_time": "2023-07-26T07:49:39",
            "upload_time_iso_8601": "2023-07-26T07:49:39.655104Z",
            "url": "https://files.pythonhosted.org/packages/3c/17/9342628f857f59c7e96de1973e3614825e3a6f400e47c801e42a4f788847/keyvalues3-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-26 07:49:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kristiker",
    "github_project": "keyvalues3",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "keyvalues3"
}
        
Elapsed time: 0.09093s