Skip to main content

An opinionated package for integrating Gigantum and Overleaf Projects

Project description

gigaleaf

CircleCI

An 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!

Installation

gigaleaf may be installed using pip.

pip install gigaleaf

Usage

gigaleaf is currently designed to working inside Jupyter Notebooks running in Gigantum and API is pretty simple

The general workflow is:

  • Create an Overleaf Project

  • Get the git share URL from Overleaf

    • Click on "Git" under the sync options

      Git Share Link

    • Copy the URL only (not the entire git command) from the modal that is shown

      Git Share Link

  • Create an instance of gigaleaf

    from gigaleaf import Gigaleaf
    
    gl = 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 for their Overleaf credentials if they run your notebook.

  • Link an image file

    gl.link_image('output/fig1.png')
    

    Here, you pass the relative path in Gigantum to the image file you want to link. 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.

  • Sync Projects

    gl.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().

Advanced Usage

gigaleaf also 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_image() method has additional optional arguments:

  • 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 the adjustbox package. The default is 'center'

To use the subfiles generated you need to make a few modifications to your main.tex preamble. 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{subfiles} % Best loaded last in the preamble
% gigaleaf setup

Once 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 image fig1.png that we linked above.

Contributing

This project is packaged using poetry. To develop, install packages with:

poetry install

When working, be sure to sign-off all of your commits.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gigaleaf-0.0.2.tar.gz (11.5 kB view hashes)

Uploaded Source

Built Distribution

gigaleaf-0.0.2-py3-none-any.whl (15.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page