Topics Map > Electronic Lab Notebooks

LabArchives and Jupyter Notebook Migration: migrating your code to GitLab

This article details the steps to migrate your source code from Jupyter Notebooks and LabArchives to the UW-Madison instance of GitLab.

Managing your code is a crucial step in making your research reproducible. Git is a version control system used for tracking changes in computer files. This allows researchers to version control their notebooks, collaborate with others, and manage work within GitLab, help them streamline their research workflows and manage their projects more effectively. It is generally used for source code like the code you created in Jupyter Notebooks, LabArchives, and other Electronic Research Notebooks. You can learn about the benefits of using git and managing your code with repositories here and here.

While there isn't a direct integration between LabArchives and GitLab, researchers can still use them together in their workflow. Researchers can manually export their data or files from LabArchives and then commit and push them to their GitLab repository. This allows researchers to track changes and collaborate with others using GitLab, while still keeping the data organized. 

GitLab is a web-based Git repository that provides both public and private repositories. DoIT manages an instance of GitLab free of charge for campus researchers. However, if you are planning to leave campus, you can still get a free account with GitLab or Github. Both have generous licenses for individuals. 

GitHub Version Control for Jupyter Notebooks

Qubole Data Service documentation:

1.   Generating a Gitlab token in the GitLab Profile 

  1. Navigate to Notebooks >> Jupyter and open a Jupyter notebook.
  2. From the left sidebar, click on the GitLab Versions icon.
  3. Click Configure now.
  4. In the dialog box add the generated GitLab token and click Save.
  5. The GitLab token is now configured for your account.

2.   Linking Jupyter Notebooks to GitLab

  1. Navigate to the GitLab profile and copy the URL from the browser’s address bar.
  2. Navigate to Notebooks >> Jupyter and open a Jupyter notebook.
  3. From the left sidebar, click on the GitLab Versions icon.,
  4. Click the Link Now option.
  5. In the Link Notebook to GitLab dialog box, perform the following actions:

    1. Add the GitLab repository URL in the Repository Web URL text field. Ensure that the GitLab profile token has read permissions for the repository to checkout a commit and write permissions for the repository to push a commit.
       
      1. Select a branch from the Branch drop-down list.
      2. Add an object path file in the Object Path text field.
      3. If you want to strip the outputs from the notebooks before committing to GitLab, select the Strip Output checkbox.
      4. Click Save.

GitLab - LabArchives

  1. Initialize a Git repository for your LabArchives project folder.
  2. Commit and push your file to the GitLab repository.
  3. Collaborators can then clone the repository, make changes to the files, and push their updates back to the GitLab repository.



KeywordsLabArchives, ELN, RCI, gitlab   Doc ID132771
OwnerMary M.GroupUW-Madison Research Data
Created2023-11-14 11:11:01Updated2023-11-14 11:36:47
SitesUW-Madison Research Data
Feedback  0   0