Skip to content

About

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

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

38 Commits

Folders and files

Repository files navigation

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.

About

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

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages