Skip to main content

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!

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.

Installation

gigaleaf may be installed using pip.

pip install gigaleaf

Usage

gigaleaf 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 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. To be able to access your Overleaf project and run gigaleaf commands, they must also have access to your Overleaf project.

  • Link an output file

    gl.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 file

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

    Remove a file from linking and delete its data from the Overleaf project.

  • 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(). 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 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 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 the adjustbox package. 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 into pandas.DataFrame.to_latex when generating the subfile When using link_dataframe(), gigaleaf assumes you've pickled your dataframe using pandas.DataFrame.to_pickle.

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{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 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.

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:

poetry config virtualenvs.create false
export PIP_USER=yes

Acknowledgements

Thanks to Simon Porter (@sjcporter) for valuable conversations and creating an early version of this concept in his "What does a university look like" project.

Metadata

Release files for gigaleaf 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gigaleaf 0.1.6
File Size Uploaded Provenance Actions
gigaleaf-0.1.6.tar.gz 16.1 kB Without provenance Details for gigaleaf-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gigaleaf 0.1.6
File Interpreter ABI Platform Actions
gigaleaf-0.1.6-py3-none-any.whl Python 3 none any Details for gigaleaf-0.1.6-py3-none-any.whl

Total release size: 39.0 kB

Release files / gigaleaf-0.1.6.tar.gz

Download URL gigaleaf-0.1.6.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6a4dac50abafa3971585ad7496bfe2f45ef96327890a36d4c2838427f7ab7966
BLAKE2b-256 checksum
How to use checksums
993c199ba57373846a7451625540157b7b08a922bc378a3d3f5ae494ecbf7f3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.9 CPython/3.7.7 Linux/4.15.0-1067-aws

Release files / gigaleaf-0.1.6-py3-none-any.whl

Download URL gigaleaf-0.1.6-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13d70a6e7c225fb3ef2c3c7019b416215e4db1bd4e18a7be681347b2aca8728a
BLAKE2b-256 checksum
How to use checksums
6e1d68a0ba7ad4ccd07c71fcda92794fea4bb5bc1446bd86bef3cea981b611ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.9 CPython/3.7.7 Linux/4.15.0-1067-aws

Security for gigaleaf 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page