Report generation system for pipen
pip install -U pipen-report
from pipen import Proc, Pipen
class Figure(Proc):
"""Generate figures"""
input_keys = ['a:var']
input = [1,2,3]
output = 'outfile:file:{{in.a}}.jpg'
script = '''\
wget https://picsum.photos/200/300 -O {{out.outfile}}
'''
plugin_opts = 'Figure.svx'
class Table(Figure):
"""Generate tables"""
output = 'outfile:file:{{in.a}}.txt'
script = '''\
#!/usr/bin/env python
outfile = "{{out.outfile}}"
with open(outfile, 'w') as fout:
fout.write("""\\
id first_name last_name email gender ip_address
1 Lynda Scirman [email protected] Female 22.123.155.57
2 Moll Niset [email protected] Female 6.154.75.63
3 Jory Mewitt [email protected] Male 233.225.101.101
4 Dukie Onslow [email protected] Male 238.209.40.250
5 Carlee Grasha [email protected] Female 22.65.237.2
6 Leanora Doughtery [email protected] Female 54.41.211.142
7 Winona Levison [email protected] Female 15.186.215.132
8 Orrin Baldick [email protected] Male 221.49.10.188
9 Ingmar Papez [email protected] Male 225.88.240.74
10 Arlena Compford [email protected] Female 49.30.204.242
11 Domenico Lorinez [email protected] Male 106.63.35.124
12 Yul Bonifas [email protected] Male 198.152.245.214
13 Tony Antonignetti [email protected] Male 61.64.103.108
14 Bayard Gilhooley [email protected] Male 124.48.176.234
15 Hillary Ashbee [email protected] Female 111.91.131.252
16 Cherye Spuffard [email protected] Female 206.113.100.79
17 Dorey Lorraway [email protected] Female 179.210.96.234
18 Iolande McKilroe [email protected] Female 92.62.191.79
19 Ermina Woodroofe [email protected] Female 193.75.48.192
20 Quill Skoggins [email protected] Male 157.11.232.242
""")
'''
plugin_opts = 'Table.svx'
Pipen('Test pipeline',
'Just for pipen-report testing').starts([Figure, Table]).run()
Figure.svx
# Generated Figures
{% for job in jobs %}
## This is a very long heading for figure {{job.index}}
![Figure{{job.index}}]({{job.out.outfile}})
{% endfor %}
# Another very very veryvery veryvery very long heading at level 1
## Short one
### Third level
## Very very very very very very very long one
## Another short one
Table.svx
<script>
import { DataTable } from "pipen-smelte";
</script>
# Heading 1
## SubHeading 2
<DataTable
data="{{ job.out.outfile | @report.datatable: delimiter='\t' }}"
datafile="{{ job.out.outfile }}"
/>
## SubHeading 3
<DataTable
data="{{ jobs[1].out.outfile | @report.datatable: delimiter='\t', cols=['id', 'first_name', 'last_name'], rows=10 }}"
datafile="{{ jobs[1].out.outfile }}"
/>
See here for the reports.