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

Option to specify build directory

MilesCranmer opened this issue · comments

Right now you can only run showyourwork build in the root directory of a showyourwork project. This means that whenever you are running syw from a different directory, you need to manually change directories before building.

What makes this more difficult is that some tools, like LaTeX-Workshop, make it impossible to run a sequence of shell commands. You have to specify a "command" and then a sequence of arguments. Thus in some scenarios this creates friction in getting syw to build unless you get lucky and have the default directory = syw root directory.

A solution to this would be to add a -d, --directory <SYW_PROJECT_ROOT> flag to all showyourwork commands. This is standard for make-like tools so I think it would be a good addition.

Not sure what a good option name would be, it seems like there isn't a really standard:

  • make and poetry use -C, --directory
  • snakemake uses -d, --directory
  • pip uses --root
  • cmake takes the path as argument, and also allows -S for source/-B for build.
  • pdflatex and latexmk just take the source as argument.

So maybe we just go with -d, --directory to keep consistency with snakemake? @dfm?

Hm, it looks like -d is already taken:

In this case I might go instead with a -p, --project flag, as it feels a bit more suitable due to the multi-media nature of SYW build environments. These other option flags are usually used to specify a source directory, rather than a project/environment.