Skip to main content

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

MIT

Release files for vdf2 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vdf2 2.0.1
File Size Uploaded
vdf2-2.0.1.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vdf2 2.0.1
File Interpreter ABI Platform
vdf2-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / vdf2-2.0.1.tar.gz

Download URL vdf2-2.0.1.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8c246bd3e1d88f955abd59b7df2513bc267cdbfbcf228f5e812efe052cf2feb4
BLAKE2b-256 checksum
How to use checksums
774357fbad71f2cddf600bf5ea134fa8c2c8109bc87dd443c6984bb6c57c1013
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.1-py3-none-any.whl

Download URL vdf2-2.0.1-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0dd45105e7424453ee3b07023af12ba8b59d279812e85c963cb65405f4ff4099
BLAKE2b-256 checksum
How to use checksums
55278bcf22a75b9dbb2630b7af2508b191a58922bd339f4ec23717ea88fb0f81
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 history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page