research_helpers.arxiv

Assembles and checks an arXiv submission. See arXiv and Zenodo.

research_helpers.arxiv.manifest(*, patterns=DEFAULT_PATTERNS, extra=None)[source]

Return the upload set, keyed by the path each file takes inside the submission.

Names are taken relative to the directory holding the manuscript, so a table installed at ‘tex/tables/scores.tex’ and read as ‘input{tables/scores}’ is uploaded as ‘tables/scores.tex’ and resolves the same way on arXiv.

Parameters:
  • patterns (Iterable[str], default: DEFAULT_PATTERNS) – glob patterns collected from the tables and figures directories.

  • extra (Mapping[str, Path] | None, default: None) – anything else the build needs, e.g. a class file or a logo, keyed by its path inside the submission.

Return type:

dict[str, Path]

Returns:

Submission path to source file, in a stable order.

research_helpers.arxiv.bbl_format(path)[source]

Return the format version declared in a biblatex .bbl.

Return type:

str | None

Parameters:

path (Path)

research_helpers.arxiv.check(files, *, engine=None, texlive=None, expected_bbl_format=None)[source]

Return every reason this submission would be rejected or would build wrongly.

Parameters:
  • files (Mapping[str, Path]) – the upload set, from ‘manifest’.

  • engine (str | None, default: None) – the LaTeX engine selected on arXiv. Defaults to the project’s setting.

  • texlive (int | None, default: None) – the TeX Live year selected on arXiv, used in messages.

  • expected_bbl_format (str | None, default: None) – the biblatex .bbl format that year reads. Defaults to the project’s setting.

Return type:

list[str]

Returns:

One line per problem, empty when there is nothing wrong.

research_helpers.arxiv.build(files, destination)[source]

Copy the upload set into a freshly emptied directory.

Parameters:
  • files (Mapping[str, Path]) – the upload set, from ‘manifest’.

  • destination (Path | str) – the submission directory, emptied first so nothing stale is uploaded.

Return type:

list[str]

Returns:

The submission paths written.

research_helpers.arxiv.pack(source, archive=None)[source]

Pack a built submission as the tarball arXiv accepts.

The archive is byte-reproducible, so re-packing an unchanged submission gives an identical file and a resubmission can be told apart from a rebuild.

Parameters:
  • source (Path | str) – the built submission directory.

  • archive (Path | str | None, default: None) – where to write the tarball. Defaults to the directory’s name plus ‘.tar.gz’.

Return type:

Path

Returns:

The archive written.

research_helpers.arxiv.preview(source, destination, *, engine=None, passes=DEFAULT_PASSES)[source]

Compile a built submission with the engine arXiv will use.

Parameters:
  • source (Path | str) – the built submission directory.

  • destination (Path | str) – where to compile, emptied first.

  • engine (str | None, default: None) – the LaTeX engine. Defaults to the project’s setting.

  • passes (int, default: DEFAULT_PASSES) – how many times to run it, for cross-references to settle.

Return type:

Path

Returns:

The PDF produced.

Raises:

RuntimeError – if the engine produced no PDF.

research_helpers.arxiv.report(files, problems)[source]

Return the manifest and anything wrong with it.

Parameters:
  • files (Mapping[str, Path]) – the upload set, from ‘manifest’.

  • problems (list[str]) – what ‘check’ found.

Return type:

str

Returns:

The report, ready to print.