Skip to content

Commit 32ee305

Browse files
1 parent 5c4b2bc commit 32ee305

14 files changed

+8762
-0
lines changed

img/jupyterlab.png

498 KB
Loading

jupyter/.dockerignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
**/__pycache__
2+
**/.classpath
3+
**/.dockerignore
4+
**/.DS_Store
5+
**/.editorconfig
6+
**/.env
7+
**/.git
8+
**/.github
9+
**/.gitignore
10+
**/.project
11+
**/.settings
12+
**/.toolstarget
13+
**/.vs
14+
**/.vscode
15+
**/*.*proj.user
16+
**/*.dbmdl
17+
**/*.jfm
18+
**/*.py#
19+
**/*.py~
20+
**/*.pyc
21+
**/azds.yaml
22+
**/bin
23+
**/charts
24+
**/compose*
25+
**/csv
26+
**/django
27+
**/docker-compose*
28+
**/Dockerfile*
29+
**/img
30+
**/node_modules
31+
**/npm-debug.log
32+
**/obj
33+
**/README.md
34+
**/secrets.dev.yaml
35+
**/terraform
36+
**/values.dev.yaml

jupyter/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
JUPYTER_TOKEN=docker
2+
PORT=8888

jupyter/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM jupyter/minimal-notebook:latest
2+
3+
# Keeps Python from generating .pyc files in the container
4+
ENV PYTHONDONTWRITEBYTECODE=1
5+
6+
# Turns off buffering for easier container logging
7+
ENV PYTHONUNBUFFERED=1
8+
9+
USER jovyan
10+
11+
COPY . $HOME/work
12+
13+
WORKDIR $HOME/work
14+
15+
RUN conda install \
16+
xarray \
17+
netCDF4 \
18+
bottleneck \
19+
numpy \
20+
pandas \
21+
matplotlib \
22+
jupyterlab
23+
24+
# ENTRYPOINT ["python", "main.py"]
25+
CMD ["/bin/bash", "startup.sh"]
26+
# CMD ["/bin/bash"]

jupyter/README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# wine_quality
2+
3+
![JupyterLab](../img/jupyterlab.png)
4+
5+
## Summary
6+
Udacity course on data science.
7+
8+
**Table of Contents**
9+
* [wine_quality](#wine_quality)
10+
* [Summary](#summary)
11+
* [Setup](#setup)
12+
* [Usage](#usage)
13+
* [Poetry](#poetry)
14+
* [Docker](#docker)
15+
* [Both](#both)
16+
* [TODO](#todo)
17+
* [Further Reading](#further-reading)
18+
19+
## Setup
20+
* Install
21+
* [editorconfig](https://editorconfig.org/)
22+
* [asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf)
23+
* [poetry](https://python-poetry.org/docs/)
24+
* [docker](https://docs.docker.com/compose/install/)
25+
* Download CSVs from [here](https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/)
26+
* Move to `csv` directory
27+
28+
## Usage
29+
### Poetry
30+
* Install requirements via Poetry:
31+
```bash
32+
poetry install
33+
poetry run ipython kernel install --name "python3.10.7" --user
34+
```
35+
* Run Jupyter Lab
36+
```bash
37+
poetry shell
38+
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser
39+
```
40+
* Quit the server via `ctrl-c` in the terminal
41+
* Enter `deactivate` to exit the Poetry virtual environment
42+
43+
### Docker
44+
* Customize the `.env.example` and rename to `.env`
45+
* General commands
46+
```bash
47+
# build image locally
48+
docker-compose build --pull --no-cache
49+
50+
# start container
51+
docker-compose up -d
52+
53+
# stop container
54+
docker-compose stop
55+
56+
# remove container and network
57+
docker-compose down
58+
```
59+
60+
### Both
61+
* Open a browser and navigate to `http://127.0.0.1:8888`
62+
* Docker uses the token specified in `.env`
63+
* Select the "python3.10.7" kernel if asked
64+
* Open `refactor-wine-quality.ipynb` from the left-hand column
65+
* Run cells by selecting them and pressing `shift-enter`
66+
67+
## TODO
68+
* Get Jupyter working in [VSCode](https://github.com/microsoft/vscode-jupyter)
69+
* `Makefile`
70+
71+
## Further Reading
72+
[Original Repo](https://github.com/pythoninthegrass/wine_quality)
73+
74+
[Starting JupyterLab](https://jupyterlab.readthedocs.io/en/stable/getting_started/starting.html)
75+
76+
[Jupyter Docker Stacks — Docker Stacks documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html)
77+
78+
[Dockerizing Jupyter Projects](https://towardsdatascience.com/dockerizing-jupyter-projects-39aad547484a)

0 commit comments

Comments
 (0)