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 |
Publish a custom CLI command
Section titled “Publish a custom CLI command”A package can expose its own command name and delegate to Bub’s CLI entrypoint, letting you brand the agent or pin default behavior:
import osfrom pathlib import Pathfrom 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:
[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.
Bundle plugins and skills together
Section titled “Bundle plugins and skills together”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
Configure pyproject.toml
Section titled “Configure 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:
- Depend on
bub[app]: the basebubpackage installs only the core kernel; the CLI, plugins, and skill loader requirebub[app](see the 0.6.0 upgrade guide). - Use the
"bub"entry-point group: register plugins under[project.entry-points."bub"](see entry-point forms). - Include
"src/skills": list"src/skills"inpackagesunder[tool.hatch.build.targets.wheel].
Build and install
Section titled “Build and install”Build the wheel and sdist with uv:
uv buildArtifacts are written to dist/. Users can install your package in two ways:
- As a standalone CLI tool:
uv tool install my-bub - As a managed Bub plugin:
bub install <package>
Verify before release
Section titled “Verify before release”Before publishing publicly or rolling out to production, test the built .whl file in a clean virtual environment:
-
Create a clean virtual environment and install the wheel:
Terminal window uv venv .test-env && source .test-env/bin/activateuv pip install dist/*.whl -
Verify plugin registration:
Terminal window my-bub hooksConfirm your plugin identifier appears without import errors.
-
Verify skill discovery:
Terminal window my-bub run ",skill"my-bub run ",skill name=repo-reviewer"Confirm bundled skills are listed and expand properly.
-
Verify chat and tools:
Terminal window my-bub run "Test model and custom tool calls"my-bub chat