Skip to main content

ra2mix

PyPI - Version PyPI - Python Version PyPI - License

A python library for working with Red Alert 2 / Yuri's Revenge *.mix files

Mix files are archive files used to store most game files from the games Command And Conquer Red Alert 2 and its expansion pack Yuri's Revenge.

This library allows you to interact with the mix files much like you'd interact with zip files using a program like 7-zip -- except programmatically, of course 😎. You can create mix files by archiving a list of several files, or read existing mix files and do something with the archived files contained within it.

Table of Contents

Installation

pip install ra2mix

Usage

Import the package

import ra2mix

Reading a *.mix file

  • Read:

    The ra2mix.read function can take a *.mix filepath and return a dict[str, bytes] object. The keys are filenames and the values are file data as bytes.

    import ra2mix
    mix_filepath = "path/to/mixfile.mix"
    
    filemap = ra2mix.read(mix_filepath)
    print(f"filenames: {list(filemap.keys())}")
    
    for filename, file_data in filemap.items():
        # do something with the file data
    
  • Extract:

    The ra2mix.extract function takes a *.mix filepath and an extraction folder path. The files contained in the mix file will be written to the folder.

    import ra2mix
    mix_filepath = "path/to/mixfile.mix"
    extract_folder = "extract/to/folder"
    
    ra2mix.extract(mix_filepath, extract_folder)
    

Creating a *.mix file

The ra2mix.write function supports three methods for specifying files to include in a new *.mix file:

  • filemap: A dict[str, bytes] object consisting of filenames and file data
  • folder_path: A path to a folder; all files in the folder are added to the mix
  • filepaths: A list[str] containing exact filepaths to include in the mix
import ra2mix
mix_filepath = "path/to/mixfile.mix"

target_folder = "read/from/folder"

mix_data = ra2mix.write(mix_filepath, folder_path=target_folder)

# Optionally do something with mix_data if you want; file is already written to
# `mix_filepath`

Metadata

Release files for ra2mix 1.0.4

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

Source distribution (sdist)

Source distribution for ra2mix 1.0.4
File Size Uploaded
ra2mix-1.0.4.tar.gz 137.1 kB Details

Built distribution (wheel)

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

Total release size: 276.1 kB

Release files / ra2mix-1.0.4.tar.gz

Download URL ra2mix-1.0.4.tar.gz
Size 137.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7074b7507dac250be16e8ee6bb54bf66062ff627fdceaa4f23f42015f625828a
BLAKE2b-256 checksum
How to use checksums
a7e57b4779c8afa5b60f582f05b9515cb8ea70cac10348bfe3a5603cb85cc424
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / ra2mix-1.0.4-py3-none-any.whl

Download URL ra2mix-1.0.4-py3-none-any.whl
Size 139.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61230746a1e95131290c028fced129e8dcc0bb1df7b900ccc79e8c2f37de93f8
BLAKE2b-256 checksum
How to use checksums
b6b9e10238af1d1f42ee2dd8a9aa6c4a932f05474c08088ce5212cc015ad5754
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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