Skip to content

Commit 5e783fd

Browse files
committed
Streamline jupyter setup and checks
1 parent 756a487 commit 5e783fd

File tree

8 files changed

+114
-111
lines changed

8 files changed

+114
-111
lines changed

_partials/es/nbextensions.md

Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,12 @@
1-
## Mejora `jupyter` notebook y chequeo
2-
3-
### CSS personalizado
1+
## Mejora `jupyter` notebook
42

53
Mejora la visualización del [elemento `details` para revelación de información](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) en tus notebooks.
64

7-
Abre `custom/custom.css` en el directorio config:
8-
```bash
9-
cd $(jupyter --config-dir)
10-
mkdir -p custom
11-
touch custom/custom.css
12-
<CODE_EDITOR_CMD> custom/custom.css
13-
```
14-
Edita `custom.css` con la siguiente información:
15-
16-
```css
17-
summary {
18-
cursor: pointer;
19-
display:list-item;
20-
}
21-
summary::marker {
22-
font-size: 1em;
23-
}
24-
```
25-
26-
Puedes cerrar <CODE_EDITOR>.
27-
28-
### Chequeo de `jupyter`
29-
30-
Reinicia tu terminal:
31-
32-
```bash
33-
exec zsh
34-
```
35-
36-
Ahora verifica que puedas iniciar un servidor de notebook en tu máquina:
5+
Ejecuta las siguientes líneas para crear una hoja de estilos `custom.css` en tu directorio de configuración de Jupyter:
376

387
```bash
39-
jupyter notebook
8+
LOCATION=$(jupyter --config-dir)/custom
9+
SOURCE=https://raw.githubusercontent.com/lewagon/data-setup/refs/heads/master/specs/jupyter/custom.css
10+
mkdir -p $LOCATION
11+
curl $SOURCE > $LOCATION/custom.css
4012
```
41-
42-
Tu navegador web debería abrir en una ventana `jupyter`:
43-
44-
![jupyter.png](images/jupyter.png)
45-
46-
Haz clic en `New`:
47-
48-
![jupyter_new.png](images/jupyter_new.png)
49-
50-
Debería abrirse una pestaña en un nuevo notebook:
51-
52-
![jupyter_notebook.png](images/jupyter_notebook.png)
53-
54-
### Chequeo de `nbextensions`
55-
56-
Haz una revisión de las `jupyter notebooks nbextensions`. Haz clic en `Nbextensions`:
57-
58-
![jupyter_nbextensions.png](images/jupyter_nbextensions.png)
59-
60-
Deselecciona _"disable configuration for nbextensions without explicit compatibility"_. Esto significa deshabilitar la configuración de nbextensions sin compatibilidad explícita. Luego verifica que _al menos_ las `nbextensions` marcadas en rojo estén habilitadas:
61-
62-
![nbextensions.png](images/nbextensions.png)
63-
64-
Puedes cerrar tu navegador web y luego cerrar el servidor jupyter con `CTRL` + `C`.

_partials/es/python_checkup.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
### Chqueo de la configuración de Python
22

3+
Reinicia tu terminal:
4+
5+
```bash
6+
cd ~/code && exec zsh
7+
```
8+
39
Verifica tu versión de Python con los siguientes comandos:
410
```bash
511
zsh -c "$(curl -fsSL <PYTHON_CHECKER_URL>)" <PYTHON_VERSION>
@@ -15,17 +21,31 @@ Ahora ejecuta el siguiente comando para verificar que puedas cargar estos paquet
1521
python -c "$(curl -fsSL <PIP_LOADER_URL>)"
1622
```
1723

18-
Asegúrate de que puedas usar Jupyter:
24+
Ahora verifica que puedas iniciar un servidor de notebook en tu máquina:
1925

2026
```bash
2127
jupyter notebook
2228
```
2329

24-
Y abre un notebook `Python 3`.
30+
Tu navegador web debería abrir en una ventana `jupyter`:
31+
32+
![jupyter.png](images/jupyter.png)
33+
34+
Haz clic en `New` y, en el menú desplegable, selecciona Python 3 (ipykernel):
35+
36+
![jupyter_new.png](images/jupyter_new.png)
37+
38+
Debería abrirse una pestaña en un nuevo notebook:
39+
40+
![jupyter_notebook.png](images/jupyter_notebook.png)
2541

2642
Asegúrate de que estés usando la versión correcta de python en el notebook. Abre una celda y ejecuta lo siguiente:
2743
``` python
2844
import sys; sys.version
2945
```
3046

47+
Debería mostrar <PYTHON_VERSION> seguido de algunos detalles adicionales. Si no es así, consulta con un TA.
48+
49+
Puedes cerrar tu navegador web y luego cerrar el servidor jupyter con `CTRL` + `C`.
50+
3151
¡Listo! Ya tienes un virtual env de python completo con todos los paquetes tercerizados que necesitarás en el bootcamp.

_partials/nbextensions.md

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,12 @@
1-
## `jupyter` notebook tweaking and check up
1+
## `jupyter` notebook tweaking
22

3-
### Custom CSS
3+
Let's improve the display of the [`details` disclosure elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) in your notebooks.
44

5-
Improve the display of the [`details` disclosure elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) in your notebooks.
5+
Run the following lines to create a `custom.css` stylesheet in your Jupyter config directory:
66

7-
Open `custom/custom.css` in the config directory:
87
```bash
9-
cd $(jupyter --config-dir)
10-
mkdir -p custom
11-
touch custom/custom.css
12-
<CODE_EDITOR_CMD> custom/custom.css
8+
LOCATION=$(jupyter --config-dir)/custom
9+
SOURCE=https://raw.githubusercontent.com/lewagon/data-setup/refs/heads/master/specs/jupyter/custom.css
10+
mkdir -p $LOCATION
11+
curl $SOURCE > $LOCATION/custom.css
1312
```
14-
Edit `custom.css` with:
15-
16-
```css
17-
summary {
18-
cursor: pointer;
19-
display:list-item;
20-
}
21-
summary::marker {
22-
font-size: 1em;
23-
}
24-
```
25-
26-
You can close <CODE_EDITOR>.
27-
28-
### `jupyter` check up
29-
30-
Let's reset your terminal:
31-
32-
```bash
33-
exec zsh
34-
```
35-
36-
Now, check you can launch a notebook server on your machine:
37-
38-
```bash
39-
jupyter notebook
40-
```
41-
42-
Your web browser should open on a `jupyter` window:
43-
44-
![jupyter.png](images/jupyter.png)
45-
46-
Click on `New`:
47-
48-
![jupyter_new.png](images/jupyter_new.png)
49-
50-
A tab should open on a new notebook:
51-
52-
![jupyter_notebook.png](images/jupyter_notebook.png)
53-
54-
You can close your web browser then terminate the jupyter server with `CTRL` + `C`.

_partials/python_checkup.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
### Python setup check up
22

3+
Let's reset your terminal:
4+
5+
```bash
6+
cd ~/code && exec zsh
7+
```
8+
39
Check your Python version with the following commands:
410
```bash
511
zsh -c "$(curl -fsSL <PYTHON_CHECKER_URL>)" <PYTHON_VERSION>
@@ -21,11 +27,25 @@ Make sure you can run Jupyter:
2127
jupyter notebook
2228
```
2329

24-
And open a `Python 3` notebook.
30+
Your web browser should open on a `jupyter` window:
31+
32+
![jupyter.png](images/jupyter.png)
33+
34+
Click on `New` and in the dropdown menu select `Python 3 (ipykernel)`:
2535

26-
Make sure that you are running the correct python version in the notebook. Open a cell and run :
36+
![jupyter_new.png](images/jupyter_new.png)
37+
38+
A tab should open on a new notebook:
39+
40+
![jupyter_notebook.png](images/jupyter_notebook.png)
41+
42+
Make sure that you are running the correct python version in the notebook. Open a cell and run:
2743
``` python
2844
import sys; sys.version
2945
```
3046

47+
It should output `<PYTHON_VERSION>` followed by some more details. If not, check with a TA.
48+
49+
You can close your web browser then terminate the jupyter server with `CTRL` + `C`.
50+
3151
Here you have it! A complete python virtual env with all the third-party packages you'll need for the whole bootcamp.

images/jupyter.png

-30 KB
Loading

images/jupyter_new.png

-1.72 KB
Loading

images/jupyter_notebook.png

-34.6 KB
Loading

specs/jupyter/custom.css

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* Custom CSS for Jupyter Notebook
2+
3+
Should go into ~/.jupyter/custom/custom.css
4+
5+
Only impacts the Jupyter Notebook interface, not VS Code for example
6+
*/
7+
8+
9+
/* Prettify disclosure elements used for hints and solutions
10+
- Use same color as cell editor background
11+
- Add padding and margin to make it look like a card
12+
- Make the summary element bold
13+
- Add a marker to the summary element
14+
*/
15+
16+
details {
17+
padding: 5px 10px 5px;
18+
margin-bottom: 1em;
19+
}
20+
21+
details[open]{
22+
}
23+
24+
body[data-jp-theme-light=true] details {
25+
background-color: var(--jp-cell-editor-background);
26+
}
27+
28+
body[data-jp-theme-light=false] details {
29+
background-color: var(--jp-cell-editor-background);
30+
}
31+
32+
summary {
33+
cursor: pointer;
34+
display: list-item;
35+
font-weight: bold;
36+
background-color: var(--jp-cell-editor-background);
37+
}
38+
39+
summary::marker {
40+
font-size: 1em;
41+
}
42+
43+
details > p {
44+
margin-top: 5px !important;
45+
margin-bottom: 0 !important;
46+
}
47+
48+
/* Reference for future use
49+
*/
50+
51+
body[data-jp-theme-light=true] .jp-InputArea-editor {
52+
/* To change code and markdown input cells in light mode */
53+
}
54+
55+
body[data-jp-theme-light=false] .jp-InputArea-editor {
56+
/* To change code and markdown input cells in dark mode */
57+
}

0 commit comments

Comments
 (0)