Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

CalyxLib-Python

Alternative MCDReforged API for MCDR plugins that requires running in other environments

Introduction

The core of CalyxLib is BlossomBaseInterface, you need to inherit it and create an instance to use a lot of feature of CalyxLib. In MCDReforged, use its subclass BlossomMCDRInterface instead.

Config

Config Serialization & Comment

  • CommentedModel / ConfigComment

Subclass of pydantic.BaseModel. Attach comments to YAML file by simply annotate fields from these models with Annotated[..., ConfigComment(...)]

  • BlossomBaseInterface.load_config() & BlossomBaseInterface.save_config()

These 2 methods can load & save the pydantic.BaseModel / CommentedModel from/into the YAML file. Add header or footer with CommentContext. Pass the CommentContext instance to these 2 methods to add header and footer.

  • InGameConfigItemMark

Add this in the annotation Annotated type to mark a field that this item is available to be configured in game, and you can configure how this item info displayed ingame here.

Usage: Annotated[..., InGameConfigItem(...)]

  • ConfigKeyNode

Subclass of mcdreforged.api.command.QuotableText

Automatically check the item that annotated with InGameConfigItemMark

All the config API Basic usage:

from calyx_lib.config import CommentedModel, InGameConfigMark, ConfigKeyNode, ConfigComment, ConfigComment

def get_ingame_mark(value_suggester: Union[
        Callable[["BlossomBaseInterface", List[str], "FieldInfo"], Iterable[Any]],
        Callable[["BlossomBaseInterface", List[str]], Iterable[Any]],
        Callable[["BlossomBaseInterface"], Iterable[Any]],
        Callable[[], Iterable[Any]],
    ], max_amount: int = 3):
    return InGameConfigItemMark(
        item_display_name_getter=lambda cbi, keys: cbi.rtr(
            f'calyx_lib_example_plugin.config.{".".join(keys)}.title'
        ) + ' ({})'.format('.'.join(keys)),
        item_description_getter=lambda cbi, keys: cbi.rtr(
            f'calyx_lib_example_plugin.config.{".".join(keys)}.desc'
        ),
        value_suggester=value_suggester,
        suggested_values_max_amount=max_amount,
    )


universal_comment = ConfigComment(
    text_getter=lambda cbi, keys: cbi.rtr(f"calyx_lib_example_plugin.config.{'.'.join(keys)}.desc")
)

# TODO: Serialize into visual strings for ingame
force_string = PlainSerializer(lambda v: str(v))


class Config(CommentedModel):
    prefixes: Annotated[Union[str, List[str]], get_ingame_mark(lambda: []), universal_comment, force_string] = "!!clep"
    permission: Annotated[int, get_ingame_mark(lambda: [0, 1, 2, 3, 4], 5), universal_comment, force_string] = 4
    default_page_size: Annotated[Blankable[int], get_ingame_mark(lambda: [10, 15, 20]), universal_comment, force_string] = BLANK
    verbose: Optional[bool] = None

CONFIG_FILE = 'config.yml'

class AnyPlugin(BlossomMCDRInterface):
    def __init__():
        super().__init__()
        self.config = self.load_config(CONFIG_FILE, Config)

    def on_load(server: PluginServerInterface, prev_module):
        self.server.register_command(
            Literal('!!any_command').then(
                ConfigKeyNode('config_key').bind_default_methods(self, CONFIG_FILE)
            )
        )

Metadata

Release files for calyx-lib 0.1.0a6

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

Source distribution (sdist)

Source distribution for calyx-lib 0.1.0a6
File Size Uploaded
calyx_lib-0.1.0a6.tar.gz 83.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for calyx-lib 0.1.0a6
File Interpreter ABI Platform
calyx_lib-0.1.0a6-py3-none-any.whl Python 3 none any Details

Total release size: 138.2 kB

Release files / calyx_lib-0.1.0a6.tar.gz

Download URL calyx_lib-0.1.0a6.tar.gz
Size 83.8 kB
Tags Source
SHA-256 checksum
How to use checksums
307859fe6ccf99855303febb0f6f2ad956c5190c1cafbeee8c7867f34896b635
BLAKE2b-256 checksum
How to use checksums
8b4215e3a4ff74840488bed7cb139ef6681663e0531c5545501ce53dd73e2511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / calyx_lib-0.1.0a6-py3-none-any.whl

Download URL calyx_lib-0.1.0a6-py3-none-any.whl
Size 54.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7dad97f43045d3af6d3df370a1aa1f8b30d46d9a160e63c83e34798d70c63b24
BLAKE2b-256 checksum
How to use checksums
506983c4f894936f9cb9ebb365b436a235597e3abc612ee463babe1e449b35f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log
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