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

Metadata

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 Provenance Actions
vdf2-2.0.1.tar.gz 2.5 kB Without provenance Details for vdf2-2.0.1.tar.gz

Built distribution (wheel)

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

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}

Security for vdf2 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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