okreport: simple report automatic rendering
Installation
pip install python-okreport
Usage
from jinja2 import Template
from okreport import Var, Paragraph, Report
class ResultX(Var):
def parse(self, result, conf, env): # noqa
return result['x']
class ResultY(Var):
def parse(self, result, conf, env): # noqa
return result['y']
class ResultSum(Var):
def parse(self, result, conf, env): # noqa
return result['x'] + result['y']
class ConfX(Var):
def parse(self, result, conf, env): # noqa
return conf['x']
class ConfY(Var):
def parse(self, result, conf, env): # noqa
return conf['y']
class ConfSum(Var):
def parse(self, result, conf, env): # noqa
return conf['x'] + conf['y']
class ResultParagraph(Paragraph):
x = ResultX()
y = ResultY()
sum = ResultSum()
class ConfParagraph(Paragraph):
x = ConfX()
y = ConfY()
sum = ConfSum()
class MyReport(Report):
"""
In result, x = {{ p1.x }}, y = {{ p1.y }}, sum = {{ p1.sum }}.
In conf, x = {{ p2.x }}, y = {{ p2.y }}, sum = {{ p2.sum }}.
"""
p1 = ResultParagraph()
p2 = ConfParagraph()
def get_template(self):
return Template(self.__doc__)
result = {'x': 1, 'y': 2}
conf = {'x': 3, 'y': 4}
my_report = MyReport()
text = my_report.render(result, conf, None)
print(text)
Metadata
Release files for python-okreport 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-okreport-1.1.0.tar.gz | 3.2 kB | Without provenance | Details for python-okreport-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_okreport-1.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for python_okreport-1.1.0-py2.py3-none-any.whl |
Total release size: 5.7 kB
Release files / python-okreport-1.1.0.tar.gz
| Download URL | python-okreport-1.1.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c705e5f00afb075f48dd90f089f35adbc464c1e8dede27469be16db0b733e891
|
|
BLAKE2b-256 checksum How to use checksums |
a2f5a2cd729a5e7361706fe57561b3ad337f871cd02ef7beed4871d25f042aa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.9
|
Release files / python_okreport-1.1.0-py2.py3-none-any.whl
| Download URL | python_okreport-1.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a73f6c81a228b13847ed105d3e713e7fdcc25f5cf9bb9ff425a93d42775e52d0
|
|
BLAKE2b-256 checksum How to use checksums |
abc2e1222da3f853b6f619070d78693f1f876946a324d449ec8cf333cdc9eceb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.9
|
Security for python-okreport 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.