Skip to content

API

Pyrig plugin that builds and publishes standalone project executables.

Installing this package as a dependency extends a pyrig-built project with everything needed to package its entry point as a distributable binary, publish one for every supported operating system alongside each release, and run that entry point locally the same way the packaged binary does.

main

Project entry point.

Provides the main function and __main__ guard used as the project's executable entry point. Replace main with the project's real startup logic.

main

main() -> None

Run the project.

Source code in src/pyrig_executables/main.py
def main() -> None:
    """Run the project."""

rig

Mirrored namespace through which this plugin extends pyrig's scaffolding.

Mirrors the pyrig.rig package layout so pyrig's cross-package plugin discovery finds this plugin's contributions automatically.

cli

CLI commands this plugin contributes to a project.

commands

Backend implementations for this plugin's CLI commands.

Each module implements exactly one command as a plain callable, decoupled from the CLI registration layer. This separation lets the registration layer import commands lazily, loading each module only when its command is invoked.

run

CLI command implementation for running the project's entry-point module.

run_main
run_main() -> None

Execute the project's main.py as the __main__ module.

Runs the file by path rather than importing it, so its if __name__ == "__main__" guard fires and calls main, mirroring how the built executable runs the same file.

Source code in src/pyrig_executables/rig/cli/commands/run.py
def run_main() -> None:
    """Execute the project's `main.py` as the `__main__` module.

    Runs the file by path rather than importing it, so its
    `if __name__ == "__main__"` guard fires and calls `main`, mirroring how the
    built executable runs the same file.
    """
    run_path(MainConfigFile.I.path().as_posix(), run_name="__main__")

subcommands

Project-specific CLI commands.

Functions defined directly in this module are discovered and registered as top-level CLI commands. Module-level typer.Typer instances are registered as command groups, with each group named after the kebab-case form of its variable name.

run
run() -> None

Run the project.

This command runs the project's main.py file as the __main__ module.

Source code in src/pyrig_executables/rig/cli/subcommands.py
def run() -> None:
    """Run the project.

    This command runs the project's `main.py` file as the `__main__` module.
    """
    from pyrig_executables.rig.cli.commands.run import run_main  # noqa: PLC0415

    run_main()

configs

Declarative definitions of the configuration files this plugin contributes.

This package is this plugin's discovery scope for pyrig's config-file management: every file this plugin manages is defined here and validated during pyrig sync.

icon

Config that scaffolds the executable's icon as rig/resources/icon.png.

IconConfigFile

Bases: DictConfigFile

Config file that scaffolds the icon.png used as the executable's icon.

The release workflow bundles this file into the built executable as its icon. The scaffolded file is a default -- replace it with your own; it is created only when missing, so a project's own icon is preserved.

Note

If the file exists but is not a valid PNG, validation raises RuntimeError rather than automatically restoring the default icon.

extension
extension() -> str

Return "png" as the icon's file extension.

Source code in src/pyrig_executables/rig/configs/icon.py
def extension(self) -> str:
    """Return `"png"` as the icon's file extension."""
    return "png"
is_correct
is_correct() -> bool

Return whether the icon file starts with the PNG signature.

Only the 8-byte PNG magic number is checked; the rest of the file's bytes are not otherwise validated.

Returns:

Type Description
bool

True if the icon file starts with the PNG signature; False

bool

otherwise.

Source code in src/pyrig_executables/rig/configs/icon.py
def is_correct(self) -> bool:
    """Return whether the icon file starts with the PNG signature.

    Only the 8-byte PNG magic number is checked; the rest of the file's
    bytes are not otherwise validated.

    Returns:
        `True` if the icon file starts with the PNG signature; `False`
        otherwise.
    """
    with self.path().open("rb") as f:
        return f.read(8) == b"\x89PNG\r\n\x1a\n"
parent_path
parent_path() -> Path

Return the directory the icon lives in.

Returns:

Type Description
Path

The project's rig/resources package directory, shared with the

Path

config file that scaffolds that package's __init__.py.

Source code in src/pyrig_executables/rig/configs/icon.py
def parent_path(self) -> Path:
    """Return the directory the icon lives in.

    Returns:
        The project's `rig/resources` package directory, shared with the
        config file that scaffolds that package's `__init__.py`.
    """
    return ResourcesInitConfigFile.I.parent_path()
stem
stem() -> str

Return "icon" as the icon's filename stem.

Source code in src/pyrig_executables/rig/configs/icon.py
def stem(self) -> str:
    """Return `"icon"` as the icon's filename stem."""
    return "icon"

main

Configuration for the project's main entry-point module.

Scaffolds a main.py containing a callable main function in every project that installs this plugin. The module provides the entry point that the executable builder bundles into a standalone binary, so this config guarantees that a suitable build target always exists.

MainConfigFile

Bases: CopyModuleConfigFile

Scaffolding for the project's main.py entry-point module.

Copies this plugin's own entry-point module into the target project as main.py. Once the file exists, a project's own implementation stands rather than being overwritten, as long as it still satisfies the entry-point contract that is_correct checks for.

copy_module
copy_module() -> ModuleType

Return the pyrig_executables.main module used as main.py scaffolding.

Source code in src/pyrig_executables/rig/configs/main.py
def copy_module(self) -> ModuleType:
    """Return the `pyrig_executables.main` module used as `main.py` scaffolding."""
    return main_module
has_callable_main
has_callable_main() -> bool

Return whether the target module exposes a callable main attribute.

Source code in src/pyrig_executables/rig/configs/main.py
def has_callable_main(self) -> bool:
    """Return whether the target module exposes a callable `main` attribute."""
    return callable(getattr(self.module(), main_func.__name__, None))
has_main_guard
has_main_guard() -> bool

Return whether the target module's file contains the __main__ guard.

Matched via plain substring search, so the guard text must appear exactly as returned by main_guard.

Returns:

Type Description
bool

True if the guard snippet is present in the file.

Source code in src/pyrig_executables/rig/configs/main.py
def has_main_guard(self) -> bool:
    """Return whether the target module's file contains the `__main__` guard.

    Matched via plain substring search, so the guard text must appear
    exactly as returned by `main_guard`.

    Returns:
        `True` if the guard snippet is present in the file.
    """
    return self.main_guard() in self.read_content()
is_correct
is_correct() -> bool

Return whether the project's main.py is valid.

Overrides the inherited content check: main.py is correct once the target module exposes a callable main and contains a __main__ execution guard, regardless of what the function body does. This lets a project's own entry-point implementation stand unmodified.

Returns:

Type Description
bool

True if the target module defines a callable main and the

bool

__main__ guard is present.

Source code in src/pyrig_executables/rig/configs/main.py
def is_correct(self) -> bool:
    """Return whether the project's `main.py` is valid.

    Overrides the inherited content check: `main.py` is correct once the
    target module exposes a callable `main` and contains a `__main__`
    execution guard, regardless of what the function body does. This lets
    a project's own entry-point implementation stand unmodified.

    Returns:
        `True` if the target module defines a callable `main` and the
        `__main__` guard is present.
    """
    return self.has_callable_main() and self.has_main_guard()
main_guard
main_guard() -> str

Return the canonical __main__ execution guard snippet.

Returns:

Type Description
str

The if __name__ == "__main__" block that calls main.

Source code in src/pyrig_executables/rig/configs/main.py
def main_guard(self) -> str:
    """Return the canonical `__main__` execution guard snippet.

    Returns:
        The `if __name__ == "__main__"` block that calls `main`.
    """
    return f"""if __name__ == "__main__":
{main_func.__name__}()"""

version_control

Version control configuration adjusted for standalone executable distribution.

Extends the base version control setup, local or remote, to account for building and publishing standalone executables alongside a release.

remote

Overrides for the project's GitHub-hosted remote repository configuration.

workflows

Overrides for the project's GitHub Actions workflow configuration.

release

Extension of the release workflow that builds and attaches executables.

ReleaseWorkflowConfigFile

Bases: ReleaseWorkflowConfigFile

Release workflow that builds and attaches standalone executables.

Extends the base release workflow with a matrix job that builds a single-file executable for every supported operating system and attaches each one to the GitHub release as a release asset, alongside the generated changelog.

artifact_name
artifact_name(os: str) -> str

Build the workflow-artifact name for the given runner OS.

Single source of the executable-<os> artifact label. Kept deliberately generic and distinct from executable_name, so it does not collide with artifacts that other actions may name after the project.

Parameters:

Name Type Description Default
os str

The runner OS suffix, or "*" to build a name matching every OS.

required

Returns:

Type Description
str

The executable-<os> artifact name.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def artifact_name(self, os: str) -> str:
    """Build the workflow-artifact name for the given runner OS.

    Single source of the `executable-<os>` artifact label. Kept
    deliberately generic and distinct from `executable_name`, so it does
    not collide with artifacts that other actions may name after the
    project.

    Args:
        os: The runner OS suffix, or `"*"` to build a name matching
            every OS.

    Returns:
        The `executable-<os>` artifact name.
    """
    return f"executable-{os}"
collect_all_modules
collect_all_modules() -> Iterable[ModuleType]

Return the modules to bundle in full (data, submodules, binaries).

Empty by default, since the project's own resources package is pure data and is covered by collect_data_modules instead. Override to bundle additional modules that ship submodules or binaries alongside their data.

Returns:

Type Description
Iterable[ModuleType]

No modules, by default.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def collect_all_modules(self) -> Iterable[ModuleType]:
    """Return the modules to bundle in full (data, submodules, binaries).

    Empty by default, since the project's own resources package is pure
    data and is covered by `collect_data_modules` instead. Override to
    bundle additional modules that ship submodules or binaries alongside
    their data.

    Returns:
        No modules, by default.
    """
    return ()
collect_data_modules
collect_data_modules() -> Iterable[ModuleType]

Return the resource modules whose data files to bundle into the executable.

Resolves the project's rig/resources package, the location the pyrig-resources plugin scaffolds and validates. Locating the project's resources is a config concern, so it lives here rather than in the project-agnostic executable builder tool. Override to bundle additional pure-data resource packages.

Returns:

Type Description
Iterable[ModuleType]

The project's resource modules (the rig/resources package).

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def collect_data_modules(self) -> Iterable[ModuleType]:
    """Return the resource modules whose data files to bundle into the executable.

    Resolves the project's `rig/resources` package, the location the
    `pyrig-resources` plugin scaffolds and validates. Locating the
    project's resources is a config concern, so it lives here rather than
    in the project-agnostic executable builder tool. Override to bundle
    additional pure-data resource packages.

    Returns:
        The project's resource modules (the `rig/resources` package).
    """
    return (ResourcesInitConfigFile.I.module(),)
executable_name
executable_name() -> str

Build the per-OS name of the executable binary and release asset.

Combines the project name with the runner OS so each platform's binary gets a unique, recognizable, collision-free name (e.g. pyrig-executables-Linux). The OS is resolved at workflow runtime.

Returns:

Type Description
str

The <project>-<os> name string.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def executable_name(self) -> str:
    """Build the per-OS name of the executable binary and release asset.

    Combines the project name with the runner OS so each platform's binary
    gets a unique, recognizable, collision-free name (e.g.
    `pyrig-executables-Linux`). The OS is resolved at workflow runtime.

    Returns:
        The `<project>-<os>` name string.
    """
    return f"{PackageManager.I.project_name()}-{self.insert_os()}"
insert_os
insert_os() -> str

Return the expression that resolves to the current runner's OS.

Returns:

Type Description
str

GitHub Actions expression for runner.os (e.g. Linux,

str

Windows, macOS).

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def insert_os(self) -> str:
    """Return the expression that resolves to the current runner's OS.

    Returns:
        GitHub Actions expression for `runner.os` (e.g. `Linux`,
        `Windows`, `macOS`).
    """
    return self.insert_expression("runner.os")
job_executable
job_executable() -> dict[str, Any]

Build the matrix job that compiles the executable on every OS.

Runs across the default OS matrix (Linux, Windows, macOS), since pyinstaller cannot cross-compile and each binary must be built on its target platform.

Returns:

Type Description
dict[str, Any]

Job configuration with an OS matrix strategy, a dynamic runs-on

dict[str, Any]

value, and the build and upload steps.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def job_executable(self) -> dict[str, Any]:
    """Build the matrix job that compiles the executable on every OS.

    Runs across the default OS matrix (Linux, Windows, macOS), since
    `pyinstaller` cannot cross-compile and each binary must be built on
    its target platform.

    Returns:
        Job configuration with an OS matrix strategy, a dynamic `runs-on`
        value, and the build and upload steps.
    """
    return self.job(
        self.job_executable,
        strategy=self.strategy_matrix_os(),
        runs_on=self.insert_matrix_os(),
        steps=self.steps_executable(),
    )
job_publish
job_publish() -> dict[str, Any]

Build the release job, gated on the executable build job.

Adds a needs dependency on executable so the release is only published once every platform's binary is available to attach.

Returns:

Type Description
dict[str, Any]

The base release job with a needs dependency added.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def job_publish(self) -> dict[str, Any]:
    """Build the release job, gated on the executable build job.

    Adds a `needs` dependency on `executable` so the release is
    only published once every platform's binary is available to attach.

    Returns:
        The base release job with a `needs` dependency added.
    """
    jobs = super().job_publish()
    jobs[self.job_id_from_method(self.job_publish)]["needs"] = [
        self.job_id_from_method(self.job_executable),
    ]
    return jobs
jobs
jobs() -> dict[str, Any]

Build the complete set of workflow jobs.

Adds the executable build job to the base release jobs.

Returns:

Type Description
dict[str, Any]

Dict containing the executable build job together with the base

dict[str, Any]

release jobs.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def jobs(self) -> dict[str, Any]:
    """Build the complete set of workflow jobs.

    Adds the executable build job to the base release jobs.

    Returns:
        Dict containing the executable build job together with the base
        release jobs.
    """
    return {
        **self.job_executable(),
        **super().jobs(),
    }
priority
priority() -> float

Return a priority one step after the resources config's.

Building the executable requires the project's resources package to already exist, so this config must validate after it. Deriving from its priority instead of hard-coding a value keeps this config's priority in step with any future change to the resources config's own priority.

Returns:

Type Description
float

The resources config's priority lowered by one Priority.STEP.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def priority(self) -> float:
    """Return a priority one step after the resources config's.

    Building the executable requires the project's resources package to
    already exist, so this config must validate after it. Deriving from
    its priority instead of hard-coding a value keeps this config's
    priority in step with any future change to the resources config's own
    priority.

    Returns:
        The resources config's priority lowered by one `Priority.STEP`.
    """
    return Priority.decrease(ResourcesInitConfigFile.I.priority())
step_build_executable
step_build_executable() -> dict[str, Any]

Build a step that compiles the project into a single-file executable.

Runs pyinstaller --onefile against the project's entry-point module, naming the output binary via executable_name.

Returns:

Type Description
dict[str, Any]

Step that runs the executable builder via uv.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def step_build_executable(self) -> dict[str, Any]:
    """Build a step that compiles the project into a single-file executable.

    Runs `pyinstaller --onefile` against the project's entry-point
    module, naming the output binary via `executable_name`.

    Returns:
        Step that runs the executable builder via uv.
    """
    return self.step(
        self.step_build_executable,
        run=PackageManager.I.run_args(
            *ExecutableBuilder.I.build_args(
                name=self.executable_name(),
                entry_point=MainConfigFile.I.path(),
                icon=IconConfigFile.I.path(),
                collect_all_modules=self.collect_all_modules(),
                collect_data_modules=self.collect_data_modules(),
            ),
        ).multiline(),
    )
step_create_release
step_create_release() -> dict[str, Any]

Build the create-release step, attaching the built executables.

Extends the base release step by attaching every binary downloaded into dist/ as a release asset.

Returns:

Type Description
dict[str, Any]

The base create-release step with dist/* added as artifacts.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def step_create_release(self) -> dict[str, Any]:
    """Build the create-release step, attaching the built executables.

    Extends the base release step by attaching every binary downloaded into
    `dist/` as a release asset.

    Returns:
        The base create-release step with `dist/*` added as artifacts.
    """
    step = super().step_create_release()
    step["with"]["artifacts"] = (ExecutableBuilder.I.dist_dir() / "*").as_posix()
    return step
step_download_executables
step_download_executables() -> dict[str, Any]

Build a step that downloads every executable artifact into dist/.

Merges every per-OS executable artifact, matched by the artifact_name glob, into a single dist/ directory so they can be attached to the release with one glob.

Returns:

Type Description
dict[str, Any]

Step using actions/download-artifact@main.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def step_download_executables(self) -> dict[str, Any]:
    """Build a step that downloads every executable artifact into `dist/`.

    Merges every per-OS executable artifact, matched by the
    `artifact_name` glob, into a single `dist/` directory so they can be
    attached to the release with one glob.

    Returns:
        Step using `actions/download-artifact@main`.
    """
    return self.step(
        self.step_download_executables,
        uses="actions/download-artifact@main",
        with_={
            "pattern": self.artifact_name("*"),
            "path": ExecutableBuilder.I.dist_dir().as_posix(),
            "merge-multiple": "true",
        },
    )
step_upload_executable
step_upload_executable() -> dict[str, Any]

Build a step that uploads the built executable as a workflow artifact.

Uploads the contents of dist/ under the per-OS artifact_name so the publish job can later download every platform's binary.

Returns:

Type Description
dict[str, Any]

Step using actions/upload-artifact@main.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def step_upload_executable(self) -> dict[str, Any]:
    """Build a step that uploads the built executable as a workflow artifact.

    Uploads the contents of `dist/` under the per-OS `artifact_name` so
    the `publish` job can later download every platform's binary.

    Returns:
        Step using `actions/upload-artifact@main`.
    """
    return self.step(
        self.step_upload_executable,
        uses="actions/upload-artifact@main",
        with_={
            "name": self.artifact_name(self.insert_os()),
            "path": ExecutableBuilder.I.dist_dir().as_posix(),
        },
    )
steps_executable
steps_executable() -> list[dict[str, Any]]

Build the ordered steps for the executable build job.

Returns:

Type Description
list[dict[str, Any]]

Steps that set up the environment, build the single-file

list[dict[str, Any]]

executable, and upload it as a per-OS artifact.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def steps_executable(self) -> list[dict[str, Any]]:
    """Build the ordered steps for the executable build job.

    Returns:
        Steps that set up the environment, build the single-file
        executable, and upload it as a per-OS artifact.
    """
    return [
        *self.steps_core_installed_setup(),
        self.step_build_executable(),
        self.step_upload_executable(),
    ]
steps_publish
steps_publish() -> list[dict[str, Any]]

Build the ordered steps for the release job.

Inserts a step that downloads every platform's executable immediately before the create-release step, since the release must not be created before every binary is available to attach.

Returns:

Type Description
list[dict[str, Any]]

The base publish steps with the executable download step inserted

list[dict[str, Any]]

just before the create-release step.

Source code in src/pyrig_executables/rig/configs/version_control/remote/workflows/release.py
def steps_publish(self) -> list[dict[str, Any]]:
    """Build the ordered steps for the release job.

    Inserts a step that downloads every platform's executable immediately
    before the create-release step, since the release must not be
    created before every binary is available to attach.

    Returns:
        The base publish steps with the executable download step inserted
        just before the create-release step.
    """
    steps = super().steps_publish()
    create_release_id = self.step_id_from_method(self.step_create_release)
    create_release_index = next(
        index for index, step in enumerate(steps) if step["id"] == create_release_id
    )
    steps.insert(create_release_index, self.step_download_executables())
    return steps

resources

Bundled static resource files read when scaffolding executable projects.

Holds verbatim resource files that config file subclasses copy into a project that builds a standalone executable.

tools

Wrappers for the external CLI tools this plugin contributes to a project.

executables

Tool wrappers for building standalone executables.

builder

Tool wrapper for bundling the project into standalone release executables.

ExecutableBuilder

Bases: Tool

Wrapper for pyinstaller, the tool that builds standalone executables.

Exposes a project-info badge showing the cumulative download count across all GitHub release assets, linking to the releases page where the built executables are published.

build_args
build_args(
    *args: str,
    name: str,
    entry_point: Path,
    icon: Path,
    collect_all_modules: Iterable[ModuleType] = (),
    collect_data_modules: Iterable[ModuleType] = (),
) -> Args

Build the pyinstaller command that bundles a single-file executable.

Bundles each module with its own --collect-all or --collect-data flag rather than pointing --add-data at a path. This preserves the package layout so resources stay locatable at runtime through importlib.resources in both development and the frozen executable, and sidesteps the platform-specific separator --add-data requires. --collect-all also pulls in a module's submodules and any binaries it ships, so it suits modules that are not known to be pure data (e.g. an extension point where callers may pass anything); --collect-data is narrower and suits known pure-data packages, avoiding unrelated submodules/binaries. The build runs in console mode by default; pass --windowed through *args for a GUI application that should run without a console window (this instead produces a .app bundle directory on macOS).

Parameters:

Name Type Description Default
*args str

Additional arguments forwarded to pyinstaller, inserted after the resource flags and before entry_point.

()
name str

Output name for the executable (without an OS-specific extension; pyinstaller appends .exe on Windows).

required
entry_point Path

Path to the entry-point script to bundle.

required
icon Path

Path to the icon image. A non-native format (e.g. PNG) is converted to the per-OS format (.ico / .icns) at build time via Pillow; ignored on Linux.

required
collect_all_modules Iterable[ModuleType]

Modules to bundle in full (data, submodules, and binaries), one --collect-all flag per module.

()
collect_data_modules Iterable[ModuleType]

Modules whose data files only are bundled, one --collect-data flag per module.

()

Returns:

Type Description
Args

Args for the pyinstaller command.

Source code in src/pyrig_executables/rig/tools/executables/builder.py
def build_args(
    self,
    *args: str,
    name: str,
    entry_point: Path,
    icon: Path,
    collect_all_modules: Iterable[ModuleType] = (),
    collect_data_modules: Iterable[ModuleType] = (),
) -> Args:
    """Build the `pyinstaller` command that bundles a single-file executable.

    Bundles each module with its own `--collect-all` or `--collect-data`
    flag rather than pointing `--add-data` at a path. This preserves the
    package layout so resources stay locatable at runtime through
    `importlib.resources` in both development and the frozen
    executable, and sidesteps the platform-specific separator
    `--add-data` requires. `--collect-all` also pulls in a module's
    submodules and any binaries it ships, so it suits modules that are
    not known to be pure data (e.g. an extension point where callers may
    pass anything); `--collect-data` is narrower and suits known
    pure-data packages, avoiding unrelated submodules/binaries. The
    build runs in console mode by default; pass `--windowed` through
    `*args` for a GUI application that should run without a console
    window (this instead produces a `.app` bundle directory on macOS).

    Args:
        *args: Additional arguments forwarded to `pyinstaller`, inserted
            after the resource flags and before `entry_point`.
        name: Output name for the executable (without an OS-specific
            extension; `pyinstaller` appends `.exe` on Windows).
        entry_point: Path to the entry-point script to bundle.
        icon: Path to the icon image. A non-native format (e.g. PNG) is
            converted to the per-OS format (`.ico` / `.icns`) at build
            time via Pillow; ignored on Linux.
        collect_all_modules: Modules to bundle in full (data,
            submodules, and binaries), one `--collect-all` flag per
            module.
        collect_data_modules: Modules whose data files only are
            bundled, one `--collect-data` flag per module.

    Returns:
        Args for the `pyinstaller` command.
    """
    collect_all = (
        f"--collect-all={module.__name__}" for module in collect_all_modules
    )
    collect_data = (
        f"--collect-data={module.__name__}" for module in collect_data_modules
    )
    return self.args(
        "--onefile",
        f"--name={name}",
        f"--icon={icon.as_posix()}",
        *collect_all,
        *collect_data,
        *args,
        entry_point.as_posix(),
    )
dev_dependencies
dev_dependencies() -> tuple[str, ...]

Return the dev dependencies required to build executables.

Extends the default with pillow so pyinstaller can convert a non-native icon image (e.g. PNG) into the per-OS icon format (.ico / .icns) at build time.

Returns:

Type Description
tuple[str, ...]

pyinstaller and pillow.

Source code in src/pyrig_executables/rig/tools/executables/builder.py
def dev_dependencies(self) -> tuple[str, ...]:
    """Return the dev dependencies required to build executables.

    Extends the default with `pillow` so `pyinstaller` can convert a
    non-native icon image (e.g. PNG) into the per-OS icon format (`.ico`
    / `.icns`) at build time.

    Returns:
        `pyinstaller` and `pillow`.
    """
    return (*super().dev_dependencies(), "pillow")
dist_dir
dist_dir() -> Path

Return the directory pyinstaller writes built executables to.

Single source of truth for the output location, so it never drifts out of sync with other places that need it.

Returns:

Type Description
Path

The dist output directory, relative to the project root.

Source code in src/pyrig_executables/rig/tools/executables/builder.py
def dist_dir(self) -> Path:
    """Return the directory `pyinstaller` writes built executables to.

    Single source of truth for the output location, so it never drifts
    out of sync with other places that need it.

    Returns:
        The `dist` output directory, relative to the project root.
    """
    return Path("dist")
group
group() -> str

Return Group.PROJECT_INFO.

Source code in src/pyrig_executables/rig/tools/executables/builder.py
def group(self) -> str:
    """Return `Group.PROJECT_INFO`."""
    return Group.PROJECT_INFO
image_url
image_url() -> str

Return the shields.io URL for the GitHub release downloads badge.

Source code in src/pyrig_executables/rig/tools/executables/builder.py
def image_url(self) -> str:
    """Return the shields.io URL for the GitHub release downloads badge."""
    owner, repo = (
        VersionController.I.repo_owner(),
        PackageManager.I.project_name(),
    )
    return f"https://img.shields.io/github/downloads/{owner}/{repo}/total?logo=github&label=downloads"
link_url
link_url() -> str

Return the GitHub releases page URL where the binaries are published.

Source code in src/pyrig_executables/rig/tools/executables/builder.py
def link_url(self) -> str:
    """Return the GitHub releases page URL where the binaries are published."""
    return RemoteVersionController.I.releases_url()
name
name() -> str

Return 'pyinstaller'.

Source code in src/pyrig_executables/rig/tools/executables/builder.py
def name(self) -> str:
    """Return `'pyinstaller'`."""
    return "pyinstaller"
version_control_ignore_patterns
version_control_ignore_patterns() -> tuple[str, ...]

Return the build artifact paths to exclude from version control.

Returns:

Type Description
str

The pyinstaller build artifacts: the dist/ output directory,

...

the generated *.spec files, and the build/ working directory.

Source code in src/pyrig_executables/rig/tools/executables/builder.py
def version_control_ignore_patterns(self) -> tuple[str, ...]:
    """Return the build artifact paths to exclude from version control.

    Returns:
        The `pyinstaller` build artifacts: the `dist/` output directory,
        the generated `*.spec` files, and the `build/` working directory.
    """
    return (f"{self.dist_dir().as_posix()}/", "*.spec", "build/")

pyrigger

Customization of the pyrig CLI tool for projects that build executables.

Pyrigger

Bases: Pyrigger

Pyrig CLI tool wrapper that extends project initialization for this plugin.

setup_steps
setup_steps() -> tuple[tuple[Args, dict[str, Any]], ...]

Insert an extra pyrig sync step into the base initialization sequence.

A duplicate of the base pyrig sync step is inserted before the original one. We need them to run twice so that the test stubs for the generated main.py file.

Source code in src/pyrig_executables/rig/tools/pyrigger.py
def setup_steps(self) -> tuple[tuple[Args, dict[str, Any]], ...]:
    """Insert an extra `pyrig sync` step into the base initialization sequence.

    A duplicate of the base `pyrig sync` step is inserted before the original one.
    We need them to run twice so that the test stubs for the generated main.py file.
    """
    steps = list(super().setup_steps())
    sync_args = self.cmd_args(cmd=sync)
    index, sync_step = next(
        (i, (args, kwargs))
        for i, (args, kwargs) in enumerate(steps)
        if args == sync_args
    )
    steps.insert(index, sync_step)
    return tuple(steps)