Skip to content

API Reference

pyrig-resources: a pyrig plugin that scaffolds a static-resources package.

Installing this package as a dependency makes pyrig sync create a rig/resources/ package in the target project, providing a conventional home for static resource files bundled with the project.

rig

pyrig integration namespace for this plugin.

Mirrors the pyrig.rig package layout so that pyrig's cross-package subclass discovery finds this plugin's config files and tools when pyrig sync runs.

configs

Config file subclasses contributed by this plugin.

pyrig discovers the ConfigFile subclasses defined here and validates them during pyrig sync, generating or updating the corresponding files in the target project.

resources_init

Config that scaffolds a rig/resources/ package in pyrig projects.

Defines :class:ResourcesInitConfigFile, a config file subclass that pyrig discovers automatically when this plugin is installed as a dependency. Running pyrig sync then creates a rig/resources/__init__.py inside the target project, giving it a conventional home for static resource files.

ResourcesInitConfigFile

Bases: InitConfigFile

Generate the target project's rig/resources/__init__.py.

This config file is picked up by pyrig's cross-package subclass discovery when pyrig sync runs in any project that depends on this plugin. The inherited :class:~pyrig.rig.configs.base.init.InitConfigFile machinery resolves the source module's dotted name into the target project's package tree, so pyrig_resources.rig.resources maps to src/<project>/rig/resources/__init__.py. The generated file carries the docstring of the :mod:pyrig_resources.rig.resources package, marking the directory as the project's location for static resource files.

Source code in src/pyrig_resources/rig/configs/resources_init.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class ResourcesInitConfigFile(InitConfigFile):
    """Generate the target project's ``rig/resources/__init__.py``.

    This config file is picked up by pyrig's cross-package subclass discovery
    when ``pyrig sync`` runs in any project that depends on this plugin. The
    inherited :class:`~pyrig.rig.configs.base.init.InitConfigFile` machinery
    resolves the source module's dotted name into the target project's package
    tree, so ``pyrig_resources.rig.resources`` maps to
    ``src/<project>/rig/resources/__init__.py``. The generated file carries the
    docstring of the :mod:`pyrig_resources.rig.resources` package, marking the
    directory as the project's location for static resource files.
    """

    def copy_module(self) -> ModuleType:
        """Return the module whose docstring seeds the generated package.

        Returns:
            The :mod:`pyrig_resources.rig.resources` package, whose dotted name
            determines the generated file's location (``rig/resources/``) and
            whose docstring becomes the content of the generated
            ``__init__.py``.
        """
        return resources
copy_module()

Return the module whose docstring seeds the generated package.

Returns:

Name Type Description
The ModuleType

mod:pyrig_resources.rig.resources package, whose dotted name

ModuleType

determines the generated file's location (rig/resources/) and

ModuleType

whose docstring becomes the content of the generated

ModuleType

__init__.py.

Source code in src/pyrig_resources/rig/configs/resources_init.py
29
30
31
32
33
34
35
36
37
38
def copy_module(self) -> ModuleType:
    """Return the module whose docstring seeds the generated package.

    Returns:
        The :mod:`pyrig_resources.rig.resources` package, whose dotted name
        determines the generated file's location (``rig/resources/``) and
        whose docstring becomes the content of the generated
        ``__init__.py``.
    """
    return resources

resources

Static resource files for this project.