|
1 |
| -# datalab |
| 1 | +# datalab [](https://travis-ci.org/googledatalab/pydatalab) [](https://pypi.python.org/pypi/datalab) |
2 | 2 |
|
3 |
| -Google datalab Python package. Used in [Google Cloud Datalab] |
4 |
| -(https://github.com/GoogleCloudPlatform/datalab) and can be used |
5 |
| -in [Jupyter Notebook](http://jupyter.org/). |
| 3 | +[Google Cloud Datalab](https://cloud.google.com/datalab/) Python package. Used in |
| 4 | +[Google Cloud Datalab](https://github.com/GoogleCloudPlatform/datalab) and can |
| 5 | +be used in [Jupyter Notebook](http://jupyter.org/). |
6 | 6 |
|
7 |
| -This adds a number of Python modules such as datalab.bigquery, |
8 |
| -datalab.storage, etc, for accessing [Google Cloud Platform services] |
9 |
| -(https://cloud.google.com/) as well as adding some new cell magics such as `%chart`, |
10 |
| -`%bigquery`, `%storage`, etc. |
| 7 | +This adds a number of Python modules such as `google.datalab.bigquery`, |
| 8 | +`google.datalab.storage`, etc, for accessing |
| 9 | +[Google Cloud Platform services](https://cloud.google.com/) as well as adding |
| 10 | +some new cell magics such as `%chart`, `%bigquery`, `%storage`, etc. |
11 | 11 |
|
12 |
| -See [https://github.com/googledatalab/notebooks](https://github.com/googledatalab/notebooks) |
| 12 | +See |
| 13 | +[https://github.com/googledatalab/notebooks](https://github.com/googledatalab/notebooks) |
13 | 14 | for samples of using this package.
|
14 | 15 |
|
15 |
| -## Prerequisites |
16 |
| - |
17 |
| -You will need the [Typscript compiler](https://www.typescriptlang.org/) installed. |
18 |
| -In future we should be installable from PyPI. |
19 |
| - |
20 | 16 | ## Installation
|
21 | 17 |
|
22 |
| -First: |
| 18 | +This package is available on PyPI as `datalab`: |
23 | 19 |
|
24 |
| - git clone https://github.com/googledatalab/pydatalab.git |
25 |
| - cd pydatalab |
| 20 | + pip install datalab |
26 | 21 |
|
27 |
| -Then do one of the folowing: |
| 22 | +## Using in Jupyter |
28 | 23 |
|
29 |
| - ./install-virtualenv.sh # For use in Python virtual environments |
30 |
| - ./install-no-virtualenv.sh # For installing in a non-virtual environment |
| 24 | +After datalab installation, enable datalab's frontend in Jupyter by running: |
31 | 25 |
|
32 |
| -You can ignore the message about running `jupyter nbextension enable`; it is not required. |
| 26 | + jupyter nbextension install --py datalab.notebook --sys-prefix |
33 | 27 |
|
34 |
| -## Using in Jupyter |
| 28 | +See further details [Jupyter Kernel and Notebook Extensions](https://github.com/googledatalab/pydatalab/wiki/Jupyter-Kernel-and-Notebook-Extensions). |
35 | 29 |
|
36 |
| -In a notebook cell, enable with: |
| 30 | +Then in a notebook cell, enable datalab's magics with: |
37 | 31 |
|
38 |
| - %load_ext datalab.kernel |
| 32 | + %load_ext google.datalab.kernel |
| 33 | + |
| 34 | +(Note: If you hit an error "module traceback cannot be imported", try setting the following environment variable: CLOUDSDK_PYTHON_SITEPACKAGES=1) |
39 | 35 |
|
40 | 36 | Alternatively add this to your `ipython_config.py` file in your profile:
|
41 | 37 |
|
42 | 38 | c = get_config()
|
43 | 39 | c.InteractiveShellApp.extensions = [
|
44 |
| - 'datalab.kernel' |
| 40 | + 'google.datalab.kernel' |
45 | 41 | ]
|
46 | 42 |
|
47 |
| -You will typically put this under `~/.ipython/profile_default`. |
48 |
| -See [http://ipython.readthedocs.io/en/stable/development/config.html] |
49 |
| -(http://ipython.readthedocs.io/en/stable/development/config.html) |
| 43 | +You will typically put this under `~/.ipython/profile_default`. See |
| 44 | +[the IPython docs](http://ipython.readthedocs.io/en/stable/development/config.html) |
50 | 45 | for more about IPython profiles.
|
51 | 46 |
|
52 |
| -If you want to access Google Cloud Platform services such as BigQuery, |
53 |
| -you will also need to install [gcloud] |
54 |
| -(https://cloud.google.com/sdk/gcloud). You will need to use gcloud |
55 |
| -to authenticate; e.g. with: |
| 47 | +If you want to access Google Cloud Platform services such as BigQuery, you |
| 48 | +will also need to install [gcloud](https://cloud.google.com/sdk/gcloud). You |
| 49 | +will need to use `gcloud` to authenticate; e.g. with: |
56 | 50 |
|
57 | 51 | gcloud auth login
|
58 | 52 |
|
59 | 53 | You will also need to set the project ID to use; either set a `PROJECT_ID`
|
60 |
| -environment variable to the project name, or call `set_datalab_project_id(name)` |
61 |
| -from within your notebook. |
| 54 | +environment variable to the project name, or call |
| 55 | +`set_datalab_project_id(name)` from within your notebook. |
62 | 56 |
|
63 | 57 | ## Documentation
|
64 |
| -You can read the Sphinx generated docs at: [http://googledatalab.github.io/pydatalab/](http://googledatalab.github.io/pydatalab/) |
| 58 | + |
| 59 | +You can read the Sphinx generated docs at: |
| 60 | +[http://googledatalab.github.io/pydatalab/](http://googledatalab.github.io/pydatalab/) |
| 61 | + |
| 62 | +## Development installation |
| 63 | + |
| 64 | +If you'd like to work on the package, it's useful to be able to install from |
| 65 | +source. You will need the |
| 66 | +[Typescript compiler](https://www.typescriptlang.org/) installed. |
| 67 | + |
| 68 | +First: |
| 69 | + |
| 70 | + git clone https://github.com/googledatalab/pydatalab.git |
| 71 | + cd pydatalab |
| 72 | + |
| 73 | +Then do one of the folowing: |
| 74 | + |
| 75 | + ./install-virtualenv.sh # For use in Python virtual environments |
| 76 | + ./install-no-virtualenv.sh # For installing in a non-virtual environment |
| 77 | + |
| 78 | +You can ignore the message about running `jupyter nbextension enable`; it is |
| 79 | +not required. |
| 80 | + |
0 commit comments