overleaf

overleaf#

showyourwork.overleaf.check_for_rate_limit(code, stdout, stderr)#

Callback function to check if we hit a rate limit on Overleaf.

showyourwork.overleaf.clone(project_id, path=None)#

Clones an Overleaf remote locally.

Parameters:
  • project_id (str) – The Overleaf project ID.

  • path (str, optional) – The path to the top level of the user’s repo (if running from a different directory).

Note that we don’t qactually clone the repository (despite the name of this function) to avoid storing the url containing the Overleaf password in .git/config. Instead, we initialize a new repository and pull from the remote.

showyourwork.overleaf.get_overleaf_credentials(overleaf_email='OVERLEAF_EMAIL', overleaf_password='OVERLEAF_PASSWORD', error_if_missing=False)#

Return the user’s Overleaf email and password, stored in env vars.

Parameters:
  • overleaf_email (str, optional) – Environment variable containing the Overleaf account email address. Default OVERLEAF_EMAIL.

  • overleaf_password (str, optional) – Environment variable containing the Overleaf account password. Default OVERLEAF_PASSWORD.

  • error_if_missing (bool, optional) – Default False.

showyourwork.overleaf.pull_files(files, project_id, error_if_missing=False, error_if_local_changes=False, path=None, commit_changes=True, push_changes=False)#

Pull files from the Overleaf remote.

Parameters:
  • files (list) – A list of strings corresponding to the paths of the files to be pulled from the Overleaf remote. These paths must be given relative to src/tex/ or within subdirectories.

  • project_id (str) – The Overleaf project ID.

  • error_if_missing (bool, optional) – Default False, which prints a warning but does not interrupt the workflow.

  • error_if_local_changes (bool, optional) – Default False, which prints a warning but does not interrupt the workflow.

  • path (str, optional) – The path to the top level of the user’s repo (if running from a different directory).

  • commit_changes (bool, optional) – Commit changes to the article repository? Default True.

  • push_changes (bool, optional) – Push committed changes to the remote article repository? Only applicable if commit_changes is True. Default False.

showyourwork.overleaf.push_files(files, project_id, path=None)#

Push files to the Overleaf remote.

Parameters:
  • files (list) – A list of strings corresponding to the paths of the files to be pushed to the Overleaf remote. These files must be located in src/tex/. Subdirectories will be preserved.

  • project_id (str) – The Overleaf project ID.

  • path (str, optional) – The path to the top level of the user’s repo (if running from a different directory).

showyourwork.overleaf.setup_remote(project_id, path=None)#

Set up the bridge between the git repo and the Overleaf project for an empty Overleaf project with a given ID.

Parameters:
  • project_id (str) – The Overleaf project ID.

  • path (str, optional) – The path to the top level of the user’s repo (if running from a different directory).

showyourwork.overleaf.wipe_remote(project_id, tex=None)#

Remove all files from the Overleaf project and start fresh as if it were a blank project.

Parameters:

project_id (str) – The Overleaf project ID.