1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[py310]= Template Text Parser (3.10)
8 SDESC[v11]= Template Text Parser (3.11)
9 HOMEPAGE= https://github.com/dmulyalin/ttp
10 CONTACT= Python_Automaton[python@ironwolf.systems]
13 SITES[main]= PYPIWHL/0c/1c/256f6491e644468225e5618cda8ef74b9dbf007d5c5692128ac2c5c64940
14 DISTFILE[1]= ttp-0.9.4-py2.py3-none-any.whl:main
19 OPTIONS_AVAILABLE= PY310 PY311
20 OPTIONS_STANDARD= none
21 VOPTS[py310]= PY310=ON PY311=OFF
22 VOPTS[v11]= PY310=OFF PY311=ON
24 DISTNAME= ttp-0.9.4.dist-info
28 [PY310].USES_ON= python:py310,wheel
30 [PY311].USES_ON= python:v11,wheel
32 [FILE:2346:descriptions/desc.single]
35 [Documentation status]
37 # Template Text Parser
39 TTP is a Python library for semi-structured text parsing using templates.
43 To save ones time on transforming raw text into structured data and beyond.
47 Regexes, regexes everywhere... but, dynamically formed out of TTP templates
48 with added capabilities to simplify the process of getting desired
53 In essence TTP can help to:
54 - Prepare, sort and load text data for parsing
55 - Parse text using regexes dynamically derived out of templates
56 - Process matches on the fly using broad set of built-in or custom
58 - Combine match results in a structure with arbitrary hierarchy
59 - Transform results in desired format to ease consumption by humans or
61 - Return results to various destinations for storage or further
64 Reference [documentation] for more information.
66 TTP [Networktocode Slack channel]
68 Collection of [TTP Templates]
70 ## Example - as simple as it can be
72 Simple interfaces configuration parsing example
74 <details><summary>Code</summary>
82 description Router-id-loopback
83 ip address 192.168.0.113/24
86 description CPE_Acces_Vlan
87 ip address 2002::fd37/124
93 interface {{ interface }}
94 ip address {{ ip }}/{{ mask }}
95 description {{ description }}
99 parser = ttp(data, template)
101 pprint.pprint(parser.result(), width=100)
104 # [[[{'description': 'Router-id-loopback',
105 # 'interface': 'Loopback0',
106 # 'ip': '192.168.0.113',
108 # {'description': 'CPE_Acces_Vlan',
109 # 'interface': 'Vlan778',
110 # 'ip': '2002::fd37',
116 ## Example - a bit more complicated
118 For this example lets say we want to parse BGP peerings output, but combine
119 state with configuration data, at the end we want to get pretty looking
120 text table printed to screen.
122 <details><summary>Code</summary>
127 This template first parses "show bgp vrf CUST-1 vpnv4 unicast summary"
129 output, forming results for "bgp_state" dictionary, where peer ip is a key.
131 Following that, "show run | section bgp" output parsed by group "bgp_cfg".
136 550e26fd742703f9fd0fac09e3701766190d4551978fccdead294d49cdec2423 85592 ttp-0.9.4-py2.py3-none-any.whl