Coverage for src/pip_project_template/cli/info.py: 100.00%

37 statements  

« prev     ^ index     » next       coverage.py v7.9.2, created at 2025-08-28 08:53 +1000

1#!/usr/bin/env python3 

2# -*- coding: utf-8 -*- 

3# Timestamp: "2025-08-27 01:10:31 (ywatanabe)" 

4# File: /home/ywatanabe/proj/pip-project-template/src/cli/info.py 

5# ---------------------------------------- 

6from __future__ import annotations 

7import os 

8__FILE__ = ( 

9 "./pip-project-template/src/cli/_info.py" 

10) 

11__DIR__ = os.path.dirname(__FILE__) 

12# ---------------------------------------- 

13"""Info command.""" 

14 

15import argparse 

16 

17 

18def create_parser(): 

19 """Create parser for info command.""" 

20 parser = argparse.ArgumentParser(description="Show system information") 

21 return parser 

22 

23 

24def main(args=None): 

25 """Execute info command.""" 

26 import sys 

27 import os 

28 

29 # Get version from package __init__.py  

30 package_init = os.path.join(os.path.dirname(os.path.dirname(__file__)), '__init__.py') 

31 version = "0.1.0" # default 

32 try: 

33 with open(package_init) as f: 

34 for line in f: 

35 if line.startswith('__version__'): 

36 version = line.split('"')[1] 

37 break 

38 except Exception: 

39 pass 

40 

41 print("Pip Project Template - FastMCP Edition") 

42 print("=" * 40) 

43 print(f"Version: {version}") 

44 print("Framework: FastMCP 2.0") 

45 print("Commands: calculate, serve01, serve02, info") 

46 print() 

47 print("MCP Servers:") 

48 print(" serve01: Basic FastMCP server with calculator tools") 

49 print(" serve02: Enhanced FastMCP server with batch processing") 

50 print() 

51 print("Transport Options: stdio, http, sse") 

52 return 0 

53 

54if __name__ == "__main__": 

55 import sys 

56 sys.exit(main()) 

57 

58# EOF