mod_list

archive_to_string(archive: ZipFile, filepath: str) str

Simply grabs a file with the specified name from an archive and returns it as a string. Ensures that the returned string is stripped of special unicode characters that Lupa dislikes.

discover_mods(
game_path: str,
mods_path: str,
no_mods: bool = False,
) dict[str, list[Mod]]

Returns an list of all mods detected at a specific game data and mod folder location, including different versions of the same mod. If there are multiples of the same mod found, the mods are sorted latest version first, preferring folders if there’s a tie.

Parameters:
game_path: str

Path to the directory which houses Factorio’s game data.

mods_path: str

Path the the directory which houses the desired user mods.

no_mods: bool = False

Omits any user mods found at mods_path, while leaving game data untouched.

display_mods(
mods: dict[str, list[Mod]],
verbose=False,
) None

Pretty-print a given list of mods, primarily for command line interface purposes.

file_to_string(filepath: str) str

Simply grabs a file’s contents and returns it as a string. Ensures that the returned string is stripped of special unicode characters that Lupa dislikes.

read_mod_list_json(mods_path)

Simple wrapper to read from a mod-list.json file.

register_mod(mod_name, mod_location, mod_list_json={'mods': {}})

Attempts to create a Mod object from the given folder or zip file. This function not only touches the archive or folder pointed to, but also determines whether or not it’s enabled from the mod_list_json parameter (if present).

set_mods_enabled(
game_path: str,
mods_path: str,
mod_names: list[str],
enabled: bool = True,
verbose: bool = False,
)

Sets a given list of mod names to be either enabled or disabled, based on parameter enabled.

write_mod_list_json(mods_path, json_dict)

Simple wrapper to write to a mod-list.json file.

class Mod(
location: str,
stages: set[str],
name: str,
title: str,
author: str,
version: str = '',
contact: str | None = None,
homepage: str | None = None,
description: str | None = None,
factorio_version: str | None = None,
dependencies: list[str] = ['base'],
quality_required: bool = False,
rail_bridges_required: bool = False,
space_travel_required: bool = False,
spoiling_required: bool = False,
freezing_required: bool = False,
segmented_units_required: bool = False,
expansion_shaders_required: bool = False,
enabled: bool = True,
**kwargs,
)

Mod object that stores metadata during the load process. Mostly used for structuring the data and determining the load order.

depends_on(mod_name)

Returns true if mod is a required dependency of this Mod.

get_file(filepath) str

Grabs the data from the file as a string.

setup_archive(archive: ZipFile, archive_folder: str)

Initialize the internal structure with archive data.

setup_folder()

Initialize the internal structure with folder data.