Coverage for src/docs.py: 42%

12 statements  

« prev     ^ index     » next       coverage.py v7.3.0, created at 2024-12-21 12:23 +0000

1import logging 

2import pathlib 

3 

4import pdoc 

5 

6 

7logger = logging.getLogger('blog') 

8 

9 

10def write_api_docs() -> int: 

11 """ 

12 Generate the website API documentation. 

13 

14 Returns the total number of generated files so you have something 

15 interesting to log. 

16 

17 >>> logger.info('wrote docs - %d file(s)', write_api_docs()) 

18 """ 

19 

20 output_directory = pathlib.Path('./www/api/') 

21 

22 pdoc.pdoc('src', output_directory=output_directory) 

23 

24 results = output_directory.glob('**/*') 

25 results = filter(lambda p: p.is_file(), results) 

26 results = filter(lambda p: not p.name.startswith('.'), results) 

27 results = list(results) 

28 return len(results)