Builders
The builders module contains the structured command builders used by
OdooOperations and ProcessManager.
New builder pattern implementation for command construction. Provides proper separation of concerns and fluent interfaces.
- class oduit.builders.CommandOperation(command: list[str], operation_type: str, database: str | None = None, modules: list[str] = <factory>, test_tags: str | None = None, extra_args: list[str] = <factory>, is_odoo_command: bool = True, expected_result_fields: dict[str, ~typing.Any] = <factory>, result_parsers: list[str] = <factory>)[source]
Bases:
objectStructured command operation containing both command and metadata.
- __init__(command: list[str], operation_type: str, database: str | None = None, modules: list[str] = <factory>, test_tags: str | None = None, extra_args: list[str] = <factory>, is_odoo_command: bool = True, expected_result_fields: dict[str, ~typing.Any] = <factory>, result_parsers: list[str] = <factory>) None
- class oduit.builders.AbstractCommandBuilder(config_provider: ConfigProvider)[source]
Bases:
ABCAbstract base class for command builders following the Builder pattern
- abstractmethod build_operation() CommandOperation[source]
Build and return a structured CommandOperation with metadata
- class oduit.builders.BaseOdooCommandBuilder(config_provider: ConfigProvider)[source]
Bases:
AbstractCommandBuilderBase Odoo command builder with common functionality
- disable_http() BaseOdooCommandBuilder[source]
Disable all HTTP-related options and enable –no-http.
- database(db_name: str) BaseOdooCommandBuilder[source]
Set database name
- addons_path(path: str) BaseOdooCommandBuilder[source]
Set addons path
- load(modules: str) BaseOdooCommandBuilder[source]
Set list of server-wide modules to load.
- log_level(level: str) BaseOdooCommandBuilder[source]
Set log level (info, warn, error, debug)
- log_handler(handler: str) BaseOdooCommandBuilder[source]
Set LOGGER:LEVEL, enables LOGGER at the provided LEVEL
- log_web(enabled: bool = True) BaseOdooCommandBuilder[source]
enables DEBUG logging of HTTP requests and responses
- log_sql(enabled: bool = True) BaseOdooCommandBuilder[source]
enables DEBUG logging of SQL querying
- syslog(enabled: bool = True) BaseOdooCommandBuilder[source]
Enable: logs to the system’s event logger
- db_maxconn(maxconn: int) BaseOdooCommandBuilder[source]
Set maximum number of database connections
- db_maxconn_gevent(maxconn: int) BaseOdooCommandBuilder[source]
Set maximum number of database connections
- db_user(user: str) BaseOdooCommandBuilder[source]
Set database user
- db_password(password: str) BaseOdooCommandBuilder[source]
Set database password
- db_host(hostname: str) BaseOdooCommandBuilder[source]
Set database host
- db_filter(filter: str) BaseOdooCommandBuilder[source]
Set database filter
- db_template(template: str) BaseOdooCommandBuilder[source]
Set database template
- http_port(port: int) BaseOdooCommandBuilder[source]
Set HTTP port
- gevent_port(port: int) BaseOdooCommandBuilder[source]
Set GEVENT port
- workers(workers: int) BaseOdooCommandBuilder[source]
Set workers
- limit_request(limit: int) BaseOdooCommandBuilder[source]
Set limit-request
- limit_memory_soft(limit: int) BaseOdooCommandBuilder[source]
Set limit-memory-soft
- limit_memory_hard(limit: int) BaseOdooCommandBuilder[source]
Set limit-memory-hard
- limit_time_cpu(limit: int) BaseOdooCommandBuilder[source]
Set limit-time-cpu
- limit_time_real(limit: int) BaseOdooCommandBuilder[source]
Set limit-time-real
- max_cron_threads(threads: int) BaseOdooCommandBuilder[source]
Set max-cron-threads
- limit_time_worker_cron(limit: int) BaseOdooCommandBuilder[source]
Set limit-time-worker-cron
- http_interface(interface: str) BaseOdooCommandBuilder[source]
Set http interface
- data_dir(path: str) BaseOdooCommandBuilder[source]
Set data directory
- config_file(path: str) BaseOdooCommandBuilder[source]
Set config file path
- dev(features: str = 'all') BaseOdooCommandBuilder[source]
Enable dev mode with specified features
- load_language(languages: str) BaseOdooCommandBuilder[source]
specifies the languages (separated by commas) for the translations
- language(language: str) BaseOdooCommandBuilder[source]
Set the language of the translation file use it with i18n-export or i18n-import
- i18n_export(filename: str) BaseOdooCommandBuilder[source]
Set i18n export filename
- i18n_import(filename: str) BaseOdooCommandBuilder[source]
Set i18n import filename
- i18n_overwrite(enabled: bool = True) BaseOdooCommandBuilder[source]
Enable i18n overwrite
- modules(modules: str) BaseOdooCommandBuilder[source]
Set list of modules to export
- no_http(enabled: bool = True) BaseOdooCommandBuilder[source]
Disable HTTP server
- proxy_mode(enabled: bool = True) BaseOdooCommandBuilder[source]
Enables HTTP proxy
- stop_after_init(enabled: bool = True) BaseOdooCommandBuilder[source]
Stop after module initialization
- install_module(module: str) BaseOdooCommandBuilder[source]
Install a module
- update_module(module: str) BaseOdooCommandBuilder[source]
Update a module
- shell_interface(interface: str) BaseOdooCommandBuilder[source]
Set shell interface (ipython, ptpython, bpython, python)
- without_demo(modules: str) BaseOdooCommandBuilder[source]
Disable demo data for specified modules
- with_demo(enabled: bool = True) BaseOdooCommandBuilder[source]
Install module with demo data
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.RunCommandBuilder(config_provider: ConfigProvider)[source]
Bases:
BaseOdooCommandBuilderSpecialized builder for run commands
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.OdooTestCoverageCommandBuilder(config_provider: ConfigProvider, module: str)[source]
Bases:
BaseOdooCommandBuilderSpecialized builder for test commands with coverage
- test_module(module: str, install: bool = False) OdooTestCoverageCommandBuilder[source]
Configure module testing
- test_file(file_path: str) OdooTestCoverageCommandBuilder[source]
Set specific test file
- test_tags(tags: str) OdooTestCoverageCommandBuilder[source]
Set test tags filter
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.OdooTestCommandBuilder(config_provider: ConfigProvider)[source]
Bases:
BaseOdooCommandBuilderSpecialized builder for test commands
- test_module(module: str, install: bool = False) OdooTestCommandBuilder[source]
Configure module testing
- test_file(file_path: str) OdooTestCommandBuilder[source]
Set specific test file
- test_tags(tags: str) OdooTestCommandBuilder[source]
Set test tags filter
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.ShellCommandBuilder(config_provider: ConfigProvider)[source]
Bases:
BaseOdooCommandBuilderSpecialized builder for shell commands
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.UpdateCommandBuilder(config_provider: ConfigProvider, module: str)[source]
Bases:
BaseOdooCommandBuilderSpecialized builder for update commands
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.InstallCommandBuilder(config_provider: ConfigProvider, module: str)[source]
Bases:
BaseOdooCommandBuilderSpecialized builder for install commands
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.LanguageCommandBuilder(config_provider: ConfigProvider, module: str, filename: str, language: str)[source]
Bases:
BaseOdooCommandBuilderSpecialized builder for language export commands
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.VersionCommandBuilder(config_provider: ConfigProvider)[source]
Bases:
BaseOdooCommandBuilderSpecialized builder for version command
- build_operation() CommandOperation[source]
Build a CommandOperation with base metadata. Subclasses should override.
- class oduit.builders.DatabaseCommandBuilder(config_provider: ConfigProvider, with_sudo: bool = True)[source]
Bases:
AbstractCommandBuilderBuilder for database-related commands
- drop_command() DatabaseCommandBuilder[source]
Build database drop command
- create_role_command(db_user: str | None = None) DatabaseCommandBuilder[source]
Build database create role command
- create_extension_command(extension: str) DatabaseCommandBuilder[source]
Build database create role command
- alter_role_command(db_user: str | None = None) DatabaseCommandBuilder[source]
Build database alter role command to add login and createdb privileges
- create_command(db_user: str | None = None) DatabaseCommandBuilder[source]
Build database create command
- legacy_init_base_command(*, with_demo: bool = False, without_demo: bool = False, language: str | None = None) DatabaseCommandBuilder[source]
Build legacy-compatible Odoo server init command for base installation.
- native_db_init_command(*, with_demo: bool = False, without_demo: bool = False, country: str | None = None, language: str | None = None, username: str = 'admin', password: str = 'admin', force: bool = False) DatabaseCommandBuilder[source]
Build native Odoo 19+ db init command.
- init_command(*, with_demo: bool = False, without_demo: bool = False, country: str | None = None, language: str | None = None) DatabaseCommandBuilder[source]
Backward-compatible wrapper for legacy base initialization.
- list_db_command(db_user: str | None = None) DatabaseCommandBuilder[source]
Build database list command
- exists_db_command(db_user: str | None = None) DatabaseCommandBuilder[source]
Build database exists check command
- build_operation() CommandOperation[source]
Build and return a structured CommandOperation with metadata
Usage Examples
from oduit import ConfigLoader, ProcessManager
from oduit.builders import InstallCommandBuilder, OdooTestCommandBuilder
loader = ConfigLoader()
config = loader.load_config("dev")
manager = ProcessManager()
install_operation = InstallCommandBuilder(config, "sale").build_operation()
install_result = manager.run_operation(install_operation, verbose=True)
test_operation = OdooTestCommandBuilder(config).test_tags("/sale").build_operation()
test_result = manager.run_operation(test_operation)
Key Concepts
build()returns a plain command list for compatibilitybuild_operation()returns a structuredCommandOperationthe structured form carries metadata such as operation type, modules, and parser hints for downstream result processing