Skip to content

Commit 97676f5

Browse files
authored
Du style pour le site (#434)
* style banniere * introductions * update quarto * fichier des contributeurs * conditionne pipeline * test fork
1 parent d7d8a50 commit 97676f5

File tree

9 files changed

+146
-25
lines changed

9 files changed

+146
-25
lines changed

.github/workflows/netlify-test.yaml

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches:
66
- main
77
- master
8-
- dev
98

109
jobs:
1110
pages:
@@ -49,14 +48,6 @@ jobs:
4948
npm install --unsafe-perm=true netlify-cli -g
5049
netlify init
5150
netlify deploy --alias=${BRANCHE_REF} --dir="_site" --message "Preview deploy from ${BRANCHE_REF}"
52-
- uses: actions/upload-artifact@v2
53-
with:
54-
name: Content
55-
path: content/
56-
- uses: actions/upload-artifact@v2
57-
with:
58-
name: Website
59-
path: public/
6051
enonces:
6152
name: Render notebooks
6253
runs-on: ubuntu-latest
@@ -88,19 +79,8 @@ jobs:
8879
quarto render content --to ipynb --execute -M echo:true
8980
mkdir -p temp_notebooks/corrections
9081
python build/move_files.py temp_notebooks/corrections
91-
- uses: actions/upload-artifact@v2
92-
with:
93-
name: Source enonce
94-
path: content/
95-
- uses: actions/upload-artifact@v2
96-
with:
97-
name: Enonces
98-
path: temp_notebooks/notebooks/
99-
- uses: actions/upload-artifact@v2
100-
with:
101-
name: Enonces
102-
path: temp_notebooks/corrections/
10382
- name: Pushes to another repository
83+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
10484
uses: linogaliana/github-action-push-to-another-repository@main
10585
env:
10686
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
@@ -114,6 +94,3 @@ jobs:
11494
create-target-branch-if-needed: true
11595
reset-repo: true
11696

117-
118-
119-

.github/workflows/notebooks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
name: Render notebooks
1212
runs-on: ubuntu-latest
1313
container: linogaliana/python-datascientist:latest
14+
if: ${{ !github.event.pull_request.head.repo.fork }}
1415
steps:
1516
- uses: actions/checkout@v3
1617
with:

.github/workflows/prod.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
name: Render-Blog
1212
runs-on: ubuntu-latest
1313
container: linogaliana/python-datascientist:latest
14+
if: ${{ !github.event.pull_request.head.repo.fork }}
1415
steps:
1516
- uses: actions/checkout@v2
1617
with:

CONTRIBUTING.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contribuer aux supports
2+
3+
## Fonctionnement du dépôt
4+
5+
Le site web et les notebooks sont construits à partir de `Quarto`. Le site
6+
web est le format par défaut, les _notebooks_ sont construits par
7+
intégration continue.
8+
9+
En supposant que l'environnement `Python` est fonctionnel (cf. ci-dessous),
10+
le site web dans son ensemble peut être construit avec la commande
11+
suivante
12+
13+
```shell
14+
# pour les utilisateurs du sspcloud
15+
quarto preview --port 5000 --host 0.0.0.0
16+
17+
# hors du sspcloud
18+
quarto preview
19+
```
20+
21+
Pour ne faire un _render_ que d'une fiche, il est possible de modifier à la main
22+
la section `render` du
23+
fichier `_quarto.yml`. Supprimer la liste des fichiers sauf les `**/introductions.qmd`
24+
et la fiche désirée.
25+
N'oubliez pas de restaurer la version d'origine
26+
du `quarto.yml` avant de faire la _pull request_ !
27+
28+
Pour visualiser le _notebook_ qui sera généré à l'issue des
29+
modifications, la commande à exécuter est la suivante:
30+
31+
```shell
32+
quarto render chemin_du_fichier/fichier.qmd --to ipynb
33+
```
34+
35+
puis ouvrir le `.ipynb` obtenu.
36+
37+
La correction peut être prévisualisée de la manière suivante:
38+
39+
```shell
40+
quarto render --execute -M echo:true
41+
```
42+
43+
puis ouvrir le `.ipynb` obtenu.
44+
45+
46+
__Aucun *output* ne doit être committé, seuls les fichiers sources `.qmd`__. Toutes les
47+
sorties (fichiers .png, .html, .ipynb, etc.) sont générées
48+
par le biais de scripts automatisés qui tournent à chaque
49+
_commit_ sur le dépôt `linogaliana/python-datascientist`.
50+
51+
52+
## Mise en place de l'environnement pour tester les exemples
53+
54+
Pour les contributeurs ayant un accès au SSP Cloud,
55+
ces commandes suffisent pour
56+
avoir l'environnement minimal nécessaire pour construire en local
57+
le site _web_.
58+
59+
```shell
60+
# Sur le SSPCloud
61+
pip install -r requirements.txt
62+
./requirements.sh
63+
```
64+
65+
Pour les contributeurs hors de cet environnement (dommage !),
66+
il est nécessaire en premier lieu d'avoir les éléments suivants:
67+
68+
- Une version récente de `Quarto`, _a minima_ la `1.3.450`.
69+
- `Jupyter` et un outil de gestion des environnements `Python` (`miniconda` par exemple).
70+
71+
L'installation de l'environnement minimal pour reproduire les exemples peut être
72+
fait sur la base d'un _trial and error_ en attendant la mise à disposition
73+
d'un fichier adéquat (`pip freeze` ne fournit pas un fichier satisfaisant)
74+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!-- source: https://github.com/gadenbuie/garrickadenbuie-com/blob/main/_partials/title-block-link-buttons/title-block.html -->
2+
<!-- source: https://raw.githubusercontent.com/spcanelon/silvia/32853dd0e70a71514b0922ee306f80ed5897f776/_partials/title-block-link-buttons/title-block.html -->
3+
<!--
4+
<header id="title-block-header" class="quarto-title-block default">
5+
<div class="quarto-title">
6+
-->
7+
<!-- <header id="title-block-header" class="quarto-title-block default page-columns"> -->
8+
<!-- <div class="quarto-title page-columns page-full featured-image p-4" style="background-image: url(featured.png), url(featured.jpg), url(../featured.jpg);"> -->
9+
<header id="title-block-header" class="quarto-title-block default page-columns">
10+
$if(image)$
11+
<div id="title-block-header-title" class="quarto-title page-columns page-full page-layout-full featured-image p-4" style="background-image: url($image$);">
12+
$endif$
13+
<h1 class="title">$title$</h1>
14+
$if(subtitle)$
15+
<p class="subtitle lead">$subtitle$</p>
16+
$endif$
17+
$if(categories)$
18+
$if(quarto-template-params.title-block-categories)$
19+
<div class="quarto-categories">
20+
$for(categories)$
21+
<div class="quarto-category">$categories$</div>
22+
$endfor$
23+
</div>
24+
$endif$
25+
$endif$
26+
</div>
27+
28+
$if(hide-description)$
29+
$elseif(description)$
30+
<div>
31+
<div id="title-block-title-desc" class="description pt-4">
32+
$description$
33+
</div>
34+
</div>
35+
$endif$
36+
37+
$title-metadata.html()$
38+
39+
$if(links)$
40+
<div class="mt-4 d-flex flex-row flex-wrap gap-1 justify-content-left justify-content-sm-start" role="group" aria-label="Links">
41+
$for(links)$
42+
<a href="$links.url$" class="btn btn-secondary text-capitalize"><i class="bi bi-$links.icon$ me-1"></i> $links.name$</a>
43+
$endfor$
44+
</div>
45+
$endif$
46+
47+
$if(path)$
48+
<div>$path$</div>
49+
$endif$
50+
51+
52+
</header>

_quarto.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,12 @@ format:
199199
- custom.scss
200200
css: styles.css
201201
toc: true
202+
code-overflow: wrap
203+
template-partials:
204+
- ../../_partials/title-block-link-buttons/title-block.html
202205
ipynb: default
203206

207+
204208
crossref:
205209
chapters: true
206210

content/manipulation/02a_pandas_tutorial.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ description: |
2424
(`DuckDB`, `Dask`, `Polars`, `Spark`...).
2525
bibliography: ../../reference.bib
2626
image: featured.png
27+
links:
28+
- icon: journal-text
29+
name: Documentation Pandas
30+
url: https://pandas.pydata.org/docs/
2731
---
2832

2933
Pour essayer les exemples présents dans ce tutoriel :

custom.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
color: white !important;
77
}
88

9+
// style background image on posts
10+
.featured-image {
11+
background-size: cover;
12+
background-position: center;
13+
color: white;
14+
box-shadow: inset 0 0 0 1000px rgba(0,38,66,0.75);
15+
}
16+
917
/* ---------------
1018
DETAILS
1119
----------------*/

requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
sudo apt-get update && \
4-
sudo apt install graphviz
4+
sudo apt install -y graphviz

0 commit comments

Comments
 (0)