Skip to main content

Reference exporter & validator CLI for cs2-demo-format v3 (CS2 demo → ZIP data package)

Project description

cs2df

cs2df is the reference Python exporter and validator for the cs2-demo-format v3 ZIP contract.

It parses CS2 .dem files with demoparser2, writes strict v3 ZIP packages, and validates exported packages with schema plus package-level QA.

Setup

uv sync

The CLI entrypoint is cs2df.

Export

# Standard profile: required files + shots.json + replay.json
uv run cs2df export match.dem

# Research profile: also emit full-tick duels.json windows
uv run cs2df export match.dem --research

# Choose an output path
uv run cs2df export match.dem -o match.zip

The default ZIP compression level is 3, chosen from local benchmark results as a speed/size balance. Use a higher level when smaller ZIPs matter more:

uv run cs2df export match.dem --compress-level 6
uv run cs2df export match.dem --compress-level 9

Batch Export

uv run cs2df export-batch ./demos --workers 8 --descriptive

export-batch scans one directory non-recursively for .dem files and writes one ZIP per demo. It also writes report.json next to the outputs with:

  • per-demo success/failure status
  • output ZIP size
  • source demo size
  • compression level
  • total duration
  • aggregate throughput
  • parse/package/write stage timings

Bad demos are reported as failed rows; a single parser failure does not crash the whole batch. Use --fail-fast when you want the batch to stop after the first failed demo.

Validate

uv run cs2df validate match.zip
uv run cs2df validate match.zip --strict

Validation checks JSON Schema and package-level invariants such as cross-file player indexes, round windows, column lengths, weapon dictionary indexes, and formal-round consistency.

Role in the Repository

This is a reference implementation, not the contract itself. The authoritative contract lives in ../schemas/index.ts and the generated JSON Schemas in the repository's spec/ directory. Any producer that emits a ZIP passing strict validation is conformant.

The exporter also serves as the performance baseline for the v3 format: per-frame data stays in pandas DataFrames until the columnar stream builders materialize compact integer arrays for JSON serialization.

Event-extraction logic was originally ported from cs2-demo-analysis-kit (and before that DrEAmSs59/CS2-insight-agent, with the author's permission).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cs2df-3.0.0.tar.gz (82.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cs2df-3.0.0-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

Details for the file cs2df-3.0.0.tar.gz.

File metadata

  • Download URL: cs2df-3.0.0.tar.gz
  • Upload date:
  • Size: 82.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for cs2df-3.0.0.tar.gz
Algorithm Hash digest
SHA256 aa4089216b4fac5f34f299fb0ee1a0f4d664e25c95b71f526518d9e9857e9ad2
MD5 16b24004f216636baf033e55589c0794
BLAKE2b-256 6730b17f209735dd7e30e5cf19efe333f5b9673c3e88828cb62e3077296403d9

See more details on using hashes here.

File details

Details for the file cs2df-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: cs2df-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 42.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for cs2df-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa0e253fab009855f562955221c2cdc74b5c83557feb04b26c4616db74c52af9
MD5 ade66d8978076e44d5971318a76d243c
BLAKE2b-256 989554f88ac3472682271c0b63eff20b3c6996fc65c75f9434d14a2c9c74ca14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page