Package: gigaleaf
gigaleafAn opinionated library to link Gigantum Projects to Overleaf Projects. This tool automatically manages git repositories
to link the outputs from a Gigantum Project to an Overleaf Project, letting you build a completely reproducible
workflow from analysis to publication.NOTE: This library is an early alpha proof of concept and subject to change!NOTE: This library uses the Overleaf git bridge and is only included in paid Overleaf accounts. The Overleaf project
owner must have a paid account, but collaborators do not.Installationgigaleaf may be installed using pip.pipinstallgigaleafUsagegigaleaf is currently designed to work inside Jupyter Notebooks running in Gigantum. The high-level API is pretty simple. The general workflow is:Create an Overleaf ProjectGet the git share URL from OverleafClick on "Git" under the sync optionsCopy the URL only (not the entire git command) from the modal that is shownCreate an instance of gigaleaffromgigaleafimportGigaleafgl=Gigaleaf()This will start the configuration process where you enter the Overleaf URL along with
the email and password you use to log into Overleaf. These will be stored in a file locally that is "untracked" in
Gigantum and therefore will not sync or be shared. Other users will be prompted fortheirOverleaf credentials if
they run your notebook. To be able to access your Overleaf project and rungigaleafcommands, they must also have
access to your Overleaf project.Link an output filegl.link_image('../output/fig1.png')Here, you pass the relative path in Gigantum to the that file you want to link. Currently image and csv files are
supported. Any time this file changes and you sync, it will automatically be updated in your Overleaf project!You only need to call this once per file that you wish to track. Calling it again will update settings (e.g.
a figure caption)Unlink an output filegl.unlink_image('../output/fig1.png')Remove a file from linking and delete its data from the Overleaf project.Sync Projectsgl.sync()This will pull changes from Overleaf, apply all gigaleaf managed changes, and then push back to Overleaf. Once files
are linked, you typically will only be calling.sync(). It's safe to call.sync()multiple times, in particular
at the end of a notebook when you'd want to update Overleaf with your latest results.Advanced Usagegigaleafalso provides Latex subfiles that you can use into your Overleaf Project that make adding and updating content
from Gigantum trivial. To take full advantage of this, the link methods have optional arguments:.link_image()caption: A caption that will be added to the image. If omitted, not caption is inserted.label: A label to add to the figure for referencing inside your Overleaf document.width: A string to set width of the image. The default is "0.5\textwidth".alignment: A string to set the position of the image using theadjustboxpackage. The default is 'center'..link_csv()caption: A caption that will be added to the table. If omitted, not caption is inserted.label: A label to add to the table for referencing inside your Overleaf document..link_dataframe()kwargs: A dictionary of kwargs to pass directly intopandas.DataFrame.to_latexwhen generating the subfile
When usinglink_dataframe(),gigaleafassumes you've pickled your dataframe usingpandas.DataFrame.to_pickle.To use the subfiles generated you need to make a few modifications to yourmain.texpreamble. You may need to modify
this depending on your exact project configuration:% gigaleaf setup\usepackage[export]{adjustbox}% Needed if linking image files\usepackage{graphicx}% Needed if linking image files\graphicspath{{gigantum/data/}{../data/}}% Needed if linking image files\usepackage{csvsimple}% Needed if linking csv files\usepackage{float}% Needed if linking csv files\restylefloat{table}% Needed if linking csv files\usepackage{booktabs}% Needed if linking dataframe files\usepackage{subfiles}% Best loaded last in the preamble% gigaleaf setupOnce configured, you can simply import the subfiles as they are created in your project. They will be named in a way
that matches the files they are linked to:\subfile{gigantum/subfiles/fig1_png}In this example, this subfile would render the imagefig1.pngthat we linked above.ContributingThis project is packaged usingpoetry. To develop, install packages with:poetryinstallWhen working, be sure to sign-off all of your commits.If trying to install in a Gigantum Project from source for testing, poetry needs to not try to create a virtualenv
and should install as the user. This can be done by setting the following options:poetryconfigvirtualenvs.createfalseexportPIP_USER=yesAcknowledgementsThanks to Simon Porter (@sjcporter) for valuable conversations and creating an
early version of this concept in his"What does a university look like" project.