Metadata-Version: 2.3
Name: vdf2
Version: 2.0.1
Summary: Add your description here
Author: r41ngee
Author-email: r41ngee <r41ngee@yandex.ru>
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# 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 `dict`s
- Serialize `dict`s back into VDF text
- Handles nested dictionaries and escaped quotes (`\"`)
- Strips `//` line comments
- Zero dependencies

## Installation

```bash
pip install vdf2
```

Requires Python 3.14+.

## Usage

### Parse a VDF string

```python
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

```python
with open("config.vdf") as fp:
    data = vdf2.load(fp)
```

### Serialize to a VDF string

```python
text = vdf2.dumps(data)
```

### Serialize to a file

```python
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](LICENSE)
