Coverage for src / template_python / __main__.py: 0%

13 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-14 20:19 +0000

1""" 

2Main entrypoint for the template_python package. 

3 

4This module provides the executable routine when the package is run directly 

5via the command line (e.g., ``python -m template_python``). It initializes the logger 

6and settings, outputting the current version and configuration to verify 

7the installation and environment setup. 

8""" 

9 

10from __future__ import annotations 

11 

12import click 

13 

14from template_python import ( 

15 LoggingSettings, 

16 Settings, 

17 __version__, 

18 configure_logger, 

19 logger, 

20) 

21 

22__all__ = ["main"] 

23 

24 

25@click.command(context_settings={"help_option_names": ["-h", "--help"]}) 

26@click.version_option(version=__version__, prog_name="template-python") 

27def main() -> None: 

28 """ 

29 Execute the main routine. 

30 

31 Initializes application settings and logging, demonstrating the basic startup 

32 flow of the application. It logs the current version and the loaded configuration 

33 settings. 

34 

35 Example: 

36 .. code-block:: python 

37 

38 from template_python.__main__ import main 

39 

40 main() 

41 """ 

42 configure_logger( 

43 LoggingSettings( 

44 enabled=True, 

45 level="INFO", 

46 clear_loggers=True, 

47 filter=("template_python", "__main__"), 

48 ) 

49 ) 

50 logger.info("Hello from template-python v{}!", __version__) 

51 settings = Settings() 

52 logger.info("Settings: {}", settings) 

53 

54 

55if __name__ == "__main__": 

56 main()