Skip to main content

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).

Metadata

Release files for cs2df 3.1.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 cs2df 3.1.1
File Size Uploaded Provenance Actions
cs2df-3.1.1.tar.gz 89.9 kB With provenance Details for cs2df-3.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 138.0 kB

Release files / cs2df-3.1.1.tar.gz

Download URL cs2df-3.1.1.tar.gz
Size 89.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9bdf9d916a6a3acc3c026a97a9928ef1fadae0e2dd28fbcc809a801eac86e961
BLAKE2b-256 checksum
How to use checksums
fd23ce378836c9353fbade75fc9841a4dcf2a07a67c0e3366cd5b906ddf85ee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / cs2df-3.1.1-py3-none-any.whl

Download URL cs2df-3.1.1-py3-none-any.whl
Size 48.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d5f180808f26bf3f63c7841ec82bb2648b89a7942c723f2755fc5739e43250e
BLAKE2b-256 checksum
How to use checksums
4c2f7ec5216f975bc1791d331c53d6c7f517fd9576bfe4af11864322dcbb7051
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for cs2df 3.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cs2df-3.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

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