Coverage for  / home / runner / work / bijux-cli / bijux-cli / src / bijux_cli / __init__.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.2, created at 2026-01-26 17:59 +0000

1# SPDX-License-Identifier: Apache-2.0 

2# Copyright © 2025 Bijan Mousavi 

3 

4# Root package invariant: only __init__.py and py.typed live at this level. 

5 

6"""The top-level package for the Bijux CLI application. 

7 

8This module serves as the main public entry point for the `bijux-cli` package. 

9It exposes the key components required for both command-line execution and 

10programmatic integration. 

11 

12The primary exports are: 

13 * `entry_point`: The function used by `console_scripts` to start the CLI. 

14 * `BijuxAPI`: A high-level, synchronous facade for using the CLI's 

15 functionality within other Python applications. 

16 * `version` and `api_version`: The application and plugin API versions. 

17""" 

18 

19from __future__ import annotations 

20 

21from bijux_cli.api import BijuxAPI 

22from bijux_cli.core.version import api_version, version 

23 

24 

25def entry_point() -> int | None: 

26 """The primary entry point for the `console_scripts` definition. 

27 

28 This function calls the main CLI orchestrator and catches `SystemExit` 

29 exceptions to ensure a proper integer exit code is returned to the shell. 

30 

31 Returns: 

32 int | None: The integer exit code of the CLI process. 

33 """ 

34 try: 

35 return main() 

36 except SystemExit as exc: 

37 return int(exc.code or 0) 

38 

39 

40def main() -> int: 

41 """Lazily import and run the CLI entrypoint.""" 

42 from bijux_cli.core.bootstrap import main as _main 

43 

44 return _main() 

45 

46 

47__all__ = ["version", "api_version", "BijuxAPI", "entry_point", "main"]