From 7a1bb2e9819e54d36b6d86ce6806d91479792917 Mon Sep 17 00:00:00 2001 From: sunnyy19 Date: Sat, 21 Feb 2026 13:42:43 +0100 Subject: [PATCH 1/3] Add LaTeX output format support --- deon/formats.py | 16 +++++++++++++++ test.tex | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 test.tex diff --git a/deon/formats.py b/deon/formats.py index bdcdcdb..4efccc5 100644 --- a/deon/formats.py +++ b/deon/formats.py @@ -187,6 +187,18 @@ def render(self): return JsonDict(blank_jupyter_notebook) +class Latex(Format): + template = """ +\\section*{{{title}}} +{sections} +""" + section_template = """ +\\subsection*{{{title}}} +\\begin{{itemize}} +{lines} +\\end{{itemize}} +""" + line_template = "\\item {line}" class Html(Format): """HTML template items""" @@ -267,6 +279,7 @@ def write(self, filepath, overwrite=False): "markdown": Markdown, "rmarkdown": Markdown, "rst": Rst, + "latex": Latex, } # keep all extensions lowercase @@ -277,4 +290,7 @@ def write(self, filepath, overwrite=False): ".md": "markdown", ".rmd": "rmarkdown", ".rst": "rst", + ".tex": "latex" } + + diff --git a/test.tex b/test.tex new file mode 100644 index 0000000..56c759e --- /dev/null +++ b/test.tex @@ -0,0 +1,52 @@ + +\section*{Data Science Ethics Checklist} + +\subsection*{A. Data Collection} +\begin{itemize} +\item If there are human subjects, have they given informed consent, where subjects affirmatively opt-in and have a clear understanding of the data uses to which they consent? +\item Have we considered sources of bias that could be introduced during data collection and survey design and taken steps to mitigate those? +\item Have we considered ways to minimize exposure of personally identifiable information (PII) for example through anonymization or not collecting information that isn't relevant for analysis? +\item Have we considered ways to enable testing downstream results for biased outcomes (e.g., collecting data on protected group status like race or gender)? +\end{itemize} + + + +\subsection*{B. Data Storage} +\begin{itemize} +\item Do we have a plan to protect and secure data (e.g., encryption at rest and in transit, access controls on internal users and third parties, access logs, and up-to-date software)? +\item Do we have a mechanism through which an individual can request their personal information be removed? +\item Is there a schedule or plan to delete the data after it is no longer needed? +\end{itemize} + + + +\subsection*{C. Analysis} +\begin{itemize} +\item Have we sought to address blindspots in the analysis through engagement with relevant stakeholders (e.g., checking assumptions and discussing implications with affected communities and subject matter experts)? +\item Have we examined the data for possible sources of bias and taken steps to mitigate or address these biases (e.g., stereotype perpetuation, confirmation bias, imbalanced classes, or omitted confounding variables)? +\item Are our visualizations, summary statistics, and reports designed to honestly represent the underlying data? +\item Have we ensured that data with PII are not used or displayed unless necessary for the analysis? +\item Is the process of generating the analysis well documented and reproducible if we discover issues in the future? +\end{itemize} + + + +\subsection*{D. Modeling} +\begin{itemize} +\item Have we ensured that the model does not rely on variables or proxies for variables that are unfairly discriminatory? +\item Have we tested model results for fairness with respect to different affected groups (e.g., tested for disparate error rates)? +\item Have we considered the effects of optimizing for our defined metrics and considered additional metrics? +\item Can we explain in understandable terms a decision the model made in cases where a justification is needed? +\item Have we communicated the shortcomings, limitations, and biases of the model to relevant stakeholders in ways that can be generally understood? +\end{itemize} + + + +\subsection*{E. Deployment} +\begin{itemize} +\item Do we have a clear plan to monitor the model and its impacts after it is deployed (e.g., performance monitoring, regular audit of sample predictions, human review of high-stakes decisions, reviewing downstream impacts of errors or low-confidence decisions, testing for concept drift)? +\item Have we discussed with our organization a plan for response if users are harmed by the results (e.g., how does the data science team evaluate these cases and update analysis and models to prevent future harm)? +\item Is there a way to turn off or roll back the model in production if necessary? +\item Have we taken steps to identify and prevent unintended uses and abuse of the model and do we have a plan to monitor these once the model is deployed? +\end{itemize} + From 1dd6db662489c42ae29b97b6a32f375bdf72df10 Mon Sep 17 00:00:00 2001 From: sunnyy19 Date: Wed, 25 Feb 2026 08:28:42 +0100 Subject: [PATCH 2/3] Update CLI docs for LaTeX format support --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 22b4aee..d3ac78c 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ Here are the currently supported file types. We will accept pull requests with n - `.md`: markdown - `.rmd`: rmarkdown - `.rst`: rst +- `.tex`: latex # Command line options @@ -154,10 +155,10 @@ Options: -l, --checklist PATH Override default checklist file with a path to a custom checklist.yml file. -f, --format TEXT Output format. Default is "markdown". Can be one of - [ascii, html, jupyter, markdown, rmarkdown, rst]. + [ascii, html, jupyter, markdown, rmarkdown, rst, latex]. Ignored and file extension used if --output is passed. -o, --output PATH Output file path. Extension can be one of [.txt, .html, - .ipynb, .md, .rmd, .rst]. The checklist is appended if + .ipynb, .md, .rmd, .rst, .tex]. The checklist is appended if the file exists. -w, --overwrite Overwrite output file if it exists. Default is False, which will append to existing file. From 4270b1a671121ccf308611c3ba909201ff93cb29 Mon Sep 17 00:00:00 2001 From: sunnyy19 Date: Wed, 25 Feb 2026 08:37:59 +0100 Subject: [PATCH 3/3] Fix LaTeX rendering to produce standalone documents --- deon/formats.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/deon/formats.py b/deon/formats.py index 4efccc5..3eaffff 100644 --- a/deon/formats.py +++ b/deon/formats.py @@ -188,17 +188,30 @@ def render(self): return JsonDict(blank_jupyter_notebook) class Latex(Format): - template = """ -\\section*{{{title}}} + doc_template = r""" +\documentclass{article} +\begin{document} +{content} +\end{document} +""" + + template = r""" +\section*{{{title}}} {sections} """ - section_template = """ -\\subsection*{{{title}}} -\\begin{{itemize}} + + section_template = r""" +\subsection*{{{title}}} +\begin{itemize} {lines} -\\end{{itemize}} +\end{itemize} """ - line_template = "\\item {line}" + + line_template = r"\item {line}" + + def render(self): + content = super().render() + return self.doc_template.format(content=content) class Html(Format): """HTML template items"""