Skip to main content

cdp-unpack

GitHub release (latest by date) Python 3.8+ License MIT

A cross-platform CLI and Python module for extracting files from CDP/CHUMP archives used by Trainz.

Installation

The CLI or Python module can be installed in the following ways:

Standalone CLI executable

Download the standalone CLI executable from the Releases page for your operating system, then extract it somewhere you can find it.

See Usage for details on how to use the CLI.

Python module from PyPI

pip install --upgrade cdpunpack

Python module from wheel

If you have downloaded a .whl file from the Releases page, install it with:

pip install path/to/cdpunpack<version>‑py3‑none‑any.whl

Replace <version> with the actual version number in the filename.

Python module from source

git clone https://github.com/pgroenbaek/cdp-unpack.git
pip install --upgrade ./cdp-unpack

Usage

Running the CLI

Windows

.\cdpunpack.exe input.cdp output_folder

Linux

./cdpunpack input.cdp output_folder

Listing contents of archives

Use the --list parameter to list contents of a .cdp file, for example:

.\cdpunpack.exe --list input.cdp

Running as a Python module

python3 -m cdpunpack input.cdp output_folder

Using the module in Python scripts

from pathlib import Path
from cdpunpack import parse_cdp, extract_document

input_path: Path = Path("path/to/input.cdp")
output_path: Path = Path("path/to/output")

data = input_path.read_bytes()

document = parse_cdp(data)

asset_count, file_count = extract_document(
    document,
    output_path,
)

print(f"Extracted Assets: {asset_count}")
print(f"Extracted Files: {file_count}")

Building

Prerequisites

A Python 3.8+ installation is needed for building the module and standalone CLI executable.

In addition, Nuitka is required for building the standalone CLI executable, install it from pip using:

pip install "nuitka[onefile]"

Building the wheel and CLI executable:

Windows

Run the following command in PowerShell:

.\tools\package_windows.ps1

Linux

Run the following command in a terminal:

./tools/package_linux.sh

Running Tests

You can run tests manually or use tox to test across multiple Python versions.

Run Tests Manually

First, install the required dependencies:

pip install pytest

Then, run tests with:

pytest

Run Tests with tox

First, install the required dependencies:

pip install tox pytest

Then, run tests with:

tox

This will execute tests for all Python versions specified in tox.ini.

License

This project is a Python port/adaptation of the extraction-portion of cdptool.

The original code is Copyright (c) 2026 cdptool contributors and is licensed under the MIT License.

This Python implementation is also released under the MIT License.

Metadata

Release files for cdpunpack 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdpunpack 0.1.0
File Size Uploaded
cdpunpack-0.1.0.tar.gz 24.4 kB Details

Built distribution (wheel)

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

Total release size: 57.9 kB

Release files / cdpunpack-0.1.0.tar.gz

Download URL cdpunpack-0.1.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f57bbb586dbc5d1ce744002df586877924c7c3cd9170b1cb4c4c0c30475879f2
BLAKE2b-256 checksum
How to use checksums
f138b9b46ebc44683800cd395c2c25f281b9f7850d9bbb0a64bbbfddf2d91250
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / cdpunpack-0.1.0-py3-none-any.whl

Download URL cdpunpack-0.1.0-py3-none-any.whl
Size 33.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77b44bb7afb1cb4fc15cadb20642c4615ef83fd60f00e4160a32970d3ad2de2b
BLAKE2b-256 checksum
How to use checksums
ba4a17cf808ed2d3af5eae664b9b49c3e09e0f4b17b06afebf5f63e7d62effcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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