whool - Odoo Addon Build Backend
whool is a build backend for Odoo addons, allowing them to be packaged and distributed as standard Python wheels and sdists. It leverages `pyproject.toml` for configuration and integrates with standard build tools like `pip` and `build`. The current version is 1.3, with releases occurring every few months to add features and improve compliance.
Common errors
-
whool: command not found
cause `whool` is not installed or not in your system's PATH.fixEnsure `whool` is installed: `pip install whool`. If installed in a virtual environment, activate it or use `python -m whool`. -
Error: "dependencies" command has been removed
cause You are using a `whool` version (0.3 or newer) that no longer supports the `dependencies` command, but your script or workflow is still trying to use it.fixRemove calls to `whool dependencies` from your scripts. For listing dependencies, consider using other tools like `pyproject-dependencies`. -
No such file or directory: 'pyproject.toml'
cause `whool` requires a `pyproject.toml` file in the project root to configure the build process, which is typically generated by `whool init`.fixRun `whool init` in your project directory to generate the necessary `pyproject.toml` file.
Warnings
- breaking The `dependencies` command was removed in v0.3, and `whool` stopped using internal `wheel` APIs. Code or scripts relying on this command or custom integrations with old `wheel` APIs will break.
- gotcha Wheel and sdist names are normalized for better standard compliance, especially for addon names containing uppercase letters. This might subtly change output filenames for existing projects.
- gotcha When the `git` command is not available, `whool` copies all files to the distribution, potentially including unwanted files not covered by `.gitignore` rules, instead of relying on `git` for file selection. This can lead to larger or incorrect distributions.
Install
-
pip install whool
Quickstart
# Create a dummy Odoo addon structure
mkdir my_odoo_addon
cd my_odoo_addon
# Create a minimal Odoo __manifest__.py (required by Odoo)
with open("__init__.py", "w") as f:
f.write("__manifest__ = {'name': 'My Test Addon', 'version': '1.0.0', 'installable': True}")
mkdir models
with open("models/__init__.py", "w") as f:
f.write("")
# Initialize whool configuration (generates pyproject.toml)
import subprocess
subprocess.run(["whool", "init"], check=True)
# Build the package (sdist and wheel)
subprocess.run(["python", "-m", "build"], check=True)
print("\nSuccessfully built package in 'dist/' directory:")
import os
print(os.listdir('dist'))