How T Upload Jpyter Notevbok to Github

Sharing Jupyter Notebooks using GitHub

Overview

Didactics: 10 min
Exercises: fifteen min

Questions

  • How can I share my work outside of publishing in a traditional journal?

  • How tin can I apply GitHub for sharing Jupyter notebooks online?

Objectives

  • Create a repository on GitHub to share your Jupyter Notebook online.

  • Describe the features GitHub provides that enhance its utility for online sharing.

  • Describe GitHub's limitations for sharing Jupyter Notebooks.

Sharing using GitHub

In this lesson we volition learn:

  • How to create a GitHub account and add an initial project repository. A repository is a central location where source code and data is stored and managed
  • How to add a file to the repository using GitHub's web interface
  • How to visually ostend that files have been added to the repository and preview files using the GitHub interface
  • The concepts of creating a public repository for the purpose of sharing your research information

GitHub

GitHub is a development platform where nosotros "tin can host and review code, manage projects, and build software." GitHub hosts source code for 75+ million projects including the pandas bundle we have been using among many others.

ane. Go to the GitHub Homepage

To apply GitHub 1 needs to register for a (free) account. To register for a GitHub account nosotros need to:

  1. Open a web browser
  2. Navigate to github.com

Nosotros should see the the web folio below.

Notation: If you already take a GitHub account you practice Not demand to create a new one. Please skip down to step 3.

github-homepage-new-user.png

ii. To create a GitHub account

  • On the GitHub homepage enter:

    • a username
    • an email accost
    • a password
  • Click the gree Sign upwards for GitHub button.

An instance is shown in the screenshot below.

github-new-user-sign-up.png

We are asked to confirm the email accost that we used to sign. Delight confirm the email address.

Select a plan

We have to choose a plan that we would like to utilize. We will apply the personal (default) plan.

Click on Proceed.

github-welcome-step-2.png

Completing our signup

We can select whatsoever options we would similar (on none).

Click Submit to complete our Github account setup.

github-welcome-step-3.png

3. Create a new reprository

  • Click on Start a projection as shown beneath.

github-dashboard.png

Create a new repository:

  • Add a repository name. We choose to name our repository sharing-github.
  • Personal GitHub accounts require that projects be public.
  • Bank check the Initialize this repository with a README option.
  • Click the green Create repository push.

github-new-repository-sharing-github.png

After creating the new repository, we will be taken to the project homepage (shown below).

github-new-repository-homepage.png

If we click on the GitHub icon at the top of the page, nosotros volition go to our GitHub homepage.

Our GitHub homepage volition now show the new repository under Your repositories (every bit shown below).

github-new-user-with-repository.png

Congratulations!! Nosotros now accept a GitHub business relationship and we take created our beginning repository.

4. Uploading an example file (notebook) to the repository

We will use GitHub's web interface to upload our files to our new repository.

Before nosotros upload 1 of our existing files, we volition starting time create a new notebook with a "print('how-do-you-do globe')" Python statement in a unmarried cell.

4.1 Create a new sample notebook

  • At the Jupyter dashboard, click on New button and select a Python 3 notebook.
  • In the first jail cell of the notebok, enter the following Python statement:

  • Run the prison cell to confim that what you lot entered is free of syntax and other errors.
  • Save the notebook as "hello_world_binder.ipynb"

To add together our new sample notebook to our GitHub repository, we will return to our repository's homepage at https://github.com.

iv.2 Upload the new sample notebook to our GitHub repository

  • Go to GitHub in our browser. Nosotros tin can click the link to the left.
  • Click on the sharing-github repository
  • Click on the Upload file button
  • Drag and drib the sample notebook or click the choose your files link to select the sample notebook.
    • We volition see any files that nosotros have uploaded at the bottom of the drag and drop area.
  • Add a message describing the change we are almost to make.
    • Type "Adds sample notebook" in the field of study field.
    • We can either add together the aforementioned message below in the extended description or go out it blank.
  • Click on Commit changes button to complete the uplaod.

After commiting the modify we should run into that in that location are now two files in the repository: 1) the README and 2) the new sample notebook (as seen in the screenshot below).

github-new-file-added.png

We tin can actually preview the notebook by clicking on it (shown beneath). Annotation that GitHub will automatically render your notebook and then that it's displayed in the browser. This can be a great style to quickly show other people what y'all've been upwardly to!

github-sharing-notebook-preview.png

5. Upload our previous working notebook to the repository

In anticipation of our next lesson on sharing notebooks in a dynamic rather than static mode, let'due south upload the notebook that nosotros have bene working on. To do this we will repeat many of the steps higher up.

Upload our file:

  • Render to sharing-github repository on GitHub
  • Click on the Upload file button
  • Drag and drop the information assay notebook completed in the previous lesson or click the choose your files link to select the notebook.
    • Nosotros volition run across whatsoever files that we take uploaded at the bottom of the drag and driblet area.
  • Add together a message describing the change we are about to make.
    • Typing "Added data analysis notebook" in the discipline field.
    • We tin can either add the same message below in the extended description or go out it bare.
  • Click on Commit changes push button to complete the uplaod.

After commiting the change nosotros should meet that there are now three files in the repository: 1) the README and 2) the sample notebook and 3) our new data analysis notebook.

Where to find more than virtually GitHub

To learn more about GitHub you tin can review 1 or more of these additional (external) resouces:

  • GitHub Guide - Hello World
  • All the GitHub guides
  • Hubspot git and GitHub tutorial
  • Plurlsight's GitHub beginner's guide
  • Code School's GitHub tutorial

More almost Git version command

If you would like to learn about source lawmaking version control using the git software, the Git in GitHub, please see these resources:

  • Try this 15 minute interactive git tutorial
  • Effort some additioanl git exercises here

Key Points

  • GitHub is a development platform where we "tin host and review lawmaking, manage projects, and build software."

  • A GitHub repository can be created, populated, and shared without command line or other special-purpose version control tools.

  • Jupyter Notebooks shared through GitHub are rendered, but are static. GitHub does not run the notebook(s) in a repository.

oldhamdisated.blogspot.com

Source: https://reproducible-science-curriculum.github.io/sharing-RR-Jupyter/01-sharing-github/

0 Response to "How T Upload Jpyter Notevbok to Github"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel