Skip to content

Packaging and distribution

When you build custom tools, channel plugins, or workflow-specific skills on top of Bub—or want to ship a branded CLI of your own—you can package them as a standard Python wheel and publish them to PyPI or a private index for your team and users to install.

Common distribution patterns:

Pattern Contents Use case
Extension package Plugin entry point + skills directory Add tools, channels, or skills to an existing Bub install
Custom CLI Custom script entry point (e.g. my-bub) Ship a branded command name or pin a default workspace
All-in-one package Custom CLI + plugins + skills Deliver a ready-to-run domain-specific agent in one package

A package can expose its own command name and delegate to Bub’s CLI entrypoint, letting you brand the agent or pin default behavior:

src/my_bub/cli.py
import os
from pathlib import Path
from bub.__main__ import main as bub_main
def main() -> None:
# Optional: set a default workspace (overridable via --workspace)
if workspace := os.getenv("MY_BUB_WORKSPACE"):
os.chdir(Path(workspace).expanduser())
bub_main()

Declare the script in pyproject.toml:

pyproject.toml
[project.scripts]
my-bub = "my_bub.cli:main"

Once installed, users can run my-bub chat, my-bub run, and my-bub gateway directly, with all native subcommands and flags like --workspace intact.

A single wheel can bundle a custom CLI command, plugin entry points, and a skills namespace package:

  • Directorymy-bub/
    • pyproject.toml
    • Directorysrc/
      • Directorymy_bub/
        • __init__.py
        • cli.py # Custom CLI entrypoint
        • plugin.py # Plugin and hook implementations
        • tools.py # Custom tools
      • Directoryskills/ # Skill namespace package (do NOT add __init__.py)
        • Directoryrepo-reviewer/
          • SKILL.md
          • Directoryreferences/
            • guidelines.md
pyproject.toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "my-bub"
version = "0.1.0"
description = "My Custom Bub Agent Distribution"
requires-python = ">=3.12"
dependencies = [
"bub[app]>=0.6.0",
]
[project.scripts]
my-bub = "my_bub.cli:main"
[project.entry-points."bub"]
my_plugin = "my_bub.plugin:plugin"
[tool.hatch.build.targets.wheel]
packages = ["src/my_bub", "src/skills"]

Key settings:

  1. Depend on bub[app]: the base bub package installs only the core kernel; the CLI, plugins, and skill loader require bub[app] (see the 0.6.0 upgrade guide).
  2. Use the "bub" entry-point group: register plugins under [project.entry-points."bub"] (see entry-point forms).
  3. Include "src/skills": list "src/skills" in packages under [tool.hatch.build.targets.wheel].

Build the wheel and sdist with uv:

Terminal window
uv build

Artifacts are written to dist/. Users can install your package in two ways:

Before publishing publicly or rolling out to production, test the built .whl file in a clean virtual environment:

  1. Create a clean virtual environment and install the wheel:

    Terminal window
    uv venv .test-env && source .test-env/bin/activate
    uv pip install dist/*.whl
  2. Verify plugin registration:

    Terminal window
    my-bub hooks

    Confirm your plugin identifier appears without import errors.

  3. Verify skill discovery:

    Terminal window
    my-bub run ",skill"
    my-bub run ",skill name=repo-reviewer"

    Confirm bundled skills are listed and expand properly.

  4. Verify chat and tools:

    Terminal window
    my-bub run "Test model and custom tool calls"
    my-bub chat