VDF2
A minimal, dependency-free Python parser and serializer for the Valve Data Format (VDF), the markup language used by Valve games (CS:GO, Dota 2, TF2) for configs, item schemas, and save files.
Features
- Parse VDF strings and files into plain Python
dicts - Serialize
dicts back into VDF text - Handles nested dictionaries and escaped quotes (
\") - Strips
//line comments - Zero dependencies
Installation
pip install vdf2
Requires Python 3.14+.
Usage
Parse a VDF string
import vdf2
text = """
// configuration file
"App"
{
"Name" "Counter-Strike"
"Version" "1.6"
"Settings"
{
"Fullscreen" "1"
"Resolution" "1920x1080"
}
}
"""
data = vdf2.loads(text)
# {
# 'App': {
# 'Name': 'Counter-Strike',
# 'Version': '1.6',
# 'Settings': {'Fullscreen': '1', 'Resolution': '1920x1080'}
# }
# }
Parse from a file
with open("config.vdf") as fp:
data = vdf2.load(fp)
Serialize to a VDF string
text = vdf2.dumps(data)
Serialize to a file
with open("config.vdf", "w") as fp:
vdf2.dump(data, fp)
API reference
| Function | Description |
|---|---|
vdf2.loads(text) |
Parse a VDF string into a dict. |
vdf2.load(fp) |
Read a VDF from a file-like object and return a dict. |
vdf2.dumps(data) |
Serialize a dict into a VDF string. |
vdf2.dump(data, fp) |
Write a dict as VDF to a file-like object. |
License
Release files for vdf2 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vdf2-2.0.0.tar.gz | 2.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vdf2-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.7 kB
Release files / vdf2-2.0.0.tar.gz
| Download URL | vdf2-2.0.0.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
807a6b407856a1177f573a5798566255af7a31d839409d128b52b3abffc1e701
|
|
BLAKE2b-256 checksum How to use checksums |
1be0a20bb5c3500f99c929536f60caada97d0f5c156bf68624d3746226c60255
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / vdf2-2.0.0-py3-none-any.whl
| Download URL | vdf2-2.0.0-py3-none-any.whl |
|---|---|
| Size | 2.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
106881fe2a0caf42b26e08664d4fd9281d28c64cbe2c577c1be9f8fef6c6717a
|
|
BLAKE2b-256 checksum How to use checksums |
835218b8a565706bf77aea818dbd487fe4ab6dc37807ba1601d10277051bd5de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|