Skip to content

Commit 97c03b8

Browse files
committed
feat: Quarto Workshop - First version
0 parents  commit 97c03b8

File tree

203 files changed

+42160
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+42160
-0
lines changed

.Rprofile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
source("renv/activate.R")
2+
3+
if (!nzchar(Sys.getenv("CI"))) {
4+
message(R.version.string)
5+
message("Config '~/.Rprofile' was loaded!")
6+
Sys.setenv(CHROMOTE_CHROME = "/Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser")
7+
options(width = 150, menu.graphics = FALSE)
8+
}
9+
10+
options(
11+
webshot.quiet = TRUE,
12+
renv.config.pak.enabled = FALSE,
13+
renv.config.cache.enabled = !nzchar(Sys.getenv("CI"))
14+
)

.air.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[format]
2+
line-width = 120
3+
indent-width = 2
4+
indent-style = "space"
5+
line-ending = "lf"

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Quarto Workshop Environment",
3+
"image": "ghcr.io/mcanouil/quarto-codespaces:1.8",
4+
"remoteUser": "vscode",
5+
"customizations": {
6+
"vscode": {
7+
"extensions": [
8+
"quarto.quarto",
9+
"mcanouil.quarto-wizard",
10+
"REditorSupport.r",
11+
"ms-python.python",
12+
"julialang.language-julia",
13+
"ms-python.black-formatter",
14+
"ms-python.flake8",
15+
"ms-python.vscode-pylance",
16+
"ms-python.pylint",
17+
"ms-python.isort",
18+
"ms-toolsai.jupyter",
19+
"Posit.air-vscode"
20+
],
21+
"settings": {
22+
"r.rterm.option": ["--no-save", "--no-restore-data", "--quiet"],
23+
"r.useRenvLibPath": true,
24+
"[r]": {
25+
"editor.defaultFormatter": "Posit.air-vscode",
26+
"editor.formatOnSave": true
27+
}
28+
}
29+
}
30+
}
31+
}

.devcontainer/setup.sh

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/usr/bin/env bash
2+
3+
show_help() {
4+
echo "Usage: $0 [--what/-w all|r|python|julia] [--force/-f] [--help/-h]"
5+
echo " --what/-w: Specify what to initialise (default: all)."
6+
echo " all: Initialise R (renv), Python (uv), and Julia (project)."
7+
echo " r: Initialise R (renv)."
8+
echo " python: Initialise Python (uv)."
9+
echo " julia: Initialise Julia (project)."
10+
echo " --force/-f: Force initialisation regardless of existing files."
11+
echo " --help/-h: Show this help message."
12+
}
13+
14+
initialise_r() {
15+
if [ "$FORCE" = true ] || [ ! -f "renv.lock" ]; then
16+
if grep -q 'source("renv/activate.R")' .Rprofile; then
17+
sed -i '' '/source("renv\/activate.R")/d' .Rprofile
18+
fi
19+
Rscript -e 'renv::init(bare = FALSE)'
20+
Rscript -e 'renv::install(c("rmarkdown", "prompt", "languageserver", "lintr", "styler", "cli"))'
21+
Rscript -e 'renv::snapshot(type = "all")'
22+
fi
23+
}
24+
25+
initialise_python() {
26+
if [ "$FORCE" = true ] || [ ! -f "requirements.txt" ]; then
27+
python3 -m venv .venv
28+
source .venv/bin/activate
29+
python3 -m pip install jupyter papermill
30+
python3 -m pip freeze > requirements.txt
31+
fi
32+
}
33+
34+
initialise_uv() {
35+
if [ "$FORCE" = true ] || [ ! -f "uv.lock" ]; then
36+
uv init --no-package --vcs none --bare --no-readme --author-from none
37+
uv venv
38+
source .venv/bin/activate
39+
uv add jupyter papermill
40+
uv sync
41+
fi
42+
}
43+
44+
initialise_julia() {
45+
if [ "$FORCE" = true ] || [ ! -f "Project.toml" ]; then
46+
julia -e 'using Pkg; Pkg.activate("."); Pkg.instantiate()'
47+
julia --project=. -e 'using Pkg; Pkg.add("IJulia")'
48+
fi
49+
}
50+
51+
WHAT="all"
52+
FORCE=false
53+
54+
while [[ "$#" -gt 0 ]]; do
55+
case $1 in
56+
--what|-w)
57+
WHAT="$2"
58+
shift
59+
;;
60+
--force|-f)
61+
FORCE=true
62+
;;
63+
--help|-h)
64+
show_help
65+
exit 0
66+
;;
67+
*)
68+
echo "Unknown parameter passed: $1"
69+
show_help
70+
exit 1
71+
;;
72+
esac
73+
shift
74+
done
75+
76+
case $WHAT in
77+
all)
78+
initialise_r
79+
initialise_uv
80+
initialise_julia
81+
;;
82+
r)
83+
initialise_r
84+
;;
85+
python)
86+
initialise_uv
87+
;;
88+
julia)
89+
initialise_julia
90+
;;
91+
*)
92+
echo "Unknown option for --what: $WHAT"
93+
show_help
94+
exit 1
95+
;;
96+
esac

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: mcanouil # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "monthly"
12+
labels:
13+
- "Type: Dependencies :arrow_up:"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Quarto Extensions Updates
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: 00 12 1 * *
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
quarto-extensions-updates:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
steps:
19+
- uses: actions/checkout@v6
20+
21+
- name: Create GitHub App token
22+
uses: actions/create-github-app-token@v2
23+
id: app-token
24+
with:
25+
app-id: ${{ vars.APP_ID }}
26+
private-key: ${{ secrets.APP_KEY }}
27+
28+
- name: Get GitHub App User ID
29+
id: get-user-id
30+
if: ${{ steps.app-token.outputs.app-slug != '' }}
31+
env:
32+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
33+
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
34+
run: |
35+
echo "user-id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id)" >> "${GITHUB_OUTPUT}"
36+
37+
- name: Configure Environment for Git User
38+
env:
39+
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
40+
USER_ID: ${{ steps.get-user-id.outputs.user-id }}
41+
run: |
42+
if [ -z "${APP_SLUG}" ]; then
43+
USER_NAME="github-actions[bot]"
44+
USER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com"
45+
else
46+
USER_NAME="${APP_SLUG}[bot]"
47+
USER_EMAIL="${USER_ID}+${APP_SLUG}[bot]@users.noreply.github.com"
48+
fi
49+
git config --global user.name "${USER_NAME}"
50+
git config --global user.email "${USER_EMAIL}"
51+
52+
- name: Setup Quarto
53+
uses: quarto-dev/quarto-actions/setup@v2
54+
55+
- name: Update Quarto extensions
56+
uses: mcanouil/quarto-extensions-updater@v2
57+
with:
58+
github-token: ${{ steps.app-token.outputs.token }}
59+
pr-labels: "Type: Dependencies :arrow_up:"

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy Workshop to GitHub Pages
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
id-token: write
9+
pages: write
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
15+
container:
16+
image: ghcr.io/mcanouil/quarto-codespaces:prerelease
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
env:
23+
QUARTO_CHROMIUM: "/usr/bin/google-chrome-stable"
24+
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v6
32+
33+
- name: Restore dependencies
34+
shell: bash
35+
run: |
36+
Rscript -e 'renv::restore()'
37+
uv sync
38+
39+
- name: Render Quarto Project
40+
shell: bash
41+
run: |
42+
uv run quarto render
43+
44+
- name: Configure GitHub Pages
45+
uses: actions/configure-pages@v5
46+
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v4
49+
with:
50+
path: "_site"
51+
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.quarto/
2+
**/*.quarto_ipynb
3+
_site/
4+
/.luarc.json
5+
.Rbuildignore
6+
_freeze/
7+
exercises/

CITATION.cff

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cff-version: 1.2.0
2+
title: "Mastering Quarto CLI: From Authoring to Publishing"
3+
type: workshop
4+
message: "If you use this project, please cite it as below."
5+
authors:
6+
- family-names: "Canouil"
7+
given-names: "Mickaël"
8+
orcid: "https://orcid.org/0000-0002-3396-4549"
9+
date-released: "2025-04-06"
10+
version: 2025.04.06
11+
url: "http://m.canouil.dev/mastering-quarto-cli/"
12+
repository-code: "https://github.com/mcanouil/mastering-quarto-cli"
13+
license: "CC BY-NC-SA 4.0"

0 commit comments

Comments
 (0)