Skip to content

Commit 040d1de

Browse files
committed
Add install instructions.
1 parent 014ec97 commit 040d1de

File tree

2 files changed

+81
-13
lines changed

2 files changed

+81
-13
lines changed

README.md

Lines changed: 77 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,90 @@
1-
# jupyterlab-github
1+
# Jupyterlab GitHub
2+
3+
A JupyterLab extension for accessing GitHub repositories.
4+
5+
### What this extension is
6+
7+
When you install this extension, an additional filebrowser tab will be added
8+
to the left area of JupyterLab. This filebrowser allows you to select GitHub
9+
organizations and users, browse their repositories, and open the files in those
10+
repositories. If those files are notebooks, you can run them just as you would
11+
any other notebook. You can also attach a kernel to text files and run those.
12+
Basically, you should be able to open any file in a repository that JupyterLab can handle.
13+
14+
### What this extension is not
15+
16+
This is not an extension that provides full GitHub access, such as
17+
saving files, making commits, forking repositories, etc.
18+
For it to be so, it would need to more-or-less reinvent the GitHub website,
19+
which represents a huge increase in complexity for the extension.
20+
21+
### A note on rate-limiting
22+
23+
This extension has both a client-side component (that is, Javascript that is bundled
24+
with JupyterLab), and a server-side component (that is, Python code that is added
25+
to the Jupyter notebook server). This extension *will* work with out the server extension,
26+
with a major caveat: when making unauthenticated requests to GitHub
27+
(as we must do to get repository data), GitHub imposes fairly strict rate-limits
28+
on how many requests we can make. As such, you are likely to hit that limit
29+
within a few minutes of work. You will then have to wait up to an hour to regain access.
30+
31+
For that reason, we recommend that you take the time and effort to set up the server
32+
extension as well as the lab extension, which will allow you to access higher rate-limits.
33+
This process is described in the [installation](#Installation) section.
234

335
## Prerequisites
436

5-
* JupyterLab 0.27.0
37+
* JupyterLab 0.28
38+
* A GitHub account for the serverextension
639

740
## Installation
841

9-
For a development install, do the following in the repository directory:
42+
As discussed above, this extension has both a serverextension and a labextension.
43+
We recommend installing both so as to not be rate-limited.
44+
The purpose of the serverextension is to add GitHub credentials that you will need to acquire
45+
from https://github.com/settings/developers, and then to proxy your request to GitHub.
46+
47+
### 1. Installing the labextension
1048

49+
To install the labextension, enter the following in your terminal:
1150
```bash
12-
npm install
13-
npm run build
14-
jupyter labextension link .
51+
jupyter labextension install @jupyterlab/github
1552
```
53+
With only this installed, the extension should work, and you can experience the joys of
54+
being rate-limited first-hand!
55+
56+
### 2. Getting your credentials from GitHub
57+
58+
You will need to register an OAuth application with GitHub by following these steps:
59+
1. Log into your GitHub account.
60+
1. Go to https://github.com/settings/developers and select the "OAuth Apps" tab on the left.
61+
1. Click the "New OAuth App" button.
62+
1. Fill out a name, homepage URL, description, and callback URL in the form.
63+
This extension does not actually use OAuth, so these values actually *do not matter much*,
64+
you just need to enter them to register the application.
65+
1. Click the "Register application" button.
66+
1. You should be taken to a new page with the new application information.
67+
If you see fields showing "Client ID" and "Client Secret", congratulations!
68+
These are the strings we need, and you have successfuly set up the application.
1669

17-
To rebuild the package and the JupyterLab app after making changes:
70+
It is important to note that the "Client Secret" string is, as the name suggests, a secret.
71+
*Do not* share this value online, as people may be able to use it to impersonate you on GitHub.
1872

73+
### 3. Installing the serverextension
74+
75+
Install the serverextension using pip, and then enable it:
1976
```bash
20-
npm run build
21-
jupyter lab build
77+
pip install jupyterlab_github
78+
jupyter serverextension enable --sys-prefix --py jupyterlab_github
79+
```
80+
You then need to add our "Client ID" and "Client Secret" credentials from above
81+
to your notebook configuration file. Instructions for generating a configuration
82+
file can be found [here](http://jupyter-notebook.readthedocs.io/en/stable/config_overview.html#configure-nbserver)
83+
Once you have identified this file, add the following lines to it:
84+
```python
85+
c.GitHubConfig.client_id = '< YOUR_CLIENT_ID >'
86+
c.GitHubConfig.client_secret = '< YOUR_CLIENT_SECRET >'
2287
```
88+
where "`< YOUR_CLIENT_ID >`" and "`< YOUR_CLIENT_SECRET >`" are the string values you obtained above.
89+
90+
With this, you should be done! Launch JupyterLab and look for the GitHub tab on the left!

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "jupyterlab-github",
2+
"name": "@jupyterlab/github",
33
"version": "0.1.0",
44
"description": "JupyterLab viewer for GitHub repositories",
55
"author": "Ian Rose",
@@ -46,11 +46,11 @@
4646
},
4747
"repository": {
4848
"type": "git",
49-
"url": "https://github.com/ian-r-rose/jupyterlab-github.git"
49+
"url": "https://github.com/jupyterlab/jupyterlab-github.git"
5050
},
5151
"license": "BSD-3-Clause",
5252
"bugs": {
53-
"url": "https://github.com/ian-r-rose/jupyterlab-github/issues"
53+
"url": "https://github.com/jupyterlab/jupyterlab-github/issues"
5454
},
55-
"homepage": "https://github.com/ian-r-rose/jupyterlab-github"
55+
"homepage": "https://github.com/jupyterlab/jupyterlab-github"
5656
}

0 commit comments

Comments
 (0)