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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cs2df-3.0.3.tar.gz.
File metadata
- Download URL: cs2df-3.0.3.tar.gz
- Upload date:
- Size: 85.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9f348c0673eaa2bab891ba955b3db3a46e4f526750d43e1f31860c170c9821f
|
|
| MD5 |
3a86cadb0a0b05265e31129630379618
|
|
| BLAKE2b-256 |
436a2809d91c0fabe79e52b855d8b8a7af78a5fbfa2c7b3712915b23bcecae3d
|
Provenance
The following attestation bundles were made for cs2df-3.0.3.tar.gz:
Publisher:
publish-pypi.yml on Starfie1d1272/cs2-demo-format
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cs2df-3.0.3.tar.gz -
Subject digest:
e9f348c0673eaa2bab891ba955b3db3a46e4f526750d43e1f31860c170c9821f - Sigstore transparency entry: 1810001008
- Sigstore integration time:
-
Permalink:
Starfie1d1272/cs2-demo-format@b0a6ca747cb3753c6ff9ccab6cb71fb6e03a5308 -
Branch / Tag:
refs/tags/v3.0.3 - Owner: https://github.com/Starfie1d1272
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@b0a6ca747cb3753c6ff9ccab6cb71fb6e03a5308 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cs2df-3.0.3-py3-none-any.whl.
File metadata
- Download URL: cs2df-3.0.3-py3-none-any.whl
- Upload date:
- Size: 44.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51c3072dfef4354544c9f9902280e7358ce5e529c47637660226272f54bf1ba0
|
|
| MD5 |
e51a140d39fae930bce278b8928538f6
|
|
| BLAKE2b-256 |
16dd4b95a3c0d08de451814e329d9db24aea5e6d1075f3b5e9dd6c1218347915
|
Provenance
The following attestation bundles were made for cs2df-3.0.3-py3-none-any.whl:
Publisher:
publish-pypi.yml on Starfie1d1272/cs2-demo-format
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cs2df-3.0.3-py3-none-any.whl -
Subject digest:
51c3072dfef4354544c9f9902280e7358ce5e529c47637660226272f54bf1ba0 - Sigstore transparency entry: 1810001043
- Sigstore integration time:
-
Permalink:
Starfie1d1272/cs2-demo-format@b0a6ca747cb3753c6ff9ccab6cb71fb6e03a5308 -
Branch / Tag:
refs/tags/v3.0.3 - Owner: https://github.com/Starfie1d1272
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@b0a6ca747cb3753c6ff9ccab6cb71fb6e03a5308 -
Trigger Event:
push
-
Statement type: