Skip to content

Models

Modfile

A single file entry within a modpack.

Attributes:

Name Type Description
url str

Remote download URL for the file.

filename str

Bare filename (no directory component) used when writing to disk.

size int

Expected file size in bytes, as declared in the modpack index.

hash str | None

Optional expected hex digest. Verified after download; raises :exc:~packlayer.HashMismatch if the digest does not match.

hash_type Literal['sha512', 'sha1'] | None

The type of said hash, e.g: "sha512", "sha1", etc.

optional bool

Whether this mod is optional.

side Literal['client', 'server', 'both']

Whether the mod is client-side, server-side, or both.

Source code in packlayer/domain/models.py
@dataclass(frozen=True)
class ModFile:
    """A single file entry within a modpack.

    Attributes
    ----------
    url:
        Remote download URL for the file.
    filename:
        Bare filename (no directory component) used when writing to disk.
    size:
        Expected file size in bytes, as declared in the modpack index.
    hash:
        Optional expected hex digest. Verified after download; raises
        :exc:`~packlayer.HashMismatch` if the digest does not match.
    hash_type:
        The type of said hash, e.g: ``"sha512"``, ``"sha1"``, etc.
    optional:
        Whether this mod is optional.
    side:
        Whether the mod is client-side, server-side, or both.
    """

    url: str
    filename: str
    size: int
    hash: str | None = None
    hash_type: Literal["sha512", "sha1"] | None = None
    optional: bool = False
    side: Literal["client", "server", "both"] = "both"

Override

A non-mod file to be written into the instance directory after installation.

Overrides cover anything outside mods/ — configs, scripts, resource packs, shader settings, etc. The content is either bundled inline (data) or fetched from a remote URL (url); exactly one should be set.

Attributes:

Name Type Description
path str

Destination path relative to the instance root (e.g. "config/sodium.json"). Parent directories are created automatically during installation.

side Literal['client', 'server', 'both']

Which side this override applies to. Overrides incompatible with the chosen :class:InstallOptions side are skipped during installation.

data bytes | None

Raw file contents to write directly to disk. Set by resolvers that bundle overrides inside the package itself (e.g. .mrpack zips). Mutually exclusive with url.

url str | None

Remote URL to fetch the file from. Set by resolvers where override files are hosted separately (e.g. FTB). Mutually exclusive with data.

Source code in packlayer/domain/models.py
@dataclass(frozen=True)
class Override:
    """A non-mod file to be written into the instance directory after installation.

    Overrides cover anything outside ``mods/`` — configs, scripts, resource packs,
    shader settings, etc. The content is either bundled inline (``data``) or fetched
    from a remote URL (``url``); exactly one should be set.

    Attributes
    ----------
    path:
        Destination path relative to the instance root (e.g. ``"config/sodium.json"``).
        Parent directories are created automatically during installation.
    side:
        Which side this override applies to. Overrides incompatible with the
        chosen :class:`InstallOptions` side are skipped during installation.
    data:
        Raw file contents to write directly to disk. Set by resolvers that
        bundle overrides inside the package itself (e.g. ``.mrpack`` zips).
        Mutually exclusive with ``url``.
    url:
        Remote URL to fetch the file from. Set by resolvers where override
        files are hosted separately (e.g. FTB). Mutually exclusive with ``data``.
    """

    path: str
    side: Literal["client", "server", "both"] = "both"
    data: bytes | None = None
    url: str | None = None

Modpack

A resolved modpack ready for installation.

Attributes:

Name Type Description
name str

Human-readable display name of the modpack.

version str

Version identifier string (e.g. "1.8.3").

minecraft_version str

The Minecraft version this modpack targets (e.g. "1.20.1").

files tuple[ModFile, ...]

Immutable sequence of [ModFile][] entries to be downloaded. Empty by default for modpacks that declare no files.

overrides tuple[Override, ...]

Immutable sequence of [Override][] entries to be written to the instance directory. Empty by default.

Source code in packlayer/domain/models.py
@dataclass(frozen=True)
class Modpack:
    """A resolved modpack ready for installation.

    Attributes
    ----------
    name:
        Human-readable display name of the modpack.
    version:
        Version identifier string (e.g. ``"1.8.3"``).
    minecraft_version:
        The Minecraft version this modpack targets (e.g. ``"1.20.1"``).
    files:
        Immutable sequence of [`ModFile`][ModFile] entries to be downloaded.
        Empty by default for modpacks that declare no files.
    overrides:
        Immutable sequence of [`Override`][Override] entries to be written to the
        instance directory. Empty by default.
    """

    name: str
    version: str
    minecraft_version: str
    files: tuple[ModFile, ...] = field(default_factory=tuple)
    overrides: tuple[Override, ...] = field(default_factory=tuple)

ModpackVersion

Metadata for a single releasable version of a modpack.

Returned by [list_versions][packlayer.PacklayerClient.list_versions]. Use version_number to pin a specific release when calling [resolve][packlayer.PacklayerClient.resolve].

Attributes:

Name Type Description
id str

Opaque provider-assigned identifier for this version.

version_number str

Human-readable version string (e.g. "5.4.0-beta.3").

name str

Display name of the release (may differ from version_number).

loaders tuple[str, ...]

Mod loaders this version supports (e.g. ("fabric", "quilt")).

game_versions tuple[str, ...]

Minecraft versions this release is compatible with (e.g. ("1.20.1",)).

date_published str

ISO 8601 timestamp of when this version was published (e.g. "2024-03-15T10:00:00Z").

Source code in packlayer/domain/models.py
@dataclass(frozen=True)
class ModpackVersion:
    """Metadata for a single releasable version of a modpack.

    Returned by [`list_versions`][packlayer.PacklayerClient.list_versions]. Use
    ``version_number`` to pin a specific release when calling
    [`resolve`][packlayer.PacklayerClient.resolve].

    Attributes
    ----------
    id:
        Opaque provider-assigned identifier for this version.
    version_number:
        Human-readable version string (e.g. ``"5.4.0-beta.3"``).
    name:
        Display name of the release (may differ from ``version_number``).
    loaders:
        Mod loaders this version supports (e.g. ``("fabric", "quilt")``).
    game_versions:
        Minecraft versions this release is compatible with
        (e.g. ``("1.20.1",)``).
    date_published:
        ISO 8601 timestamp of when this version was published
        (e.g. ``"2024-03-15T10:00:00Z"``).
    """

    id: str
    version_number: str
    name: str
    loaders: tuple[str, ...]
    game_versions: tuple[str, ...]
    date_published: str

InstallOptions

Controls which files are downloaded during installation.

Attributes:

Name Type Description
include_optional bool

If False, files marked optional by the modpack are skipped. Defaults to True.

side Literal['client', 'server', 'both']

Which side to install for. Files incompatible with the chosen side are skipped. Defaults to "client".

Source code in packlayer/domain/models.py
@dataclass(frozen=True)
class InstallOptions:
    """Controls which files are downloaded during installation.

    Attributes
    ----------
    include_optional:
        If ``False``, files marked optional by the modpack are skipped.
        Defaults to ``True``.
    side:
        Which side to install for. Files incompatible with the chosen side
        are skipped. Defaults to ``"client"``.
    """

    include_optional: bool = True
    side: Literal["client", "server", "both"] = "client"