showyourwork / showyourwork

A workflow for reproducible and open scientific articles

Home Page:https://show-your.work

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

problems with setting up overleaf integration

ciskakemper opened this issue · comments

Following the instructions on https://show-your.work/en/latest/overleaf/ precisely I find that after showyourwork setup rodluger/article --overleaf=6272c02ffe09ce2c9a5f0ff6 I get the following output:

Fetching Overleaf repo...
Overleaf repository not empty! Refusing to rewrite files on remote.
Deleting directory NESS_04_opacities...

The instructions explicitly say not to delete 'main.tex' as it will be overwritten, but this is apparently not how overleaf is behaving.

Next I tried to actually empty the overleaf directory, by removing main.tex, and run the setup command again.
This results in the following output (reproduced on two different computers):

Fetching Overleaf repo...
Deleting directory NESS_04_opacities...
Traceback (most recent call last):
  File "/home/aliga/ciska/.local/bin/showyourwork", line 8, in <module>
    sys.exit(entry_point())
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/showyourwork/cli/__init__.py", line 59, in entry_point
    main()
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/showyourwork/cli/main.py", line 265, in setup
    commands.setup(slug, cache, overleaf, ssh, action_spec)
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/showyourwork/cli/commands/setup.py", line 133, in setup
    raise e
 File "/home/aliga/ciska/.local/lib/python3.9/site-packages/showyourwork/cli/commands/setup.py", line 125, in setup
    overleaf.setup_remote(overleaf_id, path=Path(repo).absolute())
  File "/home/aliga/ciska/.local/lib/python3.9/site-packages/showyourwork/overleaf.py", line 253, in setup_remote
    files[0].unlink()
IndexError: list index out of range

So, it is not clear how to set this up.

The content of this comment has been moved to #323 to form its own issue, as it is not really related to the issue above.

Oh interesting! That sounds like it's probably a bug in showyourwork, since I'd want it to be able to work with whatever special characters you want. I'm glad you found a temporary solution and we'll look into it some more. Thanks for the report!

Hi Dan, the password issue was a separate "by the way" type of comment. I had to fix that first, before I could even try to connect to overleaf. So the original issue still stands, and it is not solved.

Oh I see. Can you confirm that you created a new blank overleaf project with the default template? It's possible that the overleaf default template has been changed.

Also: I'm assuming that you didn't use rodluger/article and that specific overleaf id (both of those are placeholders) in your command line call, right? Instead you used your own repo and overleaf id. Let me know!

Also: can you open a separate issue about the password problem? It's easier to track development that way if you don't mind!

Hi Dan, I opened a separate issue for the special characters in overleaf passwords. To answer your other questions:

  • I created a blank overleaf project as instructed, which gives you a minimal main.tex to start with.
  • I used my own github organization name and repository name, and also the overleaf ID that I had generated myself. I did not use the example defaults.

OK thanks for confirming!

I can also confirm that it looks like Overleaf has changed the default template. We expect the main.tex to match with this regular expression:

OVERLEAF_BLANK_PROJECT_REGEX_TEMPLATE = r"[\n\r\s]+".join(
[
r"\\documentclass{article}",
r"\\usepackage\[utf8\]{inputenc}",
r"\\title{[^\n{}]+?}",
r"\\author{[^\n{}]+?}",
r"\\date{[^\n{}]+?}",
r"\\begin{document}",
r"\\maketitle",
r"\\section{Introduction}",
r"\\end{document}",
]
)

but the default now seems to be:

\documentclass{article}
\usepackage{graphicx} % Required for inserting images

\title{Template Issue Test}
\author{Dan Foreman-Mackey}
\date{February 2023}

\begin{document}

\maketitle

\section{Introduction}

\end{document}

where inputenc has been replaced by graphicx. A PR fixing the regex would be much appreciated!!