Coverage for webapp/llms.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.16.1, created at 2026-09-25 22:10 +0000

1""" 

2llms.txt, llms-full.txt and the Markdown version of every page 

3""" 

4 

5from canonicalwebteam.store_llm import StoreLLM 

6 

7BASE_URL = "https://snapcraft.io" 

8 

9SUMMARY = ( 

10 "Snapcraft is the home of the Snap Store, where thousands of snaps - " 

11 "containerised software packages that install and run across Linux " 

12 "distributions - are published and browsed. Publishers use " 

13 "snapcraft.io to register names, build, release, and manage their " 

14 "snaps." 

15) 

16 

17# Sections are keyed by the first segment of the path. A new page under 

18# a known area files itself. 

19SECTIONS = { 

20 "": "Main pages", 

21 "about": "Publishing a snap", 

22 "account": "Publishing a snap", 

23 "docs": "Documentation", 

24 "tutorials": "Documentation", 

25 "store": "Store", 

26 "blog": "Blog", 

27} 

28 

29SECTION_ORDER = [ 

30 "Main pages", 

31 "Publishing a snap", 

32 "Documentation", 

33 "Store", 

34 "Blog", 

35] 

36 

37# Links that cannot be discovered: pages rendered by an imported view 

38# whose template is chosen at runtime and resources hosted elsewhere. 

39EXTRA_LINKS = [ 

40 { 

41 "section": "Documentation", 

42 "url": BASE_URL + "/docs/", 

43 "title": "Snap documentation", 

44 "description": ( 

45 "Reference and explanation for snaps and snapd: confinement, " 

46 "interfaces, channels, and the daemon." 

47 ), 

48 }, 

49 { 

50 "section": "Optional", 

51 "url": BASE_URL + "/llms-full.txt", 

52 "title": "Every page in one file", 

53 "description": ( 

54 "The pages above concatenated as Markdown, for reading in " 

55 "one request rather than following each link." 

56 ), 

57 }, 

58 { 

59 "section": "Optional", 

60 "url": BASE_URL + "/store/sitemap.xml", 

61 "title": "Snap sitemap", 

62 "description": ( 

63 "Every snap page on the store. Large - for exhaustive " 

64 "crawling rather than reading." 

65 ), 

66 }, 

67 { 

68 "section": "Documentation", 

69 "url": "https://documentation.ubuntu.com/snapcraft/stable/", 

70 "title": "Snapcraft documentation", 

71 "description": ( 

72 "The build tool: snapcraft.yaml reference, plugins, bases, " 

73 "and how-to guides for packaging software." 

74 ), 

75 }, 

76] 

77 

78store_llm = StoreLLM( 

79 base_url=BASE_URL, 

80 site_name="Snapcraft", 

81 summary=SUMMARY, 

82 sections=SECTIONS, 

83 section_order=SECTION_ORDER, 

84 extra_links=EXTRA_LINKS, 

85)