Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split out the tex inspection as a library. #12

Merged
merged 5 commits into from
Mar 27, 2024
Merged
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
32 changes: 32 additions & 0 deletions .github/workflows/tex_inspection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: tex_inspection library

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies for tex_inspection
run: |
cd tex_inspection
python -m pip install --upgrade pip
pip install pytest poetry
poetry install
- name: pytest for tex_inspection
run: |
cd tex_inspection
export PYTHONPATH=$PWD
poetry run pytest tests
3 changes: 3 additions & 0 deletions tex_inspection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tex Inspection

A library that inspects the arXiv submission
4 changes: 4 additions & 0 deletions tex_inspection/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
arXiv submission Tex Inspection
"""
from tex_inspection.tex_inspection import *
70 changes: 70 additions & 0 deletions tex_inspection/banned_tex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
ban_list:
- description: ACM sample
condition:
filename:
startswith: sample-
line:
startswith: \title{The Name of the Title is Hope}

- description: Guide to Using SIAM's LaTeX
condition:
filename:
equals: docsimart.tex
line:
startswith: \title{Guide to Using SIAM's \LaTeX\ Style\thanks{Submitted to the editors DATE.

- description: Half baked TeX source
condition:
filename:
equals: arxiv-template.tex
line:
startswith: pdftitle={A template for the arxiv style}

- description: Submission and Formatting Instructions for ICML 2024
condition:
filename:
equals: example_paper.tex
line:
startswith: \icmltitlerunning{Submission and Formatting Instructions for ICML 2024}

- description: Responsible NLP research checklist version 0.1
condition:
filename:
equals: responsibleNLPresearch.tex
line:
startswith: \title{Responsible NLP Research Checklist

- description: check list, not paper
condition:
filename:
equals: responsible_checklist.tex
line:
startswith: \title{Responsible CheckList}

- description: This is an example SIAM \LaTeX\ article. This can be used as a template for new articles.
condition:
filename:
equals: ex_article.tex
line:
startswith: This is an example SIAM \LaTeX\ article. This can be used as a

- description: This is an example SIAM \LaTeX\ article. This can be used as a template for new articles.
condition:
filename:
equals: ex_supplement.tex
line:
contains: "pdftitle={Supplementary Materials: An Example Article},"

- description: Guide to Using SIAM's LaTeX Style
condition:
filename:
equals: app-2-writing_sample.tex
line:
startswith: \usepackage{fontspec}

- description: Latex Diff file - the output of tex differ and never part of actual submission
condition:
filename:
equals: diff.tex
line:
contains: "%DIF LATEXDIFF DIFFERENCE FILE"
34 changes: 34 additions & 0 deletions tex_inspection/mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[mypy]
mypy_path = tex_inspection

#
# Covered by --strict, with some turned off:
#
disallow_untyped_defs=True
check_untyped_defs=True
# currently an issue with sql alchemy
disallow_subclassing_any=false
# Need to experiment/think about this one:
disallow_any_decorated=false
warn_redundant_casts=True
warn_return_any=True
warn_unused_ignores=True
# this seems to be at least somewhat non-functioning:
warn_unused_configs=True
#may be worth reconsidering this one:
no_implicit_optional=True
strict_optional=True

#
# Other:
#
ignore_missing_imports=True
follow_imports=silent

#
# Plugins:
#
plugins = pydantic.mypy

[tex_inspection.*]
disallow_untyped_calls=True
299 changes: 299 additions & 0 deletions tex_inspection/poetry.lock

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions tex_inspection/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.poetry]
name = "tex-inspection"
version = "0.1.0"
description = "Inspecting TeX in arXiv submissions"
authors = ["arxiv.org"]
license = "BSD-3 License"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
"ruamel.yaml" = "^0.18"

[tool.poetry.group.dev.dependencies]
pytest = "^8.1.1"
mypy = "*"
mypy-extensions = "*"
pydantic = "1.10.*"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
\documentclass{article}
\usepackage{verbatim}

\begin{document}


\section*{Contents of Makefile. This is fake file 1}
\verbatiminput{Makefile}

\section*{Contents of the Non Secret File}
\verbatiminput{/home/worker/hello.txt}

\end{document}
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%! Author = ntai
%! Date = 11/29/23

% Preamble
\documentclass{article}

% Packages
\usepackage{verbatim}

% Document
\begin{document}

\section*{This is fake file 2}

\section*{Contents of the 00README.XXX}
\verbatiminput{./00README.XXX}

\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%! Author = ntai
%! Date = 11/29/23

% Preamble
\documentclass{article}

% Packages
\usepackage{verbatim}

% Document
\begin{document}

\section*{This is fake file 3. Should be ignored}

\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fake-file-2.tex toplevelfile
fake-file-3.TEX ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
\documentclass{article}
\usepackage{verbatim}

\begin{document}


\section*{Contents of Makefile. This is fake file 1}
\verbatiminput{Makefile}

\section*{Contents of the Non Secret File}
\verbatiminput{/home/worker/hello.txt}

\end{document}
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%! Author = ntai
%! Date = 11/29/23

% Preamble
\documentclass{article}

% Packages
\usepackage{verbatim}

% Document
\begin{document}

\section*{This is fake file 2}

\section*{Contents of the 00README.XXX}
\verbatiminput{./00README.XXX}

\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%! Author = ntai
%! Date = 11/29/23

% Preamble
\documentclass{article}

% Packages
\usepackage{verbatim}

% Document
\begin{document}

\section*{This is fake file 3. Should be ignored}

\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%! Author = ntai
%! Date = 2/14/24

% Preamble
\documentclass[11pt]{article}

% Packages
\usepackage{amsmath}

% Document
\begin{document}



\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fake-file-1.tex ignore
fake-file-2.TEX landscape
fake-file-2.TEX toplevelfile
fake-file-3.tex ignore
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
\documentclass{article}
\usepackage{verbatim}

\begin{document}


\section*{Contents of Makefile. This is fake file 1}
\verbatiminput{Makefile}

\section*{Contents of the Non Secret File}
\verbatiminput{/home/worker/hello.txt}

\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%! Author = ntai
%! Date = 11/29/23

% Preamble
\documentclass{article}

% Packages
\usepackage{verbatim}

% Document
\begin{document}

\section*{This is fake file 2}

\section*{Contents of the 00README.XXX}
\verbatiminput{./00README.XXX}

\end{document}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%! Author = ntai
%! Date = 11/29/23

% Preamble
\documentclass{article}

% Packages
\usepackage{verbatim}

% Document
\begin{document}

\section*{This is fake file 3. Should be ignored}

\end{document}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
\documentclass{article}
\usepackage{verbatim}

\begin{document}


\section*{Contents of Makefile. This is fake file 1}
\verbatiminput{Makefile}

\section*{Contents of the Non Secret File}
\verbatiminput{/home/worker/hello.txt}
\input{fake-file-2}
\input{fake-file-3}

\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%! Author = ntai
%! Date = 11/29/23

% Preamble
\documentclass{article}

% Packages
\usepackage{verbatim}

% Document
\begin{document}

\section*{This is fake file 2}

\section*{Contents of the 00README.XXX}
\verbatiminput{./00README.XXX}

\end{document}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%! Author = ntai
%! Date = 11/29/23

% Preamble
\documentclass{article}

% Packages
\usepackage{verbatim}

% Document
\begin{document}

\section*{This is fake file 3. Should be ignored}

\end{document}
Loading
Loading