Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
29 changes: 29 additions & 0 deletions deon/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,31 @@ def render(self):

return JsonDict(blank_jupyter_notebook)

class Latex(Format):
doc_template = r"""
\documentclass{article}
\begin{document}
{content}
\end{document}
"""

template = r"""
\section*{{{title}}}
{sections}
"""
Comment on lines +198 to +201
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LaTeX output is missing the docs_link footer that is included in other formats (see examples/ethics.txt line 34, examples/ethics.md line 36). This inconsistency occurs because the template doesn't include a {docs_link} placeholder. Consider adding it at the end of the template or hardcoding it like the HTML format does.

Copilot uses AI. Check for mistakes.
Comment on lines +198 to +201
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template is missing placeholders for 'docs_link' and 'badge' that are used by the parent class's render() method. When the parent class calls template.format() with these arguments, it will raise a KeyError. Either add these placeholders to the template (e.g., at the end) or override them as None/empty string if they're not needed for LaTeX output.

Copilot uses AI. Check for mistakes.

section_template = r"""
\subsection*{{{title}}}
\begin{itemize}
{lines}
\end{itemize}
"""

line_template = r"\item {line}"
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line_template only includes the line text but omits line_id and line_summary, which are included in other formats like Markdown and RST. This is inconsistent with the project's pattern where checklist items show identifiers (e.g., "A.1 A1sum") and summaries. Consider using a template like: r"\item \textbf{{{line_id} {line_summary}}}: {line}" to maintain consistency.

Suggested change
line_template = r"\item {line}"
line_template = r"\item \textbf{{{line_id} {line_summary}}}: {line}"

Copilot uses AI. Check for mistakes.

def render(self):
content = super().render()
return self.doc_template.format(content=content)
Comment on lines +190 to +214
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the established testing pattern in this codebase, the Latex format should have corresponding test functions in tests/test_formats.py and a known_good_latex example in tests/assets.py. See test_markdown, test_rst, and test_html for reference implementations. Tests should verify render() output matches the known_good example and test write() behavior with new/existing files.

Copilot uses AI. Check for mistakes.

class Html(Format):
"""HTML template items"""
Expand Down Expand Up @@ -267,6 +292,7 @@ def write(self, filepath, overwrite=False):
"markdown": Markdown,
"rmarkdown": Markdown,
"rst": Rst,
"latex": Latex,
}

# keep all extensions lowercase
Expand All @@ -277,4 +303,7 @@ def write(self, filepath, overwrite=False):
".md": "markdown",
".rmd": "rmarkdown",
".rst": "rst",
".tex": "latex"
}


52 changes: 52 additions & 0 deletions test.tex
Original file line number Diff line number Diff line change
@@ -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}

Comment on lines +1 to +52
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file test.tex is placed in the root directory, but based on the established pattern in the codebase (see examples/ethics.md, examples/ethics.txt, examples/ethics.html, examples/ethics.rst, examples/ethics.ipynb), it should be named ethics.tex and placed in the examples/ directory to maintain consistency with other format examples.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +52
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated LaTeX output is missing the document preamble and postamble (\documentclass, \begin{document}, \end{document}) that are defined in doc_template. Comparing to the HTML format which wraps content in proper HTML structure (see examples/ethics.html), the LaTeX format should similarly produce a complete, compilable LaTeX document. The current test.tex file appears to be incomplete or was generated incorrectly.

Copilot uses AI. Check for mistakes.