What is nbgitpuller?
maingit commands. While primarily used with JupyterHub, it can also function on local computers.repository·main·Indexed 42 days ago
https://github.com/jupyterhub/nbgitpullerA tool for educators and developers to distribute git-based content to users via simple URLs. It automates cloning and pulling repositories directly into Jupyter environments, including JupyterHub, classic Notebook Server, and Jupyter Server, handling git operations and automatic merging behind the scenes.
git commands. While primarily used with JupyterHub, it can also function on local computers.An nbgitpuller link is a URL that, when clicked by a user, automates the process of synchronizing a Git repository with a JupyterHub instance.
Key behaviors:
Link components:
An nbgitpuller link typically contains:
nbgitpuller is designed to minimize manual git interaction for end users (students) by applying opinionated merging rules when their local environment diverges from the instructor's remote repository.
Key behaviors include:
Untitled141_<timestamp>.ipynb and pull the instructor's version to preserve both.git commands.nbgitpuller only performs "pull" operations).git directly. Using nbgitpuller for pulling while users use git for pushing can lead to unexpected behavior.git operations locally, avoid nbgitpuller. Mixing manual git commands with nbgitpuller's automatic operations will cause conflicts and unexpected results.When a user lands on the link generator page, you can force the form to start on a specific authentication tab using the tab query parameter.
Supported values:
?tab=binder: Activates the Binder tab.?tab=canvas: Activates the Launch from Canvas tab.You can create custom nbgitpuller links using the web-based link generator. These links allow users to launch a JupyterHub instance (or Binder) with a specific Git repository and branch pre-configured.
To generate a link, you need to provide:
nbgitpuller is installed.git, https, or SSH formats).main).NamedServer instance.Alternatively, you can use the nbgitpuller-link-generator browser extension available for Firefox and Chrome.
You can pre-fill the link generator form by appending query parameters to the generator URL. This is useful for creating shared links that are already partially configured for your users.
Supported query parameters:
hub: The URL of the JupyterHub.repo: The URL of the Git repository.branch: The branch name to pull from.Example: To pre-populate the JupyterHub URL for UC Berkeley DataHub, use:
https://nbgitpuller.readthedocs.io/link.html?hub=https://datahub.berkeley.edu
https://nbgitpuller.readthedocs.io/link.html?hub=https://datahub.berkeley.eduSince nbgitpuller works with both the classic Notebook Server and the newer Jupyter Server, you can develop it locally without a JupyterHub instance. Follow these steps to prepare your environment:
nbgitpuller repo.python3 -m venv venv and activate it.pip install -r dev-requirements.txtpip install -e .npm install to install packages from package.json.npm run webpack to create the JS and CSS bundles.Note: If you modify Python code, you must restart the notebook server process. Changes to JavaScript or CSS do not require a server restart.
# Setup steps summary
python3 -m venv venv
source venv/bin/activate
pip install -r dev-requirements.txt
pip install -e .
npm install
npm run webpackLarge git repositories increase the risk of timeouts, intermittent failures, and inconsistent states (e.g., contents fetched but not checked out).
To ensure a smooth experience:
Use nbgitpuller to distribute Jupyter Notebooks or other files to users without requiring them to understand git. The workflow follows these steps:
nbgitpuller is installed on the user's environment (e.g., installed for all users of a JupyterHub).nbgitpuller link that points to the specific content you want to distribute (such as a notebook in a GitHub repository).nbgitpuller automatically pulls the content into their live Jupyter session and onto their file system.Note: nbgitpuller is a "pull" tool only. It does not "push" changes back to a repository. You must have an alternative method for collecting content/changes from your users.
Committing Jupyter's autosave directory (.ipynb_checkpoints) or other temporary files (like .DS_Store or __pycache__) can cause hard-to-debug conflicts between the user's local environment and the JupyterHub server.
To prevent this, add these patterns to your .gitignore file. You can use a standard Python .gitignore to cover most common temporary files.
Documentation is maintained using sphinx and is located in the docs/ directory. It uses a mix of reStructuredText and MyST Markdown.
pip install -r docs/doc-requirements.txtdocs folder and run make html._build/html/index.html in your browser.To quickly open the preview from the docs folder:
open _build/html/index.htmlxdg-open _build/html/index.html# Build documentation
pip install -r docs/doc-requirements.txt
cd docs
make html
# Preview (MacOS)
open _build/html/index.html