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

Convert into main + sub packages instead of multiple main packages #76

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f5d610d
Move preflight into tex2pdf
norbusan Nov 28, 2024
196b48b
Fix tests and mypy errors
norbusan Nov 28, 2024
95f9f0e
Cleanup after preflight_parser move
norbusan Nov 28, 2024
3e1c25d
Move zzrm into tex2pdf
norbusan Dec 3, 2024
75944a5
Fix typing and test running
norbusan Nov 28, 2024
3910989
Move tex_inspection to tex2pdf
norbusan Nov 28, 2024
fe235f3
Fix preflight parser mypy test
norbusan Nov 28, 2024
c1288e2
Move tex2pdf_service to tex2pdf.service
norbusan Nov 28, 2024
3963e4c
Move remaining files of tex2pdf_service
norbusan Dec 3, 2024
e192aff
Move remaining files of tex2pdf_service
norbusan Nov 28, 2024
c6732d4
Missing __init__ files, pre-commit cleanup
norbusan Nov 28, 2024
28ef6b7
reorganize imports
norbusan Nov 28, 2024
4d0540c
add poetry.lock
norbusan Nov 28, 2024
341b7ea
Allow ruff-ing conftest.py
norbusan Nov 28, 2024
dcb6f83
Fixes for missing packages and not-starting docker
norbusan Nov 28, 2024
1bfb178
Fix docker tests for tex2pdf.service
norbusan Nov 28, 2024
2aaa3f3
Move preflight tests to test/preflight so they don't end up in the do…
norbusan Nov 28, 2024
5142fef
Move zzrm tests to test/preflight so they don't end up in the docker …
norbusan Nov 28, 2024
ff69819
Move service tests to test/preflight so they don't end up in the dock…
norbusan Nov 28, 2024
f21c209
Fixes for typing in tex2pdf.service
norbusan Nov 28, 2024
49dd3a5
Fixes for service unittests
norbusan Nov 28, 2024
33c6d50
update poetry.lock
norbusan Nov 28, 2024
6c8f71e
Test streamlining, all output in same dir
norbusan Nov 28, 2024
00ec1c5
Update README.md and authors
norbusan Nov 28, 2024
e54f420
Move tex_inspection tests into test directory
norbusan Nov 28, 2024
66bc48d
Enable ruff for tests, fix failures, format
norbusan Nov 28, 2024
e0f4157
GH workflow: run all tests
norbusan Dec 3, 2024
1d8b25e
Merge branch 'master' into single-package
norbusan Dec 10, 2024
0da91e2
Merge branch 'master' into single-package
norbusan Dec 18, 2024
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
55 changes: 0 additions & 55 deletions .github/workflows/test_modules.yaml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/tex2pdf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Setup TeX Live
uses: teatimeguest/setup-texlive-action@v3
with:
packages: scheme-basic
- name: Install dependencies for tex2pdf
run: |
cd tex2pdf_service
python -m pip install --upgrade pip
pip install pytest poetry
poetry install
poetry run pip install types-requests
poetry install --extras service
- name: pytest for tex2pdf
run: |
cd tex2pdf_service
export PYTHONPATH=$PWD
poetry run pytest -k "not integration" tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ cython_debug/
# Emacs backups
*~
\#*
.python-version
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
files: preflight_parser|zerozeroreadme|tex_inspection

default_language_version:
python: python3.11

Expand Down
4 changes: 2 additions & 2 deletions tex2pdf_service/Appliance.Dockerfile → Appliance.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ COPY tex2pdf/ ./tex2pdf/
COPY poetry.lock pyproject.toml ./
# poetry is BROKEN wrt to installing multiple packages from same git repo
# see https://github.com/python-poetry/poetry/issues/6958
RUN poetry config installer.parallel false
# RUN poetry config installer.parallel false
# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
RUN poetry install --without=dev
RUN poetry install --extras service --without=dev


# application specific changes
Expand Down
13 changes: 10 additions & 3 deletions tex2pdf_service/Makefile → Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ TEX2PDF_CPUS := $(shell echo $${TEX2PDF_CPUS:-4})
TEX2PDF_WORKERS := $(shell echo $${TEX2PDF_WORKERS:-8})
TEX2PDF_DOCKER_PLATFORM := $(shell echo $${TEX2PDF_DOCKER_PLATFORM:-linux/amd64})

APP_DOCKER_RUN := docker run --cpus ${TEX2PDF_CPUS} --rm -p ${app_port}:${dockerport} -e PORT=${dockerport} -e WORKERS=${TEX2PDF_WORKERS} --name ${app_name} --security-opt="no-new-privileges=true"
APP_DOCKER_RUN := docker run --cpus ${TEX2PDF_CPUS} --rm -p ${app_port}:${dockerport} -e PORT=${dockerport} -e WORKERS=${TEX2PDF_WORKERS} --name ${app_name} --security-opt="no-new-privileges=true"

.PHONY: HELLO app.docker app.run app.stop

default: HELLO venv/lib/python3.11/site-packages/fastapi
default: HELLO

HELLO:
@echo To see the README of this Makefile, type "make help"
Expand Down Expand Up @@ -53,7 +53,7 @@ app.docker:
#-# Command: app.run
#-# runs the appliance container with the terminal attached (for test)
app.run: app.stop
${APP_DOCKER_RUN} -it ${app_tag}-${base_tag_version}:latest
${APP_DOCKER_RUN} -it ${app_tag}-${base_tag_version}:latest

#-#
#-# Command: app.stop
Expand All @@ -68,3 +68,10 @@ app.stop:
app.sh: app.stop
${APP_DOCKER_RUN} -v ${HOME}/Downloads:/home/worker/Downloads -w /home/worker -it ${app_tag}-${base_tag_version}:latest /bin/bash



##### Makefile entries for preflight parser

regenerate_test_json:
rm -f tests/*.json
for i in tests/* ; do echo "=== $$i ===" ; python -m tex2pdf.preflight_parser $$i | json_pp > $$i.json; done
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
# submission-tools
arXiv submission related tool repository

- **pdf_profile**: Read PDF file and outputs a digst.
- **tex2pdf_service**: Compile arXiv TeX submission and generates PDF.
- **tex_inspection**: A library to inspect the arXiv TeX submission files
arXiv submission related tool repository, mainly collection `tex2pdf` with
its subpackages (`preflight_parser`, `zerozeroreadme`, `tex_inspection`, and `service`)
and the `pdf_profile` package.

# PDF Profile

TBD.

# TeX Inspection

Package: `tex2pdf.tex_inspection`

A library that inspects the arXiv submission

# Preflight Parser

Package: `tex2pdf.preflight_parser`

Full specification: [GenPDF Preflight & 00README Spec Proposal](https://docs.google.com/document/d/1X1ZVvNX75GtFqejcOI1AHb7PkRbkT-syJlpsU4v_-o4/edit?usp=sharing)

# ZeroZeroReadme

Package: `tex2pdf.zerozeroreadme`

Full specification: [00README for authors](https://docs.google.com/document/d/1WbAh2atcDLG0-yJEP9WDKqujHtwH1Kp_TojykeC2HFQ/edit?usp=sharing)

# TeX2PDF Service

Package: `tex2pdf.service`

arXiv's next generation TeX compilation based on TexLive Docker container.

See detailed [README.md](tex2pdf/service/README.md)
2 changes: 1 addition & 1 deletion tex2pdf_service/app-logging.conf → app-logging.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keys=access_handler
keys=json

[formatter_json]
class=tex2pdf.CustomJsonFormatter
class=tex2pdf.service.CustomJsonFormatter
format=%(asctime)s %(name)s %(levelname)s %(message)s %(process)d %(threadName)s

[handler_access_handler]
Expand Down
2 changes: 1 addition & 1 deletion tex2pdf_service/app-logging.json → app-logging.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"disable_existing_loggers": false,
"formatters": {
"json": {
"class": "tex2pdf.CustomJsonFormatter",
"class": "tex2pdf.service.CustomJsonFormatter",
"format": "%(asctime)s %(name)s %(levelname)s %(message)s %(process)d %(threadName)s"
}
},
Expand Down
2 changes: 1 addition & 1 deletion tex2pdf_service/app.sh → app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ fi
export PORT
#export TEXMFHOME=/usr/local/texlive/2023
#. /home/worker/venv/bin/activate
hypercorn --config hypercorn-config.toml --bind 0.0.0.0:$PORT --log-config app-logging.conf --workers $WORKERS tex2pdf.tex2pdf_api:app
hypercorn --config hypercorn-config.toml --bind 0.0.0.0:$PORT --log-config app-logging.conf --workers $WORKERS tex2pdf.service.tex2pdf_api:app
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ do_one () {
rm -rf __tmp__/*
tar -C __tmp__ -xf $1
bn=$(basename $1 .tar.gz)
(python -m preflight_parser __tmp__ | json_pp) > json/$bn.json 2> json/$bn.log
(python -m tex2pdf.preflight_parser __tmp__ | json_pp) > json/$bn.json 2> json/$bn.log
# remove .log file if it has 0 size
if ! [ -s json/$bn.log ] ; then
rm json/$bn.log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from sqlite3 import Connection

import click
from tex2pdf.remote_call import service_process_tarball
from tex2pdf.service.remote_call import service_process_tarball
from tqdm import tqdm

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion tex2pdf_service/tests/conftest.py → conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Pytest configuration file."""


def pytest_addoption(parser):
"""Add command line options to pytest."""
parser.addoption("--keep-docker-running", action="store_true", help="keep docker image running")
parser.addoption("--no-docker-setup", action="store_true", help="do not run docker setup, expect a running docker")
parser.addoption("--docker-port", action="store", default="33031", help="outside docker port to use")

File renamed without changes.
11 changes: 8 additions & 3 deletions tex2pdf_service/mypy.ini → mypy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[mypy]
mypy_path = tex2pdf

exclude = tests

#
# Covered by --strict, with some turned off:
#
Expand All @@ -18,9 +20,10 @@ warn_unused_configs=True
#may be worth reconsidering this one:
no_implicit_optional=True
strict_optional=True
disallow_untyped_calls=True

#
# Other:
# Other:
#
ignore_missing_imports=True
follow_imports=silent
Expand All @@ -30,5 +33,7 @@ follow_imports=silent
#
plugins = pydantic.mypy

[tex2pdf.*]
disallow_untyped_calls=True
#[tex2pdf.*]
#disallow_untyped_calls=True


Loading
Loading