From b615889a68ab224df2e91c289b93485a04a1347e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 16:33:59 +0200 Subject: [PATCH 01/37] add templating --- Gemfile | 4 ++++ Gemfile.lock | 26 ++++++++++++++++++++++++++ build.rb | 23 ++++++++++++++++++++--- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..ba8a2be1 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +gem "liquid" +gem "base64" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..4d67771b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,26 @@ +GEM + remote: https://rubygems.org/ + specs: + base64 (0.3.0) + bigdecimal (4.1.2) + liquid (5.12.0) + bigdecimal + strscan (>= 3.1.1) + strscan (3.1.8) + +PLATFORMS + arm64-darwin-24 + ruby + +DEPENDENCIES + base64 + liquid + +CHECKSUMS + base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b + bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd + liquid (5.12.0) sha256=5a3c2c2430cd925d21c53e4ed9abea52cd0a9da53b541422f81dee79aca2a673 + strscan (3.1.8) sha256=aae2db611a225559f21ffbb71765c9a4e60fd262534a9ea84f4f11c7f32f679e + +BUNDLED WITH + 4.0.10 diff --git a/build.rb b/build.rb index 7c1fb6be..4e5c747d 100755 --- a/build.rb +++ b/build.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -wU require 'open-uri' +require 'liquid' CONSTANTS = { 'PYTHON_VERSION' => '3.12.9', @@ -279,11 +280,23 @@ def load_partial(partial, locale) return content end +def partial_name(entry) + entry.is_a?(Array) ? entry[0] : entry +end + +def partial_vars(entry) + entry.is_a?(Array) ? entry[1] : {} +end + +def skipped?(entry) + partial_name(entry).start_with?("#") +end + # load partials (skip non-English locales for ENGLISH_ONLY configurations) pairs = FILENAMES.flat_map { |filename, (os_name, partials)| LOCALES.flat_map { |locale| next [] if !locale.empty? && ENGLISH_ONLY.include?(filename) - partials.reject { |s| s.start_with?("#") }.map { |partial| [partial, locale] } + partials.reject { |entry| skipped?(entry) }.map { |entry| [partial_name(entry), locale] } } }.uniq loaded = pairs.map { |partial, locale| ["#{partial}.#{locale}", load_partial(partial, locale)] }.to_h @@ -295,8 +308,8 @@ def load_partial(partial, locale) filename += ".#{locale}" unless locale.empty? filename += ".md" File.open(filename, "w:utf-8") do |f| - partials.reject { |s| s.start_with?("#") }.each do |partial| - content = loaded["#{partial}.#{locale}"].clone + partials.reject { |entry| skipped?(entry) }.each do |entry| + content = loaded["#{partial_name(entry)}.#{locale}"].clone # remove the OS dependant blocks removed_blocks = DELIMITERS.keys - [os_name] removed_blocks.each do |block| @@ -308,6 +321,10 @@ def load_partial(partial, locale) DELIMITERS[os_name].each do |delimiter| content.gsub!(/#{delimiter}/, "") end + # render Liquid templates (local partials use {{ var }} syntax) + variables = CONSTANTS.merge(partial_vars(entry)) + content = Liquid::Template.parse(content).render(variables) + # gsub fallback for external partials that still use syntax CONSTANTS.each do |placeholder, value| content.gsub!("<#{placeholder}>", value) end From cb94031ce7314fc42a9b9d3b738f54562fa0f4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 16:39:37 +0200 Subject: [PATCH 02/37] refacto main loop --- build.rb | 160 +++++++++++++++++++++++++++---------------------------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/build.rb b/build.rb index 4e5c747d..3bdcada4 100755 --- a/build.rb +++ b/build.rb @@ -232,105 +232,105 @@ LOCALES = ["", "es"] # english + spanish locales ENGLISH_ONLY = %w[REMOTE_SETUP].freeze -FILENAMES = { - "WINDOWS" => ["WINDOWS", WINDOWS], - "macOS" => ["macOS", MAC_OS], - "LINUX" => ["LINUX", LINUX], - "WINDOWS_keep_current" => ["WINDOWS", WINDOWS_KC], - "macOS_keep_current" => ["macOS", MAC_OS_KC], - "LINUX_keep_current" => ["LINUX", LINUX_KC], - "VM" => ["LINUX", VM], - "REMOTE_SETUP" => ["LINUX", REMOTE_SETUP] +# Maps output filename to its OS target (for conditional block filtering) and partial list. +# Entries prefixed with "#" in a partial list are skipped (used to document excluded steps). +BUILDS = { + "WINDOWS" => { os: "WINDOWS", partials: WINDOWS }, + "macOS" => { os: "macOS", partials: MAC_OS }, + "LINUX" => { os: "LINUX", partials: LINUX }, + "WINDOWS_keep_current" => { os: "WINDOWS", partials: WINDOWS_KC }, + "macOS_keep_current" => { os: "macOS", partials: MAC_OS_KC }, + "LINUX_keep_current" => { os: "LINUX", partials: LINUX_KC }, + "VM" => { os: "LINUX", partials: VM }, + "REMOTE_SETUP" => { os: "LINUX", partials: REMOTE_SETUP }, } DELIMITERS = { "WINDOWS" => ["\\$WINDOWS_START\n", "\\$WINDOWS_END\n"], - "macOS" => ["\\$MAC_START\n", "\\$MAC_END\n"], - "LINUX" => ["\\$LINUX_START\n", "\\$LINUX_END\n"], + "macOS" => ["\\$MAC_START\n", "\\$MAC_END\n"], + "LINUX" => ["\\$LINUX_START\n", "\\$LINUX_END\n"], } +def load_de_setup_partial(name, locale) + name = File.join(locale, name) unless locale.empty? + file = File.join("_partials", "#{name}.md") + content = URI.open("https://raw.githubusercontent.com/lewagon/data-engineering-setup/main/#{file}").read + content.scan(/\!\[.*\]\((.*)\)/).flatten + .reject { |ip| ip.start_with?("http") } + .each { |ip| content.gsub!(ip, "https://github.com/lewagon/data-engineering-setup/blob/main/#{ip}") } + content.scan(/src="(images\/.*)"/).flatten + .each { |ip| content.gsub!(ip, "https://github.com/lewagon/data-engineering-setup/blob/main/#{ip}") } + content +end + +def load_setup_partial(name, locale) + name = File.join(locale, name) unless locale.empty? + file = File.join("_partials", "#{name}.md") + content = URI.open("https://raw.githubusercontent.com/lewagon/setup/master/#{file}").read + content.scan(/\!\[.*\]\((.*)\)/).flatten + .each { |ip| content.gsub!(ip, "https://github.com/lewagon/setup/blob/master/#{ip}") } + content +end + +def load_local_partial(name, locale) + name = File.join(locale, name) unless locale.empty? + File.read(File.join("_partials", "#{name}.md"), encoding: "utf-8") +end + def load_partial(partial, locale) - match_setup = partial.match(/setup\/(?[0-9a-z_]+)/) - match_de_setup = partial.match(/de_setup\/(?[0-9a-z_]+)/) - if match_de_setup - partial = match_de_setup[:partial] - elsif match_setup - partial = match_setup[:partial] - end - partial = File.join(locale, partial) unless locale.empty? - file = File.join("_partials", "#{partial}.md") - if match_de_setup - content = URI.open(File.join("https://raw.githubusercontent.com/lewagon/data-engineering-setup/main", file)) - .read - # replace data-setup repo relative path by data-engineering-setup repo URL - image_paths = content.scan(/\!\[.*\]\((.*)\)/).flatten - image_paths.reject { |ip| ip.start_with?("http") }.each { |ip| content.gsub!(ip, "https://github.com/lewagon/data-engineering-setup/blob/main/#{ip}")} - # alternative image format - image_paths = content.scan(/src="(images\/.*)"/).flatten - image_paths.each { |ip| content.gsub!(ip, "https://github.com/lewagon/data-engineering-setup/blob/main/#{ip}")} - elsif match_setup - content = URI.open(File.join("https://raw.githubusercontent.com/lewagon/setup/master", file)) - .read - # replace data-setup repo relative path by setup repo URL - image_paths = content.scan(/\!\[.*\]\((.*)\)/).flatten - image_paths.each { |ip| content.gsub!(ip, "https://github.com/lewagon/setup/blob/master/#{ip}")} + if (m = partial.match(%r{\Ade_setup/(?[0-9a-z_]+)\z})) + load_de_setup_partial(m[:name], locale) + elsif (m = partial.match(%r{\Asetup/(?[0-9a-z_]+)\z})) + load_setup_partial(m[:name], locale) else - content = File.read(file, encoding: "utf-8") + load_local_partial(partial, locale) end - return content end -def partial_name(entry) - entry.is_a?(Array) ? entry[0] : entry -end +def partial_name(entry) = entry.is_a?(Array) ? entry[0] : entry +def partial_vars(entry) = entry.is_a?(Array) ? entry[1] : {} +def skipped?(entry) = partial_name(entry).start_with?("#") -def partial_vars(entry) - entry.is_a?(Array) ? entry[1] : {} +def collect_partials + BUILDS.flat_map { |filename, build| + LOCALES.flat_map { |locale| + next [] if !locale.empty? && ENGLISH_ONLY.include?(filename) + build[:partials].reject { |e| skipped?(e) }.map { |e| [partial_name(e), locale] } + } + }.uniq.map { |partial, locale| + ["#{partial}.#{locale}", load_partial(partial, locale)] + }.to_h end -def skipped?(entry) - partial_name(entry).start_with?("#") +def render_content(content, os_name, variables) + (DELIMITERS.keys - [os_name]).each do |block| + start_d, end_d = DELIMITERS[block] + content.gsub!(/#{start_d}(.|\n)*?(?", v) } + content end -# load partials (skip non-English locales for ENGLISH_ONLY configurations) -pairs = FILENAMES.flat_map { |filename, (os_name, partials)| - LOCALES.flat_map { |locale| - next [] if !locale.empty? && ENGLISH_ONLY.include?(filename) - partials.reject { |entry| skipped?(entry) }.map { |entry| [partial_name(entry), locale] } - } -}.uniq -loaded = pairs.map { |partial, locale| ["#{partial}.#{locale}", load_partial(partial, locale)] }.to_h +def generate_files(loaded) + LOCALES.each do |locale| + BUILDS.each do |filename, build| + next if !locale.empty? && ENGLISH_ONLY.include?(filename) -# write files -LOCALES.each do |locale| - FILENAMES.each do |filename, (os_name, partials)| - next if !locale.empty? && ENGLISH_ONLY.include?(filename) - filename += ".#{locale}" unless locale.empty? - filename += ".md" - File.open(filename, "w:utf-8") do |f| - partials.reject { |entry| skipped?(entry) }.each do |entry| - content = loaded["#{partial_name(entry)}.#{locale}"].clone - # remove the OS dependant blocks - removed_blocks = DELIMITERS.keys - [os_name] - removed_blocks.each do |block| - delimiter_start, delimiter_end = DELIMITERS[block] - pattern = "#{delimiter_start}(.|\n)*?(? syntax - CONSTANTS.each do |placeholder, value| - content.gsub!("<#{placeholder}>", value) + output = locale.empty? ? "#{filename}.md" : "#{filename}.#{locale}.md" + + File.open(output, "w:utf-8") do |f| + build[:partials].reject { |e| skipped?(e) }.each do |entry| + content = loaded["#{partial_name(entry)}.#{locale}"].clone + variables = CONSTANTS.merge(partial_vars(entry)) + f << render_content(content, build[:os], variables) + f << "\n\n" end - f << content - f << "\n\n" end end end end + +loaded = collect_partials +generate_files(loaded) From 920087e37025f8040b65ecd9dc768901f25d73a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 16:44:23 +0200 Subject: [PATCH 03/37] separate build declaration --- build.rb | 248 +----------------------------------------------------- builds.rb | 248 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 249 insertions(+), 247 deletions(-) create mode 100644 builds.rb diff --git a/build.rb b/build.rb index 3bdcada4..efef0def 100755 --- a/build.rb +++ b/build.rb @@ -3,253 +3,7 @@ require 'open-uri' require 'liquid' -CONSTANTS = { - 'PYTHON_VERSION' => '3.12.9', - 'PYTHON_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh', - 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', - 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', - 'CODE_EDITOR' => 'VS Code', - 'CODE_EDITOR_CMD' => 'code' -} - -# NOTE(ssaunier): This script needs https://github.com/lewagon/setup to be cloned as well -MAC_OS = %w[ - intro - setup/github - osx_silicon - setup/macos_command_line_tools - homebrew - setup/macos_vscode - vscode_extensions - setup/vscode_aifeatures - setup/oh_my_zsh - direnv - setup/gh_cli - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - conda_uninstall - osx_python - virtualenv - pip - nbextensions - python_checkup - dbeaver - docker - gcp_cli_setup - gcp_setup - gcp_setup_mid - gcp_setup_end - kitt - setup/macos_slack - setup/slack_settings - setup/macos_settings - kata -].freeze - -MAC_OS_KC = %w[ - keep_current - python_checkup -].freeze - -WINDOWS = %w[ - intro - setup/github - setup/windows_version - setup/windows_virtualization - setup/windows_wsl - setup/windows_ubuntu - setup/windows_vscode - setup/windows_terminal - vscode_extensions - setup/vscode_aifeatures - setup/cli_tools - setup/oh_my_zsh - windows_browser - direnv - setup/gh_cli - ubuntu_gcloud - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - setup/ssh_agent - conda_uninstall - ubuntu_python - virtualenv - pip - nbextensions - win_jupyter - python_checkup - dbeaver - setup/windows_settings - win_vs_redistributable - win_docker - gcp_setup - gcp_setup_wsl - gcp_setup_end - kitt - setup/windows_slack - setup/slack_settings - kata -].freeze - -WINDOWS_KC = %w[ - keep_current - python_checkup -].freeze - -LINUX = %w[ - intro - setup/github - setup/ubuntu_vscode - vscode_extensions - setup/vscode_aifeatures - setup/cli_tools - setup/oh_my_zsh - direnv - setup/gh_cli - ubuntu_gcloud - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - setup/ssh_agent - conda_uninstall - ubuntu_python - virtualenv - pip - nbextensions - python_checkup - dbeaver - ubuntu_docker - gcp_setup - gcp_setup_linux - gcp_setup_end - kitt - setup/ubuntu_slack - setup/slack_settings - kata -] - -LINUX_KC = %w[ - keep_current - python_checkup -] - -# student installs vscode, creates gcp vm, runs setup on vm -VM = %w[ - intro - setup/github - de_setup/ssh_key - de_setup/gcp_setup - de_setup/virtual_machine - de_setup/win_vscode - de_setup/vscode_remote_ssh - vscode_extensions - setup/vscode_aifeatures - setup/cli_tools - setup/oh_my_zsh - direnv - setup/gh_cli - de_setup/ubuntu_gcloud - de_setup/gcp_setup_linux - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - de_setup/zsh_default_terminal - setup/ssh_agent - ubuntu_python - virtualenv - pip - nbextensions - python_checkup - dbeaver - ubuntu_docker - kitt - setup/windows_slack - setup/slack_settings - kata -] - -# student installs vscode, redeems vm provided by lewagon, runs setup on vm -REMOTE_SETUP = %w[ - intro - setup/github - de_setup/ssh_key - vm_register - vm_start - vm_test - de_setup/win_vscode - de_setup/vscode_remote_ssh - vscode_extensions - setup/vscode_aifeatures - setup/cli_tools - setup/oh_my_zsh - direnv - setup/gh_cli - #de_setup/ubuntu_gcloud - #de_setup/gcp_setup_linux - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - de_setup/zsh_default_terminal - setup/ssh_agent - ubuntu_python - virtualenv - pip - nbextensions - python_checkup - dbeaver - ubuntu_docker - #de_setup/gcp_setup - #kitt - #setup/windows_slack - #setup/slack_settings - #kata - vm_stop - end -] - -LOCALES = ["", "es"] # english + spanish locales -ENGLISH_ONLY = %w[REMOTE_SETUP].freeze - -# Maps output filename to its OS target (for conditional block filtering) and partial list. -# Entries prefixed with "#" in a partial list are skipped (used to document excluded steps). -BUILDS = { - "WINDOWS" => { os: "WINDOWS", partials: WINDOWS }, - "macOS" => { os: "macOS", partials: MAC_OS }, - "LINUX" => { os: "LINUX", partials: LINUX }, - "WINDOWS_keep_current" => { os: "WINDOWS", partials: WINDOWS_KC }, - "macOS_keep_current" => { os: "macOS", partials: MAC_OS_KC }, - "LINUX_keep_current" => { os: "LINUX", partials: LINUX_KC }, - "VM" => { os: "LINUX", partials: VM }, - "REMOTE_SETUP" => { os: "LINUX", partials: REMOTE_SETUP }, -} - -DELIMITERS = { - "WINDOWS" => ["\\$WINDOWS_START\n", "\\$WINDOWS_END\n"], - "macOS" => ["\\$MAC_START\n", "\\$MAC_END\n"], - "LINUX" => ["\\$LINUX_START\n", "\\$LINUX_END\n"], -} +require_relative 'builds' def load_de_setup_partial(name, locale) name = File.join(locale, name) unless locale.empty? diff --git a/builds.rb b/builds.rb new file mode 100644 index 00000000..b2fe9486 --- /dev/null +++ b/builds.rb @@ -0,0 +1,248 @@ + +CONSTANTS = { + 'PYTHON_VERSION' => '3.12.9', + 'PYTHON_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh', + 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', + 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', + 'CODE_EDITOR' => 'VS Code', + 'CODE_EDITOR_CMD' => 'code' +} + +# NOTE(ssaunier): This script needs https://github.com/lewagon/setup to be cloned as well +MAC_OS = %w[ + intro + setup/github + osx_silicon + setup/macos_command_line_tools + homebrew + setup/macos_vscode + vscode_extensions + setup/vscode_aifeatures + setup/oh_my_zsh + direnv + setup/gh_cli + dotfiles + dotfiles_new_student + dotfiles_new_laptop + dotfiles_merge_upstream + dotfiles_same_laptop + dotfiles_merge_upstream + dotfiles_installer + conda_uninstall + osx_python + virtualenv + pip + nbextensions + python_checkup + dbeaver + docker + gcp_cli_setup + gcp_setup + gcp_setup_mid + gcp_setup_end + kitt + setup/macos_slack + setup/slack_settings + setup/macos_settings + kata +].freeze + +MAC_OS_KC = %w[ + keep_current + python_checkup +].freeze + +WINDOWS = %w[ + intro + setup/github + setup/windows_version + setup/windows_virtualization + setup/windows_wsl + setup/windows_ubuntu + setup/windows_vscode + setup/windows_terminal + vscode_extensions + setup/vscode_aifeatures + setup/cli_tools + setup/oh_my_zsh + windows_browser + direnv + setup/gh_cli + ubuntu_gcloud + dotfiles + dotfiles_new_student + dotfiles_new_laptop + dotfiles_merge_upstream + dotfiles_same_laptop + dotfiles_merge_upstream + dotfiles_installer + setup/ssh_agent + conda_uninstall + ubuntu_python + virtualenv + pip + nbextensions + win_jupyter + python_checkup + dbeaver + setup/windows_settings + win_vs_redistributable + win_docker + gcp_setup + gcp_setup_wsl + gcp_setup_end + kitt + setup/windows_slack + setup/slack_settings + kata +].freeze + +WINDOWS_KC = %w[ + keep_current + python_checkup +].freeze + +LINUX = %w[ + intro + setup/github + setup/ubuntu_vscode + vscode_extensions + setup/vscode_aifeatures + setup/cli_tools + setup/oh_my_zsh + direnv + setup/gh_cli + ubuntu_gcloud + dotfiles + dotfiles_new_student + dotfiles_new_laptop + dotfiles_merge_upstream + dotfiles_same_laptop + dotfiles_merge_upstream + dotfiles_installer + setup/ssh_agent + conda_uninstall + ubuntu_python + virtualenv + pip + nbextensions + python_checkup + dbeaver + ubuntu_docker + gcp_setup + gcp_setup_linux + gcp_setup_end + kitt + setup/ubuntu_slack + setup/slack_settings + kata +] + +LINUX_KC = %w[ + keep_current + python_checkup +] + +# student installs vscode, creates gcp vm, runs setup on vm +VM = %w[ + intro + setup/github + de_setup/ssh_key + de_setup/gcp_setup + de_setup/virtual_machine + de_setup/win_vscode + de_setup/vscode_remote_ssh + vscode_extensions + setup/vscode_aifeatures + setup/cli_tools + setup/oh_my_zsh + direnv + setup/gh_cli + de_setup/ubuntu_gcloud + de_setup/gcp_setup_linux + dotfiles + dotfiles_new_student + dotfiles_new_laptop + dotfiles_merge_upstream + dotfiles_same_laptop + dotfiles_merge_upstream + dotfiles_installer + de_setup/zsh_default_terminal + setup/ssh_agent + ubuntu_python + virtualenv + pip + nbextensions + python_checkup + dbeaver + ubuntu_docker + kitt + setup/windows_slack + setup/slack_settings + kata +] + +# student installs vscode, redeems vm provided by lewagon, runs setup on vm +REMOTE_SETUP = %w[ + intro + setup/github + de_setup/ssh_key + vm_register + vm_start + vm_test + de_setup/win_vscode + de_setup/vscode_remote_ssh + vscode_extensions + setup/vscode_aifeatures + setup/cli_tools + setup/oh_my_zsh + direnv + setup/gh_cli + #de_setup/ubuntu_gcloud + #de_setup/gcp_setup_linux + dotfiles + dotfiles_new_student + dotfiles_new_laptop + dotfiles_merge_upstream + dotfiles_same_laptop + dotfiles_merge_upstream + dotfiles_installer + de_setup/zsh_default_terminal + setup/ssh_agent + ubuntu_python + virtualenv + pip + nbextensions + python_checkup + dbeaver + ubuntu_docker + #de_setup/gcp_setup + #kitt + #setup/windows_slack + #setup/slack_settings + #kata + vm_stop + end +] + +LOCALES = ["", "es"] # english + spanish locales +ENGLISH_ONLY = %w[REMOTE_SETUP].freeze + +# Maps output filename to its OS target (for conditional block filtering) and partial list. +# Entries prefixed with "#" in a partial list are skipped (used to document excluded steps). +BUILDS = { + "WINDOWS" => { os: "WINDOWS", partials: WINDOWS }, + "macOS" => { os: "macOS", partials: MAC_OS }, + "LINUX" => { os: "LINUX", partials: LINUX }, + "WINDOWS_keep_current" => { os: "WINDOWS", partials: WINDOWS_KC }, + "macOS_keep_current" => { os: "macOS", partials: MAC_OS_KC }, + "LINUX_keep_current" => { os: "LINUX", partials: LINUX_KC }, + "VM" => { os: "LINUX", partials: VM }, + "REMOTE_SETUP" => { os: "LINUX", partials: REMOTE_SETUP }, +} + +DELIMITERS = { + "WINDOWS" => ["\\$WINDOWS_START\n", "\\$WINDOWS_END\n"], + "macOS" => ["\\$MAC_START\n", "\\$MAC_END\n"], + "LINUX" => ["\\$LINUX_START\n", "\\$LINUX_END\n"], +} From 37268462dba7304c5cf5e4b2305808b0ceaf1cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 16:48:10 +0200 Subject: [PATCH 04/37] syntax --- builds.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/builds.rb b/builds.rb index b2fe9486..0c7c0c2b 100644 --- a/builds.rb +++ b/builds.rb @@ -136,12 +136,12 @@ setup/ubuntu_slack setup/slack_settings kata -] +].freeze LINUX_KC = %w[ keep_current python_checkup -] +].freeze # student installs vscode, creates gcp vm, runs setup on vm VM = %w[ @@ -180,7 +180,7 @@ setup/windows_slack setup/slack_settings kata -] +].freeze # student installs vscode, redeems vm provided by lewagon, runs setup on vm REMOTE_SETUP = %w[ @@ -223,22 +223,22 @@ #kata vm_stop end -] +].freeze -LOCALES = ["", "es"] # english + spanish locales +LOCALES = ['', 'es'].freeze # english + spanish locales ENGLISH_ONLY = %w[REMOTE_SETUP].freeze # Maps output filename to its OS target (for conditional block filtering) and partial list. # Entries prefixed with "#" in a partial list are skipped (used to document excluded steps). BUILDS = { - "WINDOWS" => { os: "WINDOWS", partials: WINDOWS }, - "macOS" => { os: "macOS", partials: MAC_OS }, - "LINUX" => { os: "LINUX", partials: LINUX }, - "WINDOWS_keep_current" => { os: "WINDOWS", partials: WINDOWS_KC }, - "macOS_keep_current" => { os: "macOS", partials: MAC_OS_KC }, - "LINUX_keep_current" => { os: "LINUX", partials: LINUX_KC }, - "VM" => { os: "LINUX", partials: VM }, - "REMOTE_SETUP" => { os: "LINUX", partials: REMOTE_SETUP }, + 'WINDOWS' => { os: 'WINDOWS', partials: WINDOWS }, + 'macOS' => { os: 'macOS', partials: MAC_OS }, + 'LINUX' => { os: 'LINUX', partials: LINUX }, + 'WINDOWS_keep_current' => { os: 'WINDOWS', partials: WINDOWS_KC }, + 'macOS_keep_current' => { os: 'macOS', partials: MAC_OS_KC }, + 'LINUX_keep_current' => { os: 'LINUX', partials: LINUX_KC }, + 'VM' => { os: 'LINUX', partials: VM }, + 'REMOTE_SETUP' => { os: 'LINUX', partials: REMOTE_SETUP }, } DELIMITERS = { From 8ec3bdc4e64c27493c79fcddf35d9f54be42ef5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 16:49:09 +0200 Subject: [PATCH 05/37] style --- builds.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builds.rb b/builds.rb index 0c7c0c2b..f103c22d 100644 --- a/builds.rb +++ b/builds.rb @@ -1,11 +1,11 @@ CONSTANTS = { - 'PYTHON_VERSION' => '3.12.9', + 'PYTHON_VERSION' => '3.12.9', 'PYTHON_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh', - 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', - 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', - 'CODE_EDITOR' => 'VS Code', - 'CODE_EDITOR_CMD' => 'code' + 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', + 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', + 'CODE_EDITOR' => 'VS Code', + 'CODE_EDITOR_CMD' => 'code' } # NOTE(ssaunier): This script needs https://github.com/lewagon/setup to be cloned as well From 058dc8d7188124b32ca558532e30e3b788436f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 16:50:50 +0200 Subject: [PATCH 06/37] style --- builds.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/builds.rb b/builds.rb index f103c22d..48c32f27 100644 --- a/builds.rb +++ b/builds.rb @@ -1,11 +1,11 @@ CONSTANTS = { - 'PYTHON_VERSION' => '3.12.9', + 'PYTHON_VERSION' => '3.12.9', 'PYTHON_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh', - 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', - 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', - 'CODE_EDITOR' => 'VS Code', - 'CODE_EDITOR_CMD' => 'code' + 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', + 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', + 'CODE_EDITOR' => 'VS Code', + 'CODE_EDITOR_CMD' => 'code' } # NOTE(ssaunier): This script needs https://github.com/lewagon/setup to be cloned as well @@ -242,7 +242,7 @@ } DELIMITERS = { - "WINDOWS" => ["\\$WINDOWS_START\n", "\\$WINDOWS_END\n"], - "macOS" => ["\\$MAC_START\n", "\\$MAC_END\n"], - "LINUX" => ["\\$LINUX_START\n", "\\$LINUX_END\n"], + 'WINDOWS' => ["\\$WINDOWS_START\n", "\\$WINDOWS_END\n"], + 'macOS' => ["\\$MAC_START\n", "\\$MAC_END\n"], + 'LINUX' => ["\\$LINUX_START\n", "\\$LINUX_END\n"], } From e1177d7fc230674db2b2f1a4179f356d8b9dc197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 16:57:42 +0200 Subject: [PATCH 07/37] style --- .rubocop.yml | 6 ++++++ builds.rb | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..6393cf22 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,6 @@ + + Layout/HashAlignment: + Enabled: false + + Layout/LeadingEmptyLines: + Enabled: false diff --git a/builds.rb b/builds.rb index 48c32f27..0bdbba9c 100644 --- a/builds.rb +++ b/builds.rb @@ -1,12 +1,12 @@ CONSTANTS = { - 'PYTHON_VERSION' => '3.12.9', - 'PYTHON_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh', - 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', - 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', - 'CODE_EDITOR' => 'VS Code', - 'CODE_EDITOR_CMD' => 'code' -} + 'PYTHON_VERSION' => '3.12.9', + 'PYTHON_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh', + 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', + 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', + 'CODE_EDITOR' => 'VS Code', + 'CODE_EDITOR_CMD' => 'code' +}.freeze # NOTE(ssaunier): This script needs https://github.com/lewagon/setup to be cloned as well MAC_OS = %w[ @@ -225,7 +225,7 @@ end ].freeze -LOCALES = ['', 'es'].freeze # english + spanish locales +LOCALES = ['', 'es'].freeze # english + spanish locales ENGLISH_ONLY = %w[REMOTE_SETUP].freeze # Maps output filename to its OS target (for conditional block filtering) and partial list. @@ -238,11 +238,11 @@ 'macOS_keep_current' => { os: 'macOS', partials: MAC_OS_KC }, 'LINUX_keep_current' => { os: 'LINUX', partials: LINUX_KC }, 'VM' => { os: 'LINUX', partials: VM }, - 'REMOTE_SETUP' => { os: 'LINUX', partials: REMOTE_SETUP }, -} + 'REMOTE_SETUP' => { os: 'LINUX', partials: REMOTE_SETUP } +}.freeze DELIMITERS = { 'WINDOWS' => ["\\$WINDOWS_START\n", "\\$WINDOWS_END\n"], 'macOS' => ["\\$MAC_START\n", "\\$MAC_END\n"], - 'LINUX' => ["\\$LINUX_START\n", "\\$LINUX_END\n"], -} + 'LINUX' => ["\\$LINUX_START\n", "\\$LINUX_END\n"] +}.freeze From f323fb9d88e0a9d62ae01d3164b7efd09d966e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 17:36:43 +0200 Subject: [PATCH 08/37] liquid handle conditional blocks --- build.rb | 7 +------ builds.rb | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/build.rb b/build.rb index efef0def..c5875d6b 100755 --- a/build.rb +++ b/build.rb @@ -57,12 +57,7 @@ def collect_partials end def render_content(content, os_name, variables) - (DELIMITERS.keys - [os_name]).each do |block| - start_d, end_d = DELIMITERS[block] - content.gsub!(/#{start_d}(.|\n)*?(? os_name)) CONSTANTS.each { |k, v| content.gsub!("<#{k}>", v) } content end diff --git a/builds.rb b/builds.rb index 0bdbba9c..19de5e84 100644 --- a/builds.rb +++ b/builds.rb @@ -231,18 +231,12 @@ # Maps output filename to its OS target (for conditional block filtering) and partial list. # Entries prefixed with "#" in a partial list are skipped (used to document excluded steps). BUILDS = { - 'WINDOWS' => { os: 'WINDOWS', partials: WINDOWS }, - 'macOS' => { os: 'macOS', partials: MAC_OS }, - 'LINUX' => { os: 'LINUX', partials: LINUX }, - 'WINDOWS_keep_current' => { os: 'WINDOWS', partials: WINDOWS_KC }, - 'macOS_keep_current' => { os: 'macOS', partials: MAC_OS_KC }, - 'LINUX_keep_current' => { os: 'LINUX', partials: LINUX_KC }, - 'VM' => { os: 'LINUX', partials: VM }, - 'REMOTE_SETUP' => { os: 'LINUX', partials: REMOTE_SETUP } -}.freeze - -DELIMITERS = { - 'WINDOWS' => ["\\$WINDOWS_START\n", "\\$WINDOWS_END\n"], - 'macOS' => ["\\$MAC_START\n", "\\$MAC_END\n"], - 'LINUX' => ["\\$LINUX_START\n", "\\$LINUX_END\n"] + 'WINDOWS' => { os: 'windows', partials: WINDOWS }, + 'macOS' => { os: 'macos', partials: MAC_OS }, + 'LINUX' => { os: 'linux', partials: LINUX }, + 'WINDOWS_keep_current' => { os: 'windows', partials: WINDOWS_KC }, + 'macOS_keep_current' => { os: 'macos', partials: MAC_OS_KC }, + 'LINUX_keep_current' => { os: 'linux', partials: LINUX_KC }, + 'VM' => { os: 'linux', partials: VM }, + 'REMOTE_SETUP' => { os: 'linux', partials: REMOTE_SETUP } }.freeze From a594c514f009511eeea1bb23154f894fa7632279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 17:49:06 +0200 Subject: [PATCH 09/37] only blank lines --- LINUX.es.md | 9 +++++++++ LINUX.md | 11 +++++++++++ LINUX_keep_current.es.md | 8 ++++++++ LINUX_keep_current.md | 8 ++++++++ REMOTE_SETUP.md | 4 ++++ VM.es.md | 4 ++++ VM.md | 4 ++++ WINDOWS.es.md | 8 ++++++++ WINDOWS.md | 10 ++++++++++ WINDOWS_keep_current.es.md | 8 ++++++++ WINDOWS_keep_current.md | 8 ++++++++ macOS.es.md | 10 ++++++++++ macOS.md | 12 ++++++++++++ macOS_keep_current.es.md | 8 ++++++++ macOS_keep_current.md | 8 ++++++++ 15 files changed, 120 insertions(+) diff --git a/LINUX.es.md b/LINUX.es.md index abe1f701..682125e7 100644 --- a/LINUX.es.md +++ b/LINUX.es.md @@ -203,12 +203,14 @@ Cuando termines, tu terminal debería lucir así: [direnv](https://direnv.net/) es una extensión del shell. Facilita trabajar con variables de entorno por proyecto, lo cual será útil para customizar el comportamiento de tu código. + ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI es una abreviación de [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface) que significa interfaz de línea de comando. @@ -505,8 +507,10 @@ Chequea si tienes `conda` instalado en tu computadora: ```bash conda list ``` + Si aparece `zsh: command not found: conda`, puedes **saltear** la desinstalación de `conda` e ir directo a la sección de **Instalar pre-requisitos**. +
Instrucciones de desinstalación conda @@ -520,11 +524,14 @@ anaconda-clean --yes rm -rf ~/anaconda2 rm -rf ~/anaconda3 rm -rf ~/.anaconda_backup + ``` - Elimina el directorio Anaconda de tu `.bash_profile` - Abre el archivo con `code ~/.bash_profile` - Si el archivo abre, busca la línea que coincida con el siguiente patrón `export PATH="/path/to/anaconda3/bin:$PATH"` y eliminala + - Guarda el archivo con `CTRL` + `s` + - Reinicia la terminal con `exec zsh` - Remueve la inicializaciópn de Anaconda de tu `.zshrc`: - Abre el archivo con `code ~/.zshrc` @@ -612,11 +619,13 @@ pip install --upgrade pip Ahora instala algunos paquetes para las primeras semanas del programa: + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## Mejora Jupyter Notebook 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. diff --git a/LINUX.md b/LINUX.md index 51611c37..180207b0 100644 --- a/LINUX.md +++ b/LINUX.md @@ -227,12 +227,14 @@ At the end your terminal should look like this: [direnv](https://direnv.net/) is a shell extension. It makes it easy to deal with per project environment variables. This will be useful in order to customize the behavior of your code. + ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI is the acronym of [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface). @@ -520,8 +522,10 @@ Check if you have `conda` installed on your machine: ```bash conda list ``` + If you have `zsh: command not found: conda`, you can **skip** the uninstall of `conda` and jump to the **Install `pyenv`** section. +
conda uninstall instructions @@ -535,11 +539,14 @@ anaconda-clean --yes rm -rf ~/anaconda2 rm -rf ~/anaconda3 rm -rf ~/.anaconda_backup + ``` - Remove Anaconda path from your `.bash_profile` - Open the file with `code ~/.bash_profile` - If the file opens find the line matching the following pattern `export PATH="/path/to/anaconda3/bin:$PATH"` and delete the line + - Save the file with `CTRL` + `s` + - Restart your terminal with `exec zsh` - Remove Anaconda initialization from your `.zshrc`: - Open the file with `code ~/.zshrc` @@ -648,11 +655,13 @@ pip install --upgrade pip Then let's install some packages for the first weeks of the program: + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## Jupyter Notebook tweaking Let's improve the display of the [`details` disclosure elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) in your notebooks. @@ -926,10 +935,12 @@ Once the verification goes through, you should receive an email stating that "Yo - Authenticate the `gcloud` CLI with the google account you used for GCP + ```bash gcloud auth login ``` + - Login to your Google account on the new tab opened in your web browser - List your active account and check your email address you used for GCP is present ```bash diff --git a/LINUX_keep_current.es.md b/LINUX_keep_current.es.md index c9531854..67b418a9 100644 --- a/LINUX_keep_current.es.md +++ b/LINUX_keep_current.es.md @@ -86,10 +86,12 @@ type -a pyenv > /dev/null && eval "$(pyenv init --path)" Actualiza pyenv: + ``` bash cd $(pyenv root) && git pull ``` + Instala la versión actual de python: ```bash @@ -140,10 +142,12 @@ pyenv versions pip install -U pip ``` + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## GCP Asegúrate de que el comando `gcloud` esté conectado con el email de tu cuenta Google Cloud Platform: @@ -252,12 +256,14 @@ gcloud auth configure-docker ## Docker + Start Docker : ``` bash sudo service docker start ``` + Verifica que Docker pueda ejecutar la imagen de hello-world: ``` bash @@ -266,6 +272,7 @@ docker run hello-world 👉 Asegúrate de que este comando se ejecute completamente + Stop Docker : ``` bash @@ -273,6 +280,7 @@ sudo service docker stop ``` + ## Chequeo de la configuración de Python ### Chequeo de Python y packages diff --git a/LINUX_keep_current.md b/LINUX_keep_current.md index 68a85273..1ee086a1 100644 --- a/LINUX_keep_current.md +++ b/LINUX_keep_current.md @@ -86,10 +86,12 @@ type -a pyenv > /dev/null && eval "$(pyenv init --path)" Update pyenv : + ``` bash cd $(pyenv root) && git pull ``` + Install the current python version : ```bash @@ -140,10 +142,12 @@ pyenv versions pip install -U pip ``` + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## GCP Make sure that the `gcloud` command is linked to the email address of your Google Cloud Platform account : @@ -252,12 +256,14 @@ gcloud auth configure-docker ## Docker + Start Docker : ``` bash sudo service docker start ``` + Verify that Docker can run the hello-world image : ``` bash @@ -266,6 +272,7 @@ docker run hello-world 👉 Make sure that this command completes correctly + Stop Docker : ``` bash @@ -273,6 +280,7 @@ sudo service docker stop ``` + ## Python setup check ### Python and packages check diff --git a/REMOTE_SETUP.md b/REMOTE_SETUP.md index cb72a475..8dccf810 100644 --- a/REMOTE_SETUP.md +++ b/REMOTE_SETUP.md @@ -502,12 +502,14 @@ At the end your terminal should look like this: [direnv](https://direnv.net/) is a shell extension. It makes it easy to deal with per project environment variables. This will be useful in order to customize the behavior of your code. + ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI is the acronym of [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface). @@ -884,11 +886,13 @@ pip install --upgrade pip Then let's install some packages for the first weeks of the program: + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## Jupyter Notebook tweaking Let's improve the display of the [`details` disclosure elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) in your notebooks. diff --git a/VM.es.md b/VM.es.md index f1a9d5a4..6e577c9f 100644 --- a/VM.es.md +++ b/VM.es.md @@ -370,12 +370,14 @@ Cuando termines, tu terminal debería lucir así: [direnv](https://direnv.net/) es una extensión del shell. Facilita trabajar con variables de entorno por proyecto, lo cual será útil para customizar el comportamiento de tu código. + ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI es una abreviación de [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface) que significa interfaz de línea de comando. @@ -756,11 +758,13 @@ pip install --upgrade pip Ahora instala algunos paquetes para las primeras semanas del programa: + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## Mejora Jupyter Notebook 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. diff --git a/VM.md b/VM.md index 80597d71..ba150d9d 100644 --- a/VM.md +++ b/VM.md @@ -485,12 +485,14 @@ At the end your terminal should look like this: [direnv](https://direnv.net/) is a shell extension. It makes it easy to deal with per project environment variables. This will be useful in order to customize the behavior of your code. + ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI is the acronym of [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface). @@ -981,11 +983,13 @@ pip install --upgrade pip Then let's install some packages for the first weeks of the program: + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## Jupyter Notebook tweaking Let's improve the display of the [`details` disclosure elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) in your notebooks. diff --git a/WINDOWS.es.md b/WINDOWS.es.md index 435de86d..0d4a1c8b 100644 --- a/WINDOWS.es.md +++ b/WINDOWS.es.md @@ -655,12 +655,14 @@ No dudes en **pedirle ayuda a tu profesor**. [direnv](https://direnv.net/) es una extensión del shell. Facilita trabajar con variables de entorno por proyecto, lo cual será útil para customizar el comportamiento de tu código. + ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI es una abreviación de [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface) que significa interfaz de línea de comando. @@ -957,8 +959,10 @@ Chequea si tienes `conda` instalado en tu computadora: ```bash conda list ``` + Si aparece `zsh: command not found: conda`, puedes **saltear** la desinstalación de `conda` e ir directo a la sección de **Instalar pre-requisitos**. +
Instrucciones de desinstalación conda @@ -972,10 +976,12 @@ anaconda-clean --yes rm -rf ~/anaconda2 rm -rf ~/anaconda3 rm -rf ~/.anaconda_backup + ``` - Elimina el directorio Anaconda de tu `.bash_profile` - Abre el archivo con `code ~/.bash_profile` - Si el archivo abre, busca la línea que coincida con el siguiente patrón `export PATH="/path/to/anaconda3/bin:$PATH"` y eliminala + - Reinicia la terminal con `exec zsh` - Remueve la inicializaciópn de Anaconda de tu `.zshrc`: - Abre el archivo con `code ~/.zshrc` @@ -1063,11 +1069,13 @@ pip install --upgrade pip Ahora instala algunos paquetes para las primeras semanas del programa: + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## Mejora Jupyter Notebook 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. diff --git a/WINDOWS.md b/WINDOWS.md index 42981174..4370032a 100644 --- a/WINDOWS.md +++ b/WINDOWS.md @@ -670,12 +670,14 @@ Do not hesitate to **contact a teacher**. [direnv](https://direnv.net/) is a shell extension. It makes it easy to deal with per project environment variables. This will be useful in order to customize the behavior of your code. + ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI is the acronym of [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface). @@ -963,8 +965,10 @@ Check if you have `conda` installed on your machine: ```bash conda list ``` + If you have `zsh: command not found: conda`, you can **skip** the uninstall of `conda` and jump to the **Install `pyenv`** section. +
conda uninstall instructions @@ -978,10 +982,12 @@ anaconda-clean --yes rm -rf ~/anaconda2 rm -rf ~/anaconda3 rm -rf ~/.anaconda_backup + ``` - Remove Anaconda path from your `.bash_profile` - Open the file with `code ~/.bash_profile` - If the file opens find the line matching the following pattern `export PATH="/path/to/anaconda3/bin:$PATH"` and delete the line + - Restart your terminal with `exec zsh` - Remove Anaconda initialization from your `.zshrc`: - Open the file with `code ~/.zshrc` @@ -1090,11 +1096,13 @@ pip install --upgrade pip Then let's install some packages for the first weeks of the program: + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## Jupyter Notebook tweaking Let's improve the display of the [`details` disclosure elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) in your notebooks. @@ -1500,10 +1508,12 @@ Once the verification goes through, you should receive an email stating that "Yo - Authenticate the `gcloud` CLI with the google account you used for GCP + ```bash gcloud auth login --no-launch-browser ``` + - Login to your Google account on the new tab opened in your web browser - List your active account and check your email address you used for GCP is present ```bash diff --git a/WINDOWS_keep_current.es.md b/WINDOWS_keep_current.es.md index c02696f9..9106eb0f 100644 --- a/WINDOWS_keep_current.es.md +++ b/WINDOWS_keep_current.es.md @@ -86,10 +86,12 @@ type -a pyenv > /dev/null && eval "$(pyenv init --path)" Actualiza pyenv: + ``` bash cd $(pyenv root) && git pull ``` + Instala la versión actual de python: ```bash @@ -140,10 +142,12 @@ pyenv versions pip install -U pip ``` + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## GCP Asegúrate de que el comando `gcloud` esté conectado con el email de tu cuenta Google Cloud Platform: @@ -252,8 +256,10 @@ gcloud auth configure-docker ## Docker + Start the Docker Desktop app + Verifica que Docker pueda ejecutar la imagen de hello-world: ``` bash @@ -262,9 +268,11 @@ docker run hello-world 👉 Asegúrate de que este comando se ejecute completamente + Stop the Docker Desktop app + ## Chequeo de la configuración de Python ### Chequeo de Python y packages diff --git a/WINDOWS_keep_current.md b/WINDOWS_keep_current.md index bfddaf6d..f12ea962 100644 --- a/WINDOWS_keep_current.md +++ b/WINDOWS_keep_current.md @@ -86,10 +86,12 @@ type -a pyenv > /dev/null && eval "$(pyenv init --path)" Update pyenv : + ``` bash cd $(pyenv root) && git pull ``` + Install the current python version : ```bash @@ -140,10 +142,12 @@ pyenv versions pip install -U pip ``` + ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` + ## GCP Make sure that the `gcloud` command is linked to the email address of your Google Cloud Platform account : @@ -252,8 +256,10 @@ gcloud auth configure-docker ## Docker + Start the Docker Desktop app + Verify that Docker can run the hello-world image : ``` bash @@ -262,9 +268,11 @@ docker run hello-world 👉 Make sure that this command completes correctly + Stop the Docker Desktop app + ## Python setup check ### Python and packages check diff --git a/macOS.es.md b/macOS.es.md index bfb3c5b6..f8c6a27f 100644 --- a/macOS.es.md +++ b/macOS.es.md @@ -260,12 +260,14 @@ Cuando termines, tu terminal debería lucir así: [direnv](https://direnv.net/) es una extensión del shell. Facilita trabajar con variables de entorno por proyecto, lo cual será útil para customizar el comportamiento de tu código. + ``` bash brew install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI es una abreviación de [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface) que significa interfaz de línea de comando. @@ -526,8 +528,10 @@ Chequea si tienes `conda` instalado en tu computadora: ```bash conda list ``` + Si aparece `zsh: command not found: conda`, puedes **saltear** la desinstalación de `conda` e ir directo a la sección de **Instalar pre-requisitos**. +
Instrucciones de desinstalación conda @@ -541,12 +545,16 @@ anaconda-clean --yes rm -rf ~/anaconda2 rm -rf ~/anaconda3 rm -rf ~/.anaconda_backup + rm -rf ~/opt + ``` - Elimina el directorio Anaconda de tu `.bash_profile` - Abre el archivo con `code ~/.bash_profile` - Si el archivo abre, busca la línea que coincida con el siguiente patrón `export PATH="/path/to/anaconda3/bin:$PATH"` y eliminala + - Guarda el archivo con `CMD` + `s` + - Reinicia la terminal con `exec zsh` - Remueve la inicializaciópn de Anaconda de tu `.zshrc`: - Abre el archivo con `code ~/.zshrc` @@ -675,6 +683,7 @@ pip install --upgrade pip Ahora instala algunos paquetes para las primeras semanas del programa: + Si tu computadora usa **Apple Silicon**, expande el párrafo de abajo y léelo. Si no es el caso, ignóralo.
@@ -696,6 +705,7 @@ pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs
+ ## Mejora Jupyter Notebook 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. diff --git a/macOS.md b/macOS.md index 1eafcaef..79fab949 100644 --- a/macOS.md +++ b/macOS.md @@ -260,12 +260,14 @@ At the end your terminal should look like this: [direnv](https://direnv.net/) is a shell extension. It makes it easy to deal with per project environment variables. This will be useful in order to customize the behavior of your code. + ``` bash brew install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` + ## GitHub CLI CLI is the acronym of [Command-line Interface](https://en.wikipedia.org/wiki/Command-line_interface). @@ -523,8 +525,10 @@ Check if you have `conda` installed on your machine: ```bash conda list ``` + If you have `zsh: command not found: conda`, you can **skip** the uninstall of `conda` and jump to the **Install pre-requisites** section. +
conda uninstall instructions @@ -538,12 +542,16 @@ anaconda-clean --yes rm -rf ~/anaconda2 rm -rf ~/anaconda3 rm -rf ~/.anaconda_backup + rm -rf ~/opt + ``` - Remove Anaconda path from your `.bash_profile` - Open the file with `code ~/.bash_profile` - If the file opens find the line matching the following pattern `export PATH="/path/to/anaconda3/bin:$PATH"` and delete the line + - Save the file with `CMD` + `s` + - Restart your terminal with `exec zsh` - Remove Anaconda initialization from your `.zshrc`: - Open the file with `code ~/.zshrc` @@ -692,6 +700,7 @@ pip install --upgrade pip Then let's install some packages for the first weeks of the program: + If your computer uses **Apple Silicon**, expand the paragraph below and go through it. Otherwise ignore it.
@@ -713,6 +722,7 @@ pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs
+ ## Jupyter Notebook tweaking Let's improve the display of the [`details` disclosure elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) in your notebooks. @@ -1004,10 +1014,12 @@ Once the verification goes through, you should receive an email stating that "Yo - Authenticate the `gcloud` CLI with the google account you used for GCP + ```bash gcloud auth login ``` + - Login to your Google account on the new tab opened in your web browser - List your active account and check your email address you used for GCP is present ```bash diff --git a/macOS_keep_current.es.md b/macOS_keep_current.es.md index 64cf6bec..973ee8d9 100644 --- a/macOS_keep_current.es.md +++ b/macOS_keep_current.es.md @@ -86,10 +86,12 @@ type -a pyenv > /dev/null && eval "$(pyenv init --path)" Actualiza pyenv: + ``` bash brew update && brew upgrade pyenv ``` + Instala la versión actual de python: ```bash @@ -140,6 +142,7 @@ pyenv versions pip install -U pip ``` + Si tu computadora usa **Apple Silicon**, expande el párrafo de abajo y léelo. Si no es el caso, ignóralo.
@@ -160,6 +163,7 @@ pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs ```
+ ## GCP Asegúrate de que el comando `gcloud` esté conectado con el email de tu cuenta Google Cloud Platform: @@ -268,8 +272,10 @@ gcloud auth configure-docker ## Docker + Start the Docker app + Verifica que Docker pueda ejecutar la imagen de hello-world: ``` bash @@ -278,9 +284,11 @@ docker run hello-world 👉 Asegúrate de que este comando se ejecute completamente + Stop the Docker app + ## Chequeo de la configuración de Python ### Chequeo de Python y packages diff --git a/macOS_keep_current.md b/macOS_keep_current.md index b2a7b868..9890f7e0 100644 --- a/macOS_keep_current.md +++ b/macOS_keep_current.md @@ -86,10 +86,12 @@ type -a pyenv > /dev/null && eval "$(pyenv init --path)" Update pyenv : + ``` bash brew update && brew upgrade pyenv ``` + Install the current python version : ```bash @@ -140,6 +142,7 @@ pyenv versions pip install -U pip ``` + If your computer uses **Apple Silicon**, expand the paragraph below and go through it. Otherwise ignore it.
@@ -160,6 +163,7 @@ pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs ```
+ ## GCP Make sure that the `gcloud` command is linked to the email address of your Google Cloud Platform account : @@ -268,8 +272,10 @@ gcloud auth configure-docker ## Docker + Start the Docker app + Verify that Docker can run the hello-world image : ``` bash @@ -278,9 +284,11 @@ docker run hello-world 👉 Make sure that this command completes correctly + Stop the Docker app + ## Python setup check ### Python and packages check From 194225416f42f8b94037a7b2a88a78d1a49731e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 17:50:22 +0200 Subject: [PATCH 10/37] update partials to use liquid conditional blocks --- _partials/conda_uninstall.md | 21 ++++++++--------- _partials/direnv.md | 10 ++++----- _partials/es/conda_uninstall.md | 21 ++++++++--------- _partials/es/direnv.md | 10 ++++----- _partials/es/keep_current.md | 40 +++++++++++++-------------------- _partials/es/pip.md | 10 ++++----- _partials/gcp_setup.md | 10 ++++----- _partials/keep_current.md | 40 +++++++++++++-------------------- _partials/pip.md | 10 ++++----- 9 files changed, 70 insertions(+), 102 deletions(-) diff --git a/_partials/conda_uninstall.md b/_partials/conda_uninstall.md index 388aed7f..e27129ee 100644 --- a/_partials/conda_uninstall.md +++ b/_partials/conda_uninstall.md @@ -9,15 +9,13 @@ Check if you have `conda` installed on your machine: ```bash conda list ``` -$MAC_START +{% if os == "macos" %} If you have `zsh: command not found: conda`, you can **skip** the uninstall of `conda` and jump to the **Install pre-requisites** section. -$MAC_END -$LINUX_START +{% elsif os == "linux" %} If you have `zsh: command not found: conda`, you can **skip** the uninstall of `conda` and jump to the **Install `pyenv`** section. -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} If you have `zsh: command not found: conda`, you can **skip** the uninstall of `conda` and jump to the **Install `pyenv`** section. -$WINDOWS_END +{% endif %}
conda uninstall instructions @@ -32,19 +30,18 @@ anaconda-clean --yes rm -rf ~/anaconda2 rm -rf ~/anaconda3 rm -rf ~/.anaconda_backup -$MAC_START +{% if os == "macos" %} rm -rf ~/opt -$MAC_END +{% endif %} ``` - Remove Anaconda path from your `.bash_profile` - Open the file with `code ~/.bash_profile` - If the file opens find the line matching the following pattern `export PATH="/path/to/anaconda3/bin:$PATH"` and delete the line -$MAC_START +{% if os == "macos" %} - Save the file with `CMD` + `s` -$MAC_END -$LINUX_START +{% elsif os == "linux" %} - Save the file with `CTRL` + `s` -$LINUX_END +{% endif %} - Restart your terminal with `exec zsh` - Remove Anaconda initialization from your `.zshrc`: - Open the file with `code ~/.zshrc` diff --git a/_partials/direnv.md b/_partials/direnv.md index 2370ae71..2e434226 100644 --- a/_partials/direnv.md +++ b/_partials/direnv.md @@ -2,21 +2,19 @@ [direnv](https://direnv.net/) is a shell extension. It makes it easy to deal with per project environment variables. This will be useful in order to customize the behavior of your code. -$MAC_START +{% if os == "macos" %} ``` bash brew install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` -$MAC_END -$WINDOWS_START +{% elsif os == "windows" %} ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` -$WINDOWS_END -$LINUX_START +{% elsif os == "linux" %} ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` -$LINUX_END +{% endif %} diff --git a/_partials/es/conda_uninstall.md b/_partials/es/conda_uninstall.md index a61aa84a..72dbaa7b 100644 --- a/_partials/es/conda_uninstall.md +++ b/_partials/es/conda_uninstall.md @@ -9,15 +9,13 @@ Chequea si tienes `conda` instalado en tu computadora: ```bash conda list ``` -$MAC_START +{% if os == "macos" %} Si aparece `zsh: command not found: conda`, puedes **saltear** la desinstalación de `conda` e ir directo a la sección de **Instalar pre-requisitos**. -$MAC_END -$LINUX_START +{% elsif os == "linux" %} Si aparece `zsh: command not found: conda`, puedes **saltear** la desinstalación de `conda` e ir directo a la sección de **Instalar pre-requisitos**. -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} Si aparece `zsh: command not found: conda`, puedes **saltear** la desinstalación de `conda` e ir directo a la sección de **Instalar pre-requisitos**. -$WINDOWS_END +{% endif %}
Instrucciones de desinstalación conda @@ -32,19 +30,18 @@ anaconda-clean --yes rm -rf ~/anaconda2 rm -rf ~/anaconda3 rm -rf ~/.anaconda_backup -$MAC_START +{% if os == "macos" %} rm -rf ~/opt -$MAC_END +{% endif %} ``` - Elimina el directorio Anaconda de tu `.bash_profile` - Abre el archivo con `code ~/.bash_profile` - Si el archivo abre, busca la línea que coincida con el siguiente patrón `export PATH="/path/to/anaconda3/bin:$PATH"` y eliminala -$MAC_START +{% if os == "macos" %} - Guarda el archivo con `CMD` + `s` -$MAC_END -$LINUX_START +{% elsif os == "linux" %} - Guarda el archivo con `CTRL` + `s` -$LINUX_END +{% endif %} - Reinicia la terminal con `exec zsh` - Remueve la inicializaciópn de Anaconda de tu `.zshrc`: - Abre el archivo con `code ~/.zshrc` diff --git a/_partials/es/direnv.md b/_partials/es/direnv.md index 28901f91..989ab657 100644 --- a/_partials/es/direnv.md +++ b/_partials/es/direnv.md @@ -2,21 +2,19 @@ [direnv](https://direnv.net/) es una extensión del shell. Facilita trabajar con variables de entorno por proyecto, lo cual será útil para customizar el comportamiento de tu código. -$MAC_START +{% if os == "macos" %} ``` bash brew install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` -$MAC_END -$WINDOWS_START +{% elsif os == "windows" %} ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` -$WINDOWS_END -$LINUX_START +{% elsif os == "linux" %} ``` bash sudo apt-get update; sudo apt-get install direnv echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc ``` -$LINUX_END +{% endif %} diff --git a/_partials/es/keep_current.md b/_partials/es/keep_current.md index 45fafd5f..9e8400a1 100644 --- a/_partials/es/keep_current.md +++ b/_partials/es/keep_current.md @@ -86,21 +86,19 @@ type -a pyenv > /dev/null && eval "$(pyenv init --path)" Actualiza pyenv: -$MAC_START +{% if os == "macos" %} ``` bash brew update && brew upgrade pyenv ``` -$MAC_END -$LINUX_START +{% elsif os == "linux" %} ``` bash cd $(pyenv root) && git pull ``` -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} ``` bash cd $(pyenv root) && git pull ``` -$WINDOWS_END +{% endif %} Instala la versión actual de python: @@ -152,7 +150,7 @@ pyenv versions pip install -U pip ``` -$MAC_START +{% if os == "macos" %} Si tu computadora usa **Apple Silicon**, expande el párrafo de abajo y léelo. Si no es el caso, ignóralo.
@@ -172,17 +170,15 @@ Si tu computadora usa **Apple Intel**, expande el párrafo de abajo y léelo. Si pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/apple_intel.txt ```
-$MAC_END -$WINDOWS_START +{% elsif os == "windows" %} ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` -$WINDOWS_END -$LINUX_START +{% elsif os == "linux" %} ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` -$LINUX_END +{% endif %} ## GCP @@ -292,19 +288,17 @@ gcloud auth configure-docker ## Docker -$MAC_START +{% if os == "macos" %} Start the Docker app -$MAC_END -$LINUX_START +{% elsif os == "linux" %} Start Docker : ``` bash sudo service docker start ``` -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} Start the Docker Desktop app -$WINDOWS_END +{% endif %} Verifica que Docker pueda ejecutar la imagen de hello-world: @@ -314,16 +308,14 @@ docker run hello-world 👉 Asegúrate de que este comando se ejecute completamente -$MAC_START +{% if os == "macos" %} Stop the Docker app -$MAC_END -$LINUX_START +{% elsif os == "linux" %} Stop Docker : ``` bash sudo service docker stop ``` -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} Stop the Docker Desktop app -$WINDOWS_END +{% endif %} diff --git a/_partials/es/pip.md b/_partials/es/pip.md index 73364c74..6d12d725 100644 --- a/_partials/es/pip.md +++ b/_partials/es/pip.md @@ -10,7 +10,7 @@ pip install --upgrade pip Ahora instala algunos paquetes para las primeras semanas del programa: -$MAC_START +{% if os == "macos" %} Si tu computadora usa **Apple Silicon**, expande el párrafo de abajo y léelo. Si no es el caso, ignóralo.
@@ -30,14 +30,12 @@ Si tu computadora usa **Apple Intel**, expande el párrafo de abajo y léelo. Si pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/apple_intel.txt ```
-$MAC_END -$WINDOWS_START +{% elsif os == "windows" %} ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` -$WINDOWS_END -$LINUX_START +{% elsif os == "linux" %} ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` -$LINUX_END +{% endif %} diff --git a/_partials/gcp_setup.md b/_partials/gcp_setup.md index 599a20c1..fb4c6d43 100644 --- a/_partials/gcp_setup.md +++ b/_partials/gcp_setup.md @@ -127,21 +127,19 @@ Once the verification goes through, you should receive an email stating that "Yo - Authenticate the `gcloud` CLI with the google account you used for GCP -$MAC_START +{% if os == "macos" %} ```bash gcloud auth login ``` -$MAC_END -$LINUX_START +{% elsif os == "linux" %} ```bash gcloud auth login ``` -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} ```bash gcloud auth login --no-launch-browser ``` -$WINDOWS_END +{% endif %} - Login to your Google account on the new tab opened in your web browser - List your active account and check your email address you used for GCP is present diff --git a/_partials/keep_current.md b/_partials/keep_current.md index 86f48134..730eca0e 100644 --- a/_partials/keep_current.md +++ b/_partials/keep_current.md @@ -86,21 +86,19 @@ type -a pyenv > /dev/null && eval "$(pyenv init --path)" Update pyenv : -$MAC_START +{% if os == "macos" %} ``` bash brew update && brew upgrade pyenv ``` -$MAC_END -$LINUX_START +{% elsif os == "linux" %} ``` bash cd $(pyenv root) && git pull ``` -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} ``` bash cd $(pyenv root) && git pull ``` -$WINDOWS_END +{% endif %} Install the current python version : @@ -152,7 +150,7 @@ pyenv versions pip install -U pip ``` -$MAC_START +{% if os == "macos" %} If your computer uses **Apple Silicon**, expand the paragraph below and go through it. Otherwise ignore it.
@@ -172,17 +170,15 @@ If your computer uses **Apple Intel**, expand the paragraph below and go through pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/apple_intel.txt ```
-$MAC_END -$WINDOWS_START +{% elsif os == "windows" %} ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` -$WINDOWS_END -$LINUX_START +{% elsif os == "linux" %} ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` -$LINUX_END +{% endif %} ## GCP @@ -292,19 +288,17 @@ gcloud auth configure-docker ## Docker -$MAC_START +{% if os == "macos" %} Start the Docker app -$MAC_END -$LINUX_START +{% elsif os == "linux" %} Start Docker : ``` bash sudo service docker start ``` -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} Start the Docker Desktop app -$WINDOWS_END +{% endif %} Verify that Docker can run the hello-world image : @@ -314,16 +308,14 @@ docker run hello-world 👉 Make sure that this command completes correctly -$MAC_START +{% if os == "macos" %} Stop the Docker app -$MAC_END -$LINUX_START +{% elsif os == "linux" %} Stop Docker : ``` bash sudo service docker stop ``` -$LINUX_END -$WINDOWS_START +{% elsif os == "windows" %} Stop the Docker Desktop app -$WINDOWS_END +{% endif %} diff --git a/_partials/pip.md b/_partials/pip.md index 5147270c..090cb7a1 100644 --- a/_partials/pip.md +++ b/_partials/pip.md @@ -10,7 +10,7 @@ pip install --upgrade pip Then let's install some packages for the first weeks of the program: -$MAC_START +{% if os == "macos" %} If your computer uses **Apple Silicon**, expand the paragraph below and go through it. Otherwise ignore it.
@@ -30,14 +30,12 @@ If your computer uses **Apple Intel**, expand the paragraph below and go through pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/apple_intel.txt ```
-$MAC_END -$WINDOWS_START +{% elsif os == "windows" %} ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` -$WINDOWS_END -$LINUX_START +{% elsif os == "linux" %} ``` bash pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt ``` -$LINUX_END +{% endif %} From d5fe5fcb0dd4234654a76e09e7cb197c611e8c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 17:51:52 +0200 Subject: [PATCH 11/37] comment --- builds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds.rb b/builds.rb index 19de5e84..a2b328a8 100644 --- a/builds.rb +++ b/builds.rb @@ -228,7 +228,7 @@ LOCALES = ['', 'es'].freeze # english + spanish locales ENGLISH_ONLY = %w[REMOTE_SETUP].freeze -# Maps output filename to its OS target (for conditional block filtering) and partial list. +# Maps output build filename to its OS target (for conditional block filtering) and partial list. # Entries prefixed with "#" in a partial list are skipped (used to document excluded steps). BUILDS = { 'WINDOWS' => { os: 'windows', partials: WINDOWS }, From 21825afd85d86d28784c72bfa8dc781c5355de37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Mon, 1 Jun 2026 17:56:55 +0200 Subject: [PATCH 12/37] constants use liquid templating --- _partials/dotfiles_merge_upstream.md | 6 +++--- _partials/es/dotfiles_merge_upstream.md | 6 +++--- _partials/es/keep_current.md | 8 ++++---- _partials/es/osx_python.md | 8 ++++---- _partials/es/python_checkup.md | 8 ++++---- _partials/es/ubuntu_python.md | 6 +++--- _partials/es/virtualenv.md | 2 +- _partials/keep_current.md | 8 ++++---- _partials/osx_python.md | 10 +++++----- _partials/python_checkup.md | 8 ++++---- _partials/ubuntu_python.md | 8 ++++---- _partials/virtualenv.md | 2 +- build.rb | 4 +--- 13 files changed, 41 insertions(+), 43 deletions(-) diff --git a/_partials/dotfiles_merge_upstream.md b/_partials/dotfiles_merge_upstream.md index 9fdfa16e..879e87f5 100644 --- a/_partials/dotfiles_merge_upstream.md +++ b/_partials/dotfiles_merge_upstream.md @@ -28,11 +28,11 @@ Time to merge the changes from `lewagon/dotfiles` into yours: First abort the merge: `git merge --abort`. - Run ` .` + Run `{{ CODE_EDITOR_CMD }} .` - In , open the `zshrc` file. Replace its content with the [newest version](https://raw.githubusercontent.com/lewagon/dotfiles/master/zshrc). Save to disk. + In {{ CODE_EDITOR }}, open the `zshrc` file. Replace its content with the [newest version](https://raw.githubusercontent.com/lewagon/dotfiles/master/zshrc). Save to disk. - Still in , open the `zprofile` file. Replace its content with the [newest version](https://raw.githubusercontent.com/lewagon/dotfiles/master/zprofile). Save to disk. + Still in {{ CODE_EDITOR }}, open the `zprofile` file. Replace its content with the [newest version](https://raw.githubusercontent.com/lewagon/dotfiles/master/zprofile). Save to disk. Back in the terminal, run a `git diff` and check if this didn't remove any personal configuration setting that you wanted to keep. diff --git a/_partials/es/dotfiles_merge_upstream.md b/_partials/es/dotfiles_merge_upstream.md index 71509a62..06498340 100644 --- a/_partials/es/dotfiles_merge_upstream.md +++ b/_partials/es/dotfiles_merge_upstream.md @@ -29,11 +29,11 @@ Es hora de fusionar los cambios de lewagon/dotfiles en los tuyos: Primero aborta la merge: `git merge --abort`. - Ejecuta ` .` + Ejecuta `{{ CODE_EDITOR_CMD }} .` - En , abre el archivo zshrc. Reemplaza su contenido con la [versión más reciente](https://raw.githubusercontent.com/lewagon/dotfiles/master/zshrc). Luego guárdalo en el disco. + En {{ CODE_EDITOR }}, abre el archivo zshrc. Reemplaza su contenido con la [versión más reciente](https://raw.githubusercontent.com/lewagon/dotfiles/master/zshrc). Luego guárdalo en el disco. - Aún en , abre el archivo `zprofile`. Reemplaza su contenido con la [versión más reciente](https://raw.githubusercontent.com/lewagon/dotfiles/master/zprofile). Luego guárdalo en el disco. + Aún en {{ CODE_EDITOR }}, abre el archivo `zprofile`. Reemplaza su contenido con la [versión más reciente](https://raw.githubusercontent.com/lewagon/dotfiles/master/zprofile). Luego guárdalo en el disco. Regresa a la terminal y ejecuta un `git diff` y verifica que esto no haya eliminado ninguna configuración personal que quisieras conservar. diff --git a/_partials/es/keep_current.md b/_partials/es/keep_current.md index 9e8400a1..8cf7b7c0 100644 --- a/_partials/es/keep_current.md +++ b/_partials/es/keep_current.md @@ -103,7 +103,7 @@ cd $(pyenv root) && git pull Instala la versión actual de python: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` 👉 Asegúrate de que el comando se ejecute completamente y luego **reinicia tu terminal**. @@ -117,7 +117,7 @@ pyenv virtualenv-delete lewagon_current Crea un nuevo ambiente virtual: ```bash -pyenv virtualenv lewagon_current +pyenv virtualenv {{ PYTHON_VERSION }} lewagon_current ``` Define el nuevo ambiente virtual como predeterminado: @@ -136,8 +136,8 @@ pyenv versions ``` bash system - - /envs/lewagon_current + {{ PYTHON_VERSION }} + {{ PYTHON_VERSION }}/envs/lewagon_current 3.7.6 3.7.6/envs/lewagon * lewagon_current diff --git a/_partials/es/osx_python.md b/_partials/es/osx_python.md index 7bcafb0c..1bd23661 100644 --- a/_partials/es/osx_python.md +++ b/_partials/es/osx_python.md @@ -36,7 +36,7 @@ exec zsh Instala la [última versión estable de Python](https://www.python.org/doc/versions/) aceptada en el currículum de Le Wagon: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` Este comando puede tomar un tiempo en ejecutarse. Esto es completamente normal. ¡No dudes en ayudar a los estudiantes que estén sentados cerca de ti! @@ -61,7 +61,7 @@ export CPPFLAGS="-I/usr/local/opt/zlib/include" Luego trata de instalar Python nuevamente: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` Es posible que aparezca otro error relacionado con `bzip2`. Esto lo puedes ignorar y continuar al paso siguiente. @@ -72,8 +72,8 @@ Es posible que aparezca otro error relacionado con `bzip2`. Esto lo puedes ignor OK. Cuando este comando termine de ejecutarse, le diremos al sistema que use esta versión de Python **por defecto**. Esto se hace con: ```bash -pyenv global +pyenv global {{ PYTHON_VERSION }} exec zsh ``` -Para verificar si esto ha funcionado, ejecuta `python --version`. Si ves ``, ¡todo está bien! Si no, pídele ayuda a un TA para resolver el problema por medio `pyenv versions` y `type -a python` (`python` debería estar usando la versión `.pyenv/shims` de primero). +Para verificar si esto ha funcionado, ejecuta `python --version`. Si ves `{{ PYTHON_VERSION }}`, ¡todo está bien! Si no, pídele ayuda a un TA para resolver el problema por medio `pyenv versions` y `type -a python` (`python` debería estar usando la versión `.pyenv/shims` de primero). diff --git a/_partials/es/python_checkup.md b/_partials/es/python_checkup.md index cab57c6e..9fe5ab2e 100644 --- a/_partials/es/python_checkup.md +++ b/_partials/es/python_checkup.md @@ -10,17 +10,17 @@ cd ~/code && exec zsh Verifica tu versión de Python con los siguientes comandos: ```bash -zsh -c "$(curl -fsSL )" +zsh -c "$(curl -fsSL {{ PYTHON_CHECKER_URL }})" {{ PYTHON_VERSION }} ``` Ejecuta el comando siguiente para verificar que hayas instalado los paquetes requeridos correctamente: ```bash -zsh -c "$(curl -fsSL )" +zsh -c "$(curl -fsSL {{ PIP_CHECKER_URL }})" ``` Ahora ejecuta el siguiente comando para verificar que puedas cargar estos paquetes: ```bash -python -c "$(curl -fsSL )" +python -c "$(curl -fsSL {{ PIP_LOADER_URL }})" ``` ### Chequeo de Jupyter @@ -48,7 +48,7 @@ Asegúrate de que estés usando la versión correcta de python en el notebook. A import sys; sys.version ``` -Debería mostrar `` seguido de algunos detalles adicionales. Si no es así, consulta con un TA. +Debería mostrar `{{ PYTHON_VERSION }}` seguido de algunos detalles adicionales. Si no es así, consulta con un TA. Puedes cerrar tu navegador web y luego cerrar el servidor jupyter con `CTRL` + `C`. diff --git a/_partials/es/ubuntu_python.md b/_partials/es/ubuntu_python.md index a2ffa5fd..1a90ee9e 100644 --- a/_partials/es/ubuntu_python.md +++ b/_partials/es/ubuntu_python.md @@ -23,7 +23,7 @@ python3-dev Instala la [última versión estable de Python](https://www.python.org/doc/versions/) que sea aceptada en el currículum de Le Wagon: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` Este comando puede tomar un tiempo en ejecutarse. Esto es completamente normal. ¡No dudes en ayudar a los estudiantes que estén sentados cerca de ti! @@ -31,8 +31,8 @@ Este comando puede tomar un tiempo en ejecutarse. Esto es completamente normal. OK. Cuando este comando termine de ejecutarse, le diremos al sistema que use esta versión de Python **por defecto**. Esto se hace con: ```bash -pyenv global +pyenv global {{ PYTHON_VERSION }} exec zsh ``` -Para verificar que esto haya funcionado, ejecuta `python --version`. Si ves ``, ¡todo está bien! Si no, pídele ayuda a un TA para resolver el problema por medio de `versiones de pyenv` y `type -a python` (`python` debería estar usando la versión `.pyenv/shims` de primero). +Para verificar que esto haya funcionado, ejecuta `python --version`. Si ves `{{ PYTHON_VERSION }}`, ¡todo está bien! Si no, pídele ayuda a un TA para resolver el problema por medio de `versiones de pyenv` y `type -a python` (`python` debería estar usando la versión `.pyenv/shims` de primero). diff --git a/_partials/es/virtualenv.md b/_partials/es/virtualenv.md index 577d67f0..1f00a287 100644 --- a/_partials/es/virtualenv.md +++ b/_partials/es/virtualenv.md @@ -14,7 +14,7 @@ exec zsh Crea el entorno virtual que usaremos durante todo el bootcamp: ```bash -pyenv virtualenv lewagon +pyenv virtualenv {{ PYTHON_VERSION }} lewagon ``` Define el entorno virtual con lo siguiente: diff --git a/_partials/keep_current.md b/_partials/keep_current.md index 730eca0e..b838ee8c 100644 --- a/_partials/keep_current.md +++ b/_partials/keep_current.md @@ -103,7 +103,7 @@ cd $(pyenv root) && git pull Install the current python version : ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` 👉 Make sure that the command completes correctly and **restart your terminal** @@ -117,7 +117,7 @@ pyenv virtualenv-delete lewagon_current Create a new virtual environment : ```bash -pyenv virtualenv lewagon_current +pyenv virtualenv {{ PYTHON_VERSION }} lewagon_current ``` Set the new virtual environment as default : @@ -136,8 +136,8 @@ pyenv versions ``` bash system - - /envs/lewagon_current + {{ PYTHON_VERSION }} + {{ PYTHON_VERSION }}/envs/lewagon_current 3.10.6 3.10.6/envs/lewagon * lewagon_current diff --git a/_partials/osx_python.md b/_partials/osx_python.md index 8fdca592..17af7b48 100644 --- a/_partials/osx_python.md +++ b/_partials/osx_python.md @@ -36,7 +36,7 @@ exec zsh Let's install the [latest stable version of Python](https://www.python.org/doc/versions/) supported by Le Wagon's curriculum: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` This command might take a while, this is perfectly normal. Don't hesitate to help other students seated next to you! @@ -53,7 +53,7 @@ source ~/.zprofile Then try to install Python again: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` If `pyenv` is still not found, contact a teacher. @@ -81,7 +81,7 @@ export CPPFLAGS="-I/usr/local/opt/zlib/include" Then try to install Python again: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` It could raise another error about `bzip2`, you can ignore it and continue to the next step. @@ -92,8 +92,8 @@ It could raise another error about `bzip2`, you can ignore it and continue to th OK once this command is complete, we are going to tell the system to use this version of Python **by default**. This is done with: ```bash -pyenv global +pyenv global {{ PYTHON_VERSION }} exec zsh ``` -To check if this worked, run `python --version`. If you see ``, perfect! If not, ask a TA that will help you debug the problem thanks to `pyenv versions` and `type -a python` (`python` should be using the `.pyenv/shims` version first). +To check if this worked, run `python --version`. If you see `{{ PYTHON_VERSION }}`, perfect! If not, ask a TA that will help you debug the problem thanks to `pyenv versions` and `type -a python` (`python` should be using the `.pyenv/shims` version first). diff --git a/_partials/python_checkup.md b/_partials/python_checkup.md index 81466919..fd8439c3 100644 --- a/_partials/python_checkup.md +++ b/_partials/python_checkup.md @@ -10,17 +10,17 @@ cd ~/code && exec zsh Check your Python version with the following commands: ```bash -zsh -c "$(curl -fsSL )" +zsh -c "$(curl -fsSL {{ PYTHON_CHECKER_URL }})" {{ PYTHON_VERSION }} ``` Run the following command to check if you successfully installed the required packages: ```bash -zsh -c "$(curl -fsSL )" +zsh -c "$(curl -fsSL {{ PIP_CHECKER_URL }})" ``` Now run the following command to check if you can load these packages: ```bash -python -c "$(curl -fsSL )" +python -c "$(curl -fsSL {{ PIP_LOADER_URL }})" ``` ### Jupyter check @@ -78,7 +78,7 @@ Make sure that you are running the correct python version in the notebook. Open import sys; sys.version ``` -It should output `` followed by some more details. If not, check with a TA. +It should output `{{ PYTHON_VERSION }}` followed by some more details. If not, check with a TA. You can close your web browser then terminate the jupyter server with `CTRL` + `C`. diff --git a/_partials/ubuntu_python.md b/_partials/ubuntu_python.md index 6584fc6c..5531d17c 100644 --- a/_partials/ubuntu_python.md +++ b/_partials/ubuntu_python.md @@ -23,7 +23,7 @@ python3-dev Let's install the [latest stable version of Python](https://www.python.org/doc/versions/) supported by Le Wagon's curriculum: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` This command might take a while, this is perfectly normal. Don't hesitate to help other students seated next to you! @@ -40,7 +40,7 @@ source ~/.zprofile Then try to install Python again: ```bash -pyenv install +pyenv install {{ PYTHON_VERSION }} ``` If `pyenv` is still not found, contact a teacher. @@ -52,8 +52,8 @@ If `pyenv` is still not found, contact a teacher. OK once this command is complete, we are going to tell the system to use this version of Python **by default**. This is done with: ```bash -pyenv global +pyenv global {{ PYTHON_VERSION }} exec zsh ``` -To check if this worked, run `python --version`. If you see ``, perfect! If not, ask a TA that will help you debug the problem thanks to `pyenv versions` and `type -a python` (`python` should be using the `.pyenv/shims` version first). +To check if this worked, run `python --version`. If you see `{{ PYTHON_VERSION }}`, perfect! If not, ask a TA that will help you debug the problem thanks to `pyenv versions` and `type -a python` (`python` should be using the `.pyenv/shims` version first). diff --git a/_partials/virtualenv.md b/_partials/virtualenv.md index e7b9ca13..87a81425 100644 --- a/_partials/virtualenv.md +++ b/_partials/virtualenv.md @@ -14,7 +14,7 @@ exec zsh Let's create the virtual environment we are going to use during the whole bootcamp: ```bash -pyenv virtualenv lewagon +pyenv virtualenv {{ PYTHON_VERSION }} lewagon ``` Let's now set the virtual environment with: diff --git a/build.rb b/build.rb index c5875d6b..fabee60e 100755 --- a/build.rb +++ b/build.rb @@ -57,9 +57,7 @@ def collect_partials end def render_content(content, os_name, variables) - content = Liquid::Template.parse(content).render(variables.merge('os' => os_name)) - CONSTANTS.each { |k, v| content.gsub!("<#{k}>", v) } - content + Liquid::Template.parse(content).render(variables.merge('os' => os_name)) end def generate_files(loaded) From be766b791d0e992641a3d602085cdf0c9231717e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 09:53:35 +0200 Subject: [PATCH 13/37] move builds to yaml --- build.rb | 33 +++-- builds.rb | 242 -------------------------------- builds/LINUX.yml | 36 +++++ builds/LINUX_keep_current.yml | 5 + builds/REMOTE_SETUP.yml | 42 ++++++ builds/VM.yml | 38 +++++ builds/WINDOWS.yml | 45 ++++++ builds/WINDOWS_keep_current.yml | 5 + builds/macOS.yml | 38 +++++ builds/macOS_keep_current.yml | 5 + constants/constants.yml | 6 + 11 files changed, 239 insertions(+), 256 deletions(-) delete mode 100644 builds.rb create mode 100644 builds/LINUX.yml create mode 100644 builds/LINUX_keep_current.yml create mode 100644 builds/REMOTE_SETUP.yml create mode 100644 builds/VM.yml create mode 100644 builds/WINDOWS.yml create mode 100644 builds/WINDOWS_keep_current.yml create mode 100644 builds/macOS.yml create mode 100644 builds/macOS_keep_current.yml create mode 100644 constants/constants.yml diff --git a/build.rb b/build.rb index fabee60e..41b67366 100755 --- a/build.rb +++ b/build.rb @@ -2,8 +2,7 @@ require 'open-uri' require 'liquid' - -require_relative 'builds' +require 'yaml' def load_de_setup_partial(name, locale) name = File.join(locale, name) unless locale.empty? @@ -45,10 +44,9 @@ def partial_name(entry) = entry.is_a?(Array) ? entry[0] : entry def partial_vars(entry) = entry.is_a?(Array) ? entry[1] : {} def skipped?(entry) = partial_name(entry).start_with?("#") -def collect_partials - BUILDS.flat_map { |filename, build| - LOCALES.flat_map { |locale| - next [] if !locale.empty? && ENGLISH_ONLY.include?(filename) +def collect_partials(builds) + builds.flat_map { |_filename, build| + build[:locales].flat_map { |locale| build[:partials].reject { |e| skipped?(e) }.map { |e| [partial_name(e), locale] } } }.uniq.map { |partial, locale| @@ -60,17 +58,15 @@ def render_content(content, os_name, variables) Liquid::Template.parse(content).render(variables.merge('os' => os_name)) end -def generate_files(loaded) - LOCALES.each do |locale| - BUILDS.each do |filename, build| - next if !locale.empty? && ENGLISH_ONLY.include?(filename) - +def generate_files(loaded, builds, constants) + builds.each do |filename, build| + build[:locales].each do |locale| output = locale.empty? ? "#{filename}.md" : "#{filename}.#{locale}.md" File.open(output, "w:utf-8") do |f| build[:partials].reject { |e| skipped?(e) }.each do |entry| content = loaded["#{partial_name(entry)}.#{locale}"].clone - variables = CONSTANTS.merge(partial_vars(entry)) + variables = constants.merge(partial_vars(entry)) f << render_content(content, build[:os], variables) f << "\n\n" end @@ -79,5 +75,14 @@ def generate_files(loaded) end end -loaded = collect_partials -generate_files(loaded) +constants = YAML.load_file('constants/constants.yml').freeze + +builds = Dir['builds/*.yml'].sort.map { |f| + name = File.basename(f, '.yml') + data = YAML.load_file(f) + locales = data['locales'].map { |l| l == 'en' ? '' : l } + [name, { os: data['os'], locales: locales, partials: data['partials'] }] +}.to_h.freeze + +loaded = collect_partials(builds) +generate_files(loaded, builds, constants) diff --git a/builds.rb b/builds.rb deleted file mode 100644 index a2b328a8..00000000 --- a/builds.rb +++ /dev/null @@ -1,242 +0,0 @@ - -CONSTANTS = { - 'PYTHON_VERSION' => '3.12.9', - 'PYTHON_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh', - 'PIP_CHECKER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh', - 'PIP_LOADER_URL' => 'https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py', - 'CODE_EDITOR' => 'VS Code', - 'CODE_EDITOR_CMD' => 'code' -}.freeze - -# NOTE(ssaunier): This script needs https://github.com/lewagon/setup to be cloned as well -MAC_OS = %w[ - intro - setup/github - osx_silicon - setup/macos_command_line_tools - homebrew - setup/macos_vscode - vscode_extensions - setup/vscode_aifeatures - setup/oh_my_zsh - direnv - setup/gh_cli - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - conda_uninstall - osx_python - virtualenv - pip - nbextensions - python_checkup - dbeaver - docker - gcp_cli_setup - gcp_setup - gcp_setup_mid - gcp_setup_end - kitt - setup/macos_slack - setup/slack_settings - setup/macos_settings - kata -].freeze - -MAC_OS_KC = %w[ - keep_current - python_checkup -].freeze - -WINDOWS = %w[ - intro - setup/github - setup/windows_version - setup/windows_virtualization - setup/windows_wsl - setup/windows_ubuntu - setup/windows_vscode - setup/windows_terminal - vscode_extensions - setup/vscode_aifeatures - setup/cli_tools - setup/oh_my_zsh - windows_browser - direnv - setup/gh_cli - ubuntu_gcloud - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - setup/ssh_agent - conda_uninstall - ubuntu_python - virtualenv - pip - nbextensions - win_jupyter - python_checkup - dbeaver - setup/windows_settings - win_vs_redistributable - win_docker - gcp_setup - gcp_setup_wsl - gcp_setup_end - kitt - setup/windows_slack - setup/slack_settings - kata -].freeze - -WINDOWS_KC = %w[ - keep_current - python_checkup -].freeze - -LINUX = %w[ - intro - setup/github - setup/ubuntu_vscode - vscode_extensions - setup/vscode_aifeatures - setup/cli_tools - setup/oh_my_zsh - direnv - setup/gh_cli - ubuntu_gcloud - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - setup/ssh_agent - conda_uninstall - ubuntu_python - virtualenv - pip - nbextensions - python_checkup - dbeaver - ubuntu_docker - gcp_setup - gcp_setup_linux - gcp_setup_end - kitt - setup/ubuntu_slack - setup/slack_settings - kata -].freeze - -LINUX_KC = %w[ - keep_current - python_checkup -].freeze - -# student installs vscode, creates gcp vm, runs setup on vm -VM = %w[ - intro - setup/github - de_setup/ssh_key - de_setup/gcp_setup - de_setup/virtual_machine - de_setup/win_vscode - de_setup/vscode_remote_ssh - vscode_extensions - setup/vscode_aifeatures - setup/cli_tools - setup/oh_my_zsh - direnv - setup/gh_cli - de_setup/ubuntu_gcloud - de_setup/gcp_setup_linux - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - de_setup/zsh_default_terminal - setup/ssh_agent - ubuntu_python - virtualenv - pip - nbextensions - python_checkup - dbeaver - ubuntu_docker - kitt - setup/windows_slack - setup/slack_settings - kata -].freeze - -# student installs vscode, redeems vm provided by lewagon, runs setup on vm -REMOTE_SETUP = %w[ - intro - setup/github - de_setup/ssh_key - vm_register - vm_start - vm_test - de_setup/win_vscode - de_setup/vscode_remote_ssh - vscode_extensions - setup/vscode_aifeatures - setup/cli_tools - setup/oh_my_zsh - direnv - setup/gh_cli - #de_setup/ubuntu_gcloud - #de_setup/gcp_setup_linux - dotfiles - dotfiles_new_student - dotfiles_new_laptop - dotfiles_merge_upstream - dotfiles_same_laptop - dotfiles_merge_upstream - dotfiles_installer - de_setup/zsh_default_terminal - setup/ssh_agent - ubuntu_python - virtualenv - pip - nbextensions - python_checkup - dbeaver - ubuntu_docker - #de_setup/gcp_setup - #kitt - #setup/windows_slack - #setup/slack_settings - #kata - vm_stop - end -].freeze - -LOCALES = ['', 'es'].freeze # english + spanish locales -ENGLISH_ONLY = %w[REMOTE_SETUP].freeze - -# Maps output build filename to its OS target (for conditional block filtering) and partial list. -# Entries prefixed with "#" in a partial list are skipped (used to document excluded steps). -BUILDS = { - 'WINDOWS' => { os: 'windows', partials: WINDOWS }, - 'macOS' => { os: 'macos', partials: MAC_OS }, - 'LINUX' => { os: 'linux', partials: LINUX }, - 'WINDOWS_keep_current' => { os: 'windows', partials: WINDOWS_KC }, - 'macOS_keep_current' => { os: 'macos', partials: MAC_OS_KC }, - 'LINUX_keep_current' => { os: 'linux', partials: LINUX_KC }, - 'VM' => { os: 'linux', partials: VM }, - 'REMOTE_SETUP' => { os: 'linux', partials: REMOTE_SETUP } -}.freeze diff --git a/builds/LINUX.yml b/builds/LINUX.yml new file mode 100644 index 00000000..72ad0cc2 --- /dev/null +++ b/builds/LINUX.yml @@ -0,0 +1,36 @@ +os: linux +locales: [en, es] +partials: + - intro + - setup/github + - setup/ubuntu_vscode + - vscode_extensions + - setup/vscode_aifeatures + - setup/cli_tools + - setup/oh_my_zsh + - direnv + - setup/gh_cli + - ubuntu_gcloud + - dotfiles + - dotfiles_new_student + - dotfiles_new_laptop + - dotfiles_merge_upstream + - dotfiles_same_laptop + - dotfiles_merge_upstream + - dotfiles_installer + - setup/ssh_agent + - conda_uninstall + - ubuntu_python + - virtualenv + - pip + - nbextensions + - python_checkup + - dbeaver + - ubuntu_docker + - gcp_setup + - gcp_setup_linux + - gcp_setup_end + - kitt + - setup/ubuntu_slack + - setup/slack_settings + - kata diff --git a/builds/LINUX_keep_current.yml b/builds/LINUX_keep_current.yml new file mode 100644 index 00000000..e5ecf532 --- /dev/null +++ b/builds/LINUX_keep_current.yml @@ -0,0 +1,5 @@ +os: linux +locales: [en, es] +partials: + - keep_current + - python_checkup diff --git a/builds/REMOTE_SETUP.yml b/builds/REMOTE_SETUP.yml new file mode 100644 index 00000000..d58476ce --- /dev/null +++ b/builds/REMOTE_SETUP.yml @@ -0,0 +1,42 @@ +os: linux +locales: [en] +partials: + - intro + - setup/github + - de_setup/ssh_key + - vm_register + - vm_start + - vm_test + - de_setup/win_vscode + - de_setup/vscode_remote_ssh + - vscode_extensions + - setup/vscode_aifeatures + - setup/cli_tools + - setup/oh_my_zsh + - direnv + - setup/gh_cli + - "#de_setup/ubuntu_gcloud" + - "#de_setup/gcp_setup_linux" + - dotfiles + - dotfiles_new_student + - dotfiles_new_laptop + - dotfiles_merge_upstream + - dotfiles_same_laptop + - dotfiles_merge_upstream + - dotfiles_installer + - de_setup/zsh_default_terminal + - setup/ssh_agent + - ubuntu_python + - virtualenv + - pip + - nbextensions + - python_checkup + - dbeaver + - ubuntu_docker + - "#de_setup/gcp_setup" + - "#kitt" + - "#setup/windows_slack" + - "#setup/slack_settings" + - "#kata" + - vm_stop + - end diff --git a/builds/VM.yml b/builds/VM.yml new file mode 100644 index 00000000..f324e19e --- /dev/null +++ b/builds/VM.yml @@ -0,0 +1,38 @@ +os: linux +locales: [en, es] +partials: + - intro + - setup/github + - de_setup/ssh_key + - de_setup/gcp_setup + - de_setup/virtual_machine + - de_setup/win_vscode + - de_setup/vscode_remote_ssh + - vscode_extensions + - setup/vscode_aifeatures + - setup/cli_tools + - setup/oh_my_zsh + - direnv + - setup/gh_cli + - de_setup/ubuntu_gcloud + - de_setup/gcp_setup_linux + - dotfiles + - dotfiles_new_student + - dotfiles_new_laptop + - dotfiles_merge_upstream + - dotfiles_same_laptop + - dotfiles_merge_upstream + - dotfiles_installer + - de_setup/zsh_default_terminal + - setup/ssh_agent + - ubuntu_python + - virtualenv + - pip + - nbextensions + - python_checkup + - dbeaver + - ubuntu_docker + - kitt + - setup/windows_slack + - setup/slack_settings + - kata diff --git a/builds/WINDOWS.yml b/builds/WINDOWS.yml new file mode 100644 index 00000000..18be1a27 --- /dev/null +++ b/builds/WINDOWS.yml @@ -0,0 +1,45 @@ +os: windows +locales: [en, es] +partials: + - intro + - setup/github + - setup/windows_version + - setup/windows_virtualization + - setup/windows_wsl + - setup/windows_ubuntu + - setup/windows_vscode + - setup/windows_terminal + - vscode_extensions + - setup/vscode_aifeatures + - setup/cli_tools + - setup/oh_my_zsh + - windows_browser + - direnv + - setup/gh_cli + - ubuntu_gcloud + - dotfiles + - dotfiles_new_student + - dotfiles_new_laptop + - dotfiles_merge_upstream + - dotfiles_same_laptop + - dotfiles_merge_upstream + - dotfiles_installer + - setup/ssh_agent + - conda_uninstall + - ubuntu_python + - virtualenv + - pip + - nbextensions + - win_jupyter + - python_checkup + - dbeaver + - setup/windows_settings + - win_vs_redistributable + - win_docker + - gcp_setup + - gcp_setup_wsl + - gcp_setup_end + - kitt + - setup/windows_slack + - setup/slack_settings + - kata diff --git a/builds/WINDOWS_keep_current.yml b/builds/WINDOWS_keep_current.yml new file mode 100644 index 00000000..f287e018 --- /dev/null +++ b/builds/WINDOWS_keep_current.yml @@ -0,0 +1,5 @@ +os: windows +locales: [en, es] +partials: + - keep_current + - python_checkup diff --git a/builds/macOS.yml b/builds/macOS.yml new file mode 100644 index 00000000..4e4590f4 --- /dev/null +++ b/builds/macOS.yml @@ -0,0 +1,38 @@ +os: macos +locales: [en, es] +partials: + - intro + - setup/github + - osx_silicon + - setup/macos_command_line_tools + - homebrew + - setup/macos_vscode + - vscode_extensions + - setup/vscode_aifeatures + - setup/oh_my_zsh + - direnv + - setup/gh_cli + - dotfiles + - dotfiles_new_student + - dotfiles_new_laptop + - dotfiles_merge_upstream + - dotfiles_same_laptop + - dotfiles_merge_upstream + - dotfiles_installer + - conda_uninstall + - osx_python + - virtualenv + - pip + - nbextensions + - python_checkup + - dbeaver + - docker + - gcp_cli_setup + - gcp_setup + - gcp_setup_mid + - gcp_setup_end + - kitt + - setup/macos_slack + - setup/slack_settings + - setup/macos_settings + - kata diff --git a/builds/macOS_keep_current.yml b/builds/macOS_keep_current.yml new file mode 100644 index 00000000..d80a24ff --- /dev/null +++ b/builds/macOS_keep_current.yml @@ -0,0 +1,5 @@ +os: macos +locales: [en, es] +partials: + - keep_current + - python_checkup diff --git a/constants/constants.yml b/constants/constants.yml new file mode 100644 index 00000000..8110a6ec --- /dev/null +++ b/constants/constants.yml @@ -0,0 +1,6 @@ +PYTHON_VERSION: "3.12.9" +PYTHON_CHECKER_URL: "https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh" +PIP_CHECKER_URL: "https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh" +PIP_LOADER_URL: "https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.py" +CODE_EDITOR: "VS Code" +CODE_EDITOR_CMD: "code" From 82b80d5bcfe92c385d8569764b4bb748ea1b6ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 09:55:01 +0200 Subject: [PATCH 14/37] style --- builds/LINUX.yml | 1 + builds/LINUX_keep_current.yml | 1 + builds/REMOTE_SETUP.yml | 1 + builds/VM.yml | 1 + builds/WINDOWS.yml | 1 + builds/WINDOWS_keep_current.yml | 1 + builds/macOS.yml | 1 + builds/macOS_keep_current.yml | 1 + constants/constants.yml | 1 + 9 files changed, 9 insertions(+) diff --git a/builds/LINUX.yml b/builds/LINUX.yml index 72ad0cc2..6c7cc11f 100644 --- a/builds/LINUX.yml +++ b/builds/LINUX.yml @@ -1,3 +1,4 @@ + os: linux locales: [en, es] partials: diff --git a/builds/LINUX_keep_current.yml b/builds/LINUX_keep_current.yml index e5ecf532..a11a6364 100644 --- a/builds/LINUX_keep_current.yml +++ b/builds/LINUX_keep_current.yml @@ -1,3 +1,4 @@ + os: linux locales: [en, es] partials: diff --git a/builds/REMOTE_SETUP.yml b/builds/REMOTE_SETUP.yml index d58476ce..bae9e4a5 100644 --- a/builds/REMOTE_SETUP.yml +++ b/builds/REMOTE_SETUP.yml @@ -1,3 +1,4 @@ + os: linux locales: [en] partials: diff --git a/builds/VM.yml b/builds/VM.yml index f324e19e..ef37889f 100644 --- a/builds/VM.yml +++ b/builds/VM.yml @@ -1,3 +1,4 @@ + os: linux locales: [en, es] partials: diff --git a/builds/WINDOWS.yml b/builds/WINDOWS.yml index 18be1a27..48867b25 100644 --- a/builds/WINDOWS.yml +++ b/builds/WINDOWS.yml @@ -1,3 +1,4 @@ + os: windows locales: [en, es] partials: diff --git a/builds/WINDOWS_keep_current.yml b/builds/WINDOWS_keep_current.yml index f287e018..42310e56 100644 --- a/builds/WINDOWS_keep_current.yml +++ b/builds/WINDOWS_keep_current.yml @@ -1,3 +1,4 @@ + os: windows locales: [en, es] partials: diff --git a/builds/macOS.yml b/builds/macOS.yml index 4e4590f4..535fd42a 100644 --- a/builds/macOS.yml +++ b/builds/macOS.yml @@ -1,3 +1,4 @@ + os: macos locales: [en, es] partials: diff --git a/builds/macOS_keep_current.yml b/builds/macOS_keep_current.yml index d80a24ff..f2c7f47f 100644 --- a/builds/macOS_keep_current.yml +++ b/builds/macOS_keep_current.yml @@ -1,3 +1,4 @@ + os: macos locales: [en, es] partials: diff --git a/constants/constants.yml b/constants/constants.yml index 8110a6ec..fc248190 100644 --- a/constants/constants.yml +++ b/constants/constants.yml @@ -1,3 +1,4 @@ + PYTHON_VERSION: "3.12.9" PYTHON_CHECKER_URL: "https://raw.githubusercontent.com/lewagon/data-setup/master/checks/python_checker.sh" PIP_CHECKER_URL: "https://raw.githubusercontent.com/lewagon/data-setup/master/checks/pip_check.sh" From 34728a0fb2e2145b98a65e685c7f371ff1634aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:04:36 +0200 Subject: [PATCH 15/37] move en partials --- _partials/{ => en}/chrome.md | 0 _partials/{ => en}/conda_uninstall.md | 0 _partials/{ => en}/dbeaver.md | 0 _partials/{ => en}/direnv.md | 0 _partials/{ => en}/docker.md | 0 _partials/{ => en}/dotfiles.md | 0 _partials/{ => en}/dotfiles_installer.md | 0 _partials/{ => en}/dotfiles_merge_upstream.md | 0 _partials/{ => en}/dotfiles_new_laptop.md | 0 _partials/{ => en}/dotfiles_new_student.md | 0 _partials/{ => en}/dotfiles_same_laptop.md | 0 _partials/{ => en}/end.md | 0 _partials/{ => en}/gcp_cli_setup.md | 0 _partials/{ => en}/gcp_setup.md | 0 _partials/{ => en}/gcp_setup_end.md | 0 _partials/{ => en}/gcp_setup_linux.md | 0 _partials/{ => en}/gcp_setup_mid.md | 0 _partials/{ => en}/gcp_setup_wsl.md | 0 _partials/{ => en}/homebrew.md | 0 _partials/{ => en}/intro.md | 0 _partials/{ => en}/kata.md | 0 _partials/{ => en}/keep_current.md | 0 _partials/{ => en}/kitt.md | 0 _partials/{ => en}/nbextensions.md | 0 _partials/{ => en}/osx_python.md | 0 _partials/{ => en}/osx_silicon.md | 0 _partials/{ => en}/pip.md | 0 _partials/{ => en}/python_checkup.md | 0 _partials/{ => en}/ubuntu_docker.md | 0 _partials/{ => en}/ubuntu_gcloud.md | 0 _partials/{ => en}/ubuntu_python.md | 0 _partials/{ => en}/virtualenv.md | 0 _partials/{ => en}/vm_register.md | 0 _partials/{ => en}/vm_start.md | 0 _partials/{ => en}/vm_stop.md | 0 _partials/{ => en}/vm_test.md | 0 _partials/{ => en}/vscode_extensions.md | 0 _partials/{ => en}/win_docker.md | 0 _partials/{ => en}/win_jupyter.md | 0 _partials/{ => en}/win_vs_redistributable.md | 0 _partials/{ => en}/windows_browser.md | 0 41 files changed, 0 insertions(+), 0 deletions(-) rename _partials/{ => en}/chrome.md (100%) rename _partials/{ => en}/conda_uninstall.md (100%) rename _partials/{ => en}/dbeaver.md (100%) rename _partials/{ => en}/direnv.md (100%) rename _partials/{ => en}/docker.md (100%) rename _partials/{ => en}/dotfiles.md (100%) rename _partials/{ => en}/dotfiles_installer.md (100%) rename _partials/{ => en}/dotfiles_merge_upstream.md (100%) rename _partials/{ => en}/dotfiles_new_laptop.md (100%) rename _partials/{ => en}/dotfiles_new_student.md (100%) rename _partials/{ => en}/dotfiles_same_laptop.md (100%) rename _partials/{ => en}/end.md (100%) rename _partials/{ => en}/gcp_cli_setup.md (100%) rename _partials/{ => en}/gcp_setup.md (100%) rename _partials/{ => en}/gcp_setup_end.md (100%) rename _partials/{ => en}/gcp_setup_linux.md (100%) rename _partials/{ => en}/gcp_setup_mid.md (100%) rename _partials/{ => en}/gcp_setup_wsl.md (100%) rename _partials/{ => en}/homebrew.md (100%) rename _partials/{ => en}/intro.md (100%) rename _partials/{ => en}/kata.md (100%) rename _partials/{ => en}/keep_current.md (100%) rename _partials/{ => en}/kitt.md (100%) rename _partials/{ => en}/nbextensions.md (100%) rename _partials/{ => en}/osx_python.md (100%) rename _partials/{ => en}/osx_silicon.md (100%) rename _partials/{ => en}/pip.md (100%) rename _partials/{ => en}/python_checkup.md (100%) rename _partials/{ => en}/ubuntu_docker.md (100%) rename _partials/{ => en}/ubuntu_gcloud.md (100%) rename _partials/{ => en}/ubuntu_python.md (100%) rename _partials/{ => en}/virtualenv.md (100%) rename _partials/{ => en}/vm_register.md (100%) rename _partials/{ => en}/vm_start.md (100%) rename _partials/{ => en}/vm_stop.md (100%) rename _partials/{ => en}/vm_test.md (100%) rename _partials/{ => en}/vscode_extensions.md (100%) rename _partials/{ => en}/win_docker.md (100%) rename _partials/{ => en}/win_jupyter.md (100%) rename _partials/{ => en}/win_vs_redistributable.md (100%) rename _partials/{ => en}/windows_browser.md (100%) diff --git a/_partials/chrome.md b/_partials/en/chrome.md similarity index 100% rename from _partials/chrome.md rename to _partials/en/chrome.md diff --git a/_partials/conda_uninstall.md b/_partials/en/conda_uninstall.md similarity index 100% rename from _partials/conda_uninstall.md rename to _partials/en/conda_uninstall.md diff --git a/_partials/dbeaver.md b/_partials/en/dbeaver.md similarity index 100% rename from _partials/dbeaver.md rename to _partials/en/dbeaver.md diff --git a/_partials/direnv.md b/_partials/en/direnv.md similarity index 100% rename from _partials/direnv.md rename to _partials/en/direnv.md diff --git a/_partials/docker.md b/_partials/en/docker.md similarity index 100% rename from _partials/docker.md rename to _partials/en/docker.md diff --git a/_partials/dotfiles.md b/_partials/en/dotfiles.md similarity index 100% rename from _partials/dotfiles.md rename to _partials/en/dotfiles.md diff --git a/_partials/dotfiles_installer.md b/_partials/en/dotfiles_installer.md similarity index 100% rename from _partials/dotfiles_installer.md rename to _partials/en/dotfiles_installer.md diff --git a/_partials/dotfiles_merge_upstream.md b/_partials/en/dotfiles_merge_upstream.md similarity index 100% rename from _partials/dotfiles_merge_upstream.md rename to _partials/en/dotfiles_merge_upstream.md diff --git a/_partials/dotfiles_new_laptop.md b/_partials/en/dotfiles_new_laptop.md similarity index 100% rename from _partials/dotfiles_new_laptop.md rename to _partials/en/dotfiles_new_laptop.md diff --git a/_partials/dotfiles_new_student.md b/_partials/en/dotfiles_new_student.md similarity index 100% rename from _partials/dotfiles_new_student.md rename to _partials/en/dotfiles_new_student.md diff --git a/_partials/dotfiles_same_laptop.md b/_partials/en/dotfiles_same_laptop.md similarity index 100% rename from _partials/dotfiles_same_laptop.md rename to _partials/en/dotfiles_same_laptop.md diff --git a/_partials/end.md b/_partials/en/end.md similarity index 100% rename from _partials/end.md rename to _partials/en/end.md diff --git a/_partials/gcp_cli_setup.md b/_partials/en/gcp_cli_setup.md similarity index 100% rename from _partials/gcp_cli_setup.md rename to _partials/en/gcp_cli_setup.md diff --git a/_partials/gcp_setup.md b/_partials/en/gcp_setup.md similarity index 100% rename from _partials/gcp_setup.md rename to _partials/en/gcp_setup.md diff --git a/_partials/gcp_setup_end.md b/_partials/en/gcp_setup_end.md similarity index 100% rename from _partials/gcp_setup_end.md rename to _partials/en/gcp_setup_end.md diff --git a/_partials/gcp_setup_linux.md b/_partials/en/gcp_setup_linux.md similarity index 100% rename from _partials/gcp_setup_linux.md rename to _partials/en/gcp_setup_linux.md diff --git a/_partials/gcp_setup_mid.md b/_partials/en/gcp_setup_mid.md similarity index 100% rename from _partials/gcp_setup_mid.md rename to _partials/en/gcp_setup_mid.md diff --git a/_partials/gcp_setup_wsl.md b/_partials/en/gcp_setup_wsl.md similarity index 100% rename from _partials/gcp_setup_wsl.md rename to _partials/en/gcp_setup_wsl.md diff --git a/_partials/homebrew.md b/_partials/en/homebrew.md similarity index 100% rename from _partials/homebrew.md rename to _partials/en/homebrew.md diff --git a/_partials/intro.md b/_partials/en/intro.md similarity index 100% rename from _partials/intro.md rename to _partials/en/intro.md diff --git a/_partials/kata.md b/_partials/en/kata.md similarity index 100% rename from _partials/kata.md rename to _partials/en/kata.md diff --git a/_partials/keep_current.md b/_partials/en/keep_current.md similarity index 100% rename from _partials/keep_current.md rename to _partials/en/keep_current.md diff --git a/_partials/kitt.md b/_partials/en/kitt.md similarity index 100% rename from _partials/kitt.md rename to _partials/en/kitt.md diff --git a/_partials/nbextensions.md b/_partials/en/nbextensions.md similarity index 100% rename from _partials/nbextensions.md rename to _partials/en/nbextensions.md diff --git a/_partials/osx_python.md b/_partials/en/osx_python.md similarity index 100% rename from _partials/osx_python.md rename to _partials/en/osx_python.md diff --git a/_partials/osx_silicon.md b/_partials/en/osx_silicon.md similarity index 100% rename from _partials/osx_silicon.md rename to _partials/en/osx_silicon.md diff --git a/_partials/pip.md b/_partials/en/pip.md similarity index 100% rename from _partials/pip.md rename to _partials/en/pip.md diff --git a/_partials/python_checkup.md b/_partials/en/python_checkup.md similarity index 100% rename from _partials/python_checkup.md rename to _partials/en/python_checkup.md diff --git a/_partials/ubuntu_docker.md b/_partials/en/ubuntu_docker.md similarity index 100% rename from _partials/ubuntu_docker.md rename to _partials/en/ubuntu_docker.md diff --git a/_partials/ubuntu_gcloud.md b/_partials/en/ubuntu_gcloud.md similarity index 100% rename from _partials/ubuntu_gcloud.md rename to _partials/en/ubuntu_gcloud.md diff --git a/_partials/ubuntu_python.md b/_partials/en/ubuntu_python.md similarity index 100% rename from _partials/ubuntu_python.md rename to _partials/en/ubuntu_python.md diff --git a/_partials/virtualenv.md b/_partials/en/virtualenv.md similarity index 100% rename from _partials/virtualenv.md rename to _partials/en/virtualenv.md diff --git a/_partials/vm_register.md b/_partials/en/vm_register.md similarity index 100% rename from _partials/vm_register.md rename to _partials/en/vm_register.md diff --git a/_partials/vm_start.md b/_partials/en/vm_start.md similarity index 100% rename from _partials/vm_start.md rename to _partials/en/vm_start.md diff --git a/_partials/vm_stop.md b/_partials/en/vm_stop.md similarity index 100% rename from _partials/vm_stop.md rename to _partials/en/vm_stop.md diff --git a/_partials/vm_test.md b/_partials/en/vm_test.md similarity index 100% rename from _partials/vm_test.md rename to _partials/en/vm_test.md diff --git a/_partials/vscode_extensions.md b/_partials/en/vscode_extensions.md similarity index 100% rename from _partials/vscode_extensions.md rename to _partials/en/vscode_extensions.md diff --git a/_partials/win_docker.md b/_partials/en/win_docker.md similarity index 100% rename from _partials/win_docker.md rename to _partials/en/win_docker.md diff --git a/_partials/win_jupyter.md b/_partials/en/win_jupyter.md similarity index 100% rename from _partials/win_jupyter.md rename to _partials/en/win_jupyter.md diff --git a/_partials/win_vs_redistributable.md b/_partials/en/win_vs_redistributable.md similarity index 100% rename from _partials/win_vs_redistributable.md rename to _partials/en/win_vs_redistributable.md diff --git a/_partials/windows_browser.md b/_partials/en/windows_browser.md similarity index 100% rename from _partials/windows_browser.md rename to _partials/en/windows_browser.md From 3a83911efc019f79d0f3c34faf11c632124a3308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:04:46 +0200 Subject: [PATCH 16/37] move en partials --- build.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/build.rb b/build.rb index 41b67366..f7917307 100755 --- a/build.rb +++ b/build.rb @@ -5,7 +5,8 @@ require 'yaml' def load_de_setup_partial(name, locale) - name = File.join(locale, name) unless locale.empty? + remote_locale = locale == 'en' ? '' : locale + name = File.join(remote_locale, name) unless remote_locale.empty? file = File.join("_partials", "#{name}.md") content = URI.open("https://raw.githubusercontent.com/lewagon/data-engineering-setup/main/#{file}").read content.scan(/\!\[.*\]\((.*)\)/).flatten @@ -17,7 +18,8 @@ def load_de_setup_partial(name, locale) end def load_setup_partial(name, locale) - name = File.join(locale, name) unless locale.empty? + remote_locale = locale == 'en' ? '' : locale + name = File.join(remote_locale, name) unless remote_locale.empty? file = File.join("_partials", "#{name}.md") content = URI.open("https://raw.githubusercontent.com/lewagon/setup/master/#{file}").read content.scan(/\!\[.*\]\((.*)\)/).flatten @@ -26,8 +28,7 @@ def load_setup_partial(name, locale) end def load_local_partial(name, locale) - name = File.join(locale, name) unless locale.empty? - File.read(File.join("_partials", "#{name}.md"), encoding: "utf-8") + File.read(File.join("_partials", locale, "#{name}.md"), encoding: "utf-8") end def load_partial(partial, locale) @@ -61,7 +62,7 @@ def render_content(content, os_name, variables) def generate_files(loaded, builds, constants) builds.each do |filename, build| build[:locales].each do |locale| - output = locale.empty? ? "#{filename}.md" : "#{filename}.#{locale}.md" + output = locale == 'en' ? "#{filename}.md" : "#{filename}.#{locale}.md" File.open(output, "w:utf-8") do |f| build[:partials].reject { |e| skipped?(e) }.each do |entry| @@ -80,7 +81,7 @@ def generate_files(loaded, builds, constants) builds = Dir['builds/*.yml'].sort.map { |f| name = File.basename(f, '.yml') data = YAML.load_file(f) - locales = data['locales'].map { |l| l == 'en' ? '' : l } + locales = data['locales'] [name, { os: data['os'], locales: locales, partials: data['partials'] }] }.to_h.freeze From 0cef27fcb0158cb1ee7636bd8fd67567a28186b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:06:34 +0200 Subject: [PATCH 17/37] style --- build.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.rb b/build.rb index f7917307..a784ac5f 100755 --- a/build.rb +++ b/build.rb @@ -81,8 +81,7 @@ def generate_files(loaded, builds, constants) builds = Dir['builds/*.yml'].sort.map { |f| name = File.basename(f, '.yml') data = YAML.load_file(f) - locales = data['locales'] - [name, { os: data['os'], locales: locales, partials: data['partials'] }] + [name, { os: data['os'], locales: data['locales'], partials: data['partials'] }] }.to_h.freeze loaded = collect_partials(builds) From 48e9c39e3ff77b408e2693ba0719d78bd8f1ad10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:09:57 +0200 Subject: [PATCH 18/37] style --- build.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rb b/build.rb index a784ac5f..347e96e1 100755 --- a/build.rb +++ b/build.rb @@ -78,7 +78,7 @@ def generate_files(loaded, builds, constants) constants = YAML.load_file('constants/constants.yml').freeze -builds = Dir['builds/*.yml'].sort.map { |f| +builds = Dir['builds/*.yml'].map { |f| name = File.basename(f, '.yml') data = YAML.load_file(f) [name, { os: data['os'], locales: data['locales'], partials: data['partials'] }] From 8e3db43637796d048a0fd8d76dfdad339781d4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:19:52 +0200 Subject: [PATCH 19/37] style --- build.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.rb b/build.rb index 347e96e1..a7c96ae1 100755 --- a/build.rb +++ b/build.rb @@ -76,8 +76,6 @@ def generate_files(loaded, builds, constants) end end -constants = YAML.load_file('constants/constants.yml').freeze - builds = Dir['builds/*.yml'].map { |f| name = File.basename(f, '.yml') data = YAML.load_file(f) @@ -85,4 +83,7 @@ def generate_files(loaded, builds, constants) }.to_h.freeze loaded = collect_partials(builds) + +constants = YAML.load_file('constants/constants.yml').freeze + generate_files(loaded, builds, constants) From 44c394c1aee4d2ec67592252b6564975a9f239c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:22:19 +0200 Subject: [PATCH 20/37] remove skip logic --- build.rb | 5 ++--- builds/REMOTE_SETUP.yml | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/build.rb b/build.rb index a7c96ae1..7045b504 100755 --- a/build.rb +++ b/build.rb @@ -43,12 +43,11 @@ def load_partial(partial, locale) def partial_name(entry) = entry.is_a?(Array) ? entry[0] : entry def partial_vars(entry) = entry.is_a?(Array) ? entry[1] : {} -def skipped?(entry) = partial_name(entry).start_with?("#") def collect_partials(builds) builds.flat_map { |_filename, build| build[:locales].flat_map { |locale| - build[:partials].reject { |e| skipped?(e) }.map { |e| [partial_name(e), locale] } + build[:partials].map { |e| [partial_name(e), locale] } } }.uniq.map { |partial, locale| ["#{partial}.#{locale}", load_partial(partial, locale)] @@ -65,7 +64,7 @@ def generate_files(loaded, builds, constants) output = locale == 'en' ? "#{filename}.md" : "#{filename}.#{locale}.md" File.open(output, "w:utf-8") do |f| - build[:partials].reject { |e| skipped?(e) }.each do |entry| + build[:partials].each do |entry| content = loaded["#{partial_name(entry)}.#{locale}"].clone variables = constants.merge(partial_vars(entry)) f << render_content(content, build[:os], variables) diff --git a/builds/REMOTE_SETUP.yml b/builds/REMOTE_SETUP.yml index bae9e4a5..9a2f6608 100644 --- a/builds/REMOTE_SETUP.yml +++ b/builds/REMOTE_SETUP.yml @@ -16,8 +16,8 @@ partials: - setup/oh_my_zsh - direnv - setup/gh_cli - - "#de_setup/ubuntu_gcloud" - - "#de_setup/gcp_setup_linux" + # - de_setup/ubuntu_gcloud + # - de_setup/gcp_setup_linux - dotfiles - dotfiles_new_student - dotfiles_new_laptop @@ -34,10 +34,10 @@ partials: - python_checkup - dbeaver - ubuntu_docker - - "#de_setup/gcp_setup" - - "#kitt" - - "#setup/windows_slack" - - "#setup/slack_settings" - - "#kata" + # - de_setup/gcp_setup + # - kitt + # - setup/windows_slack + # - setup/slack_settings + # - kata - vm_stop - end From f6cba522602f34c8109da0b1ec2f6fd1adcc6e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:30:56 +0200 Subject: [PATCH 21/37] clarify remote partial load --- build.rb | 33 +++++++++++++-------------------- constants/repos.yml | 6 ++++++ 2 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 constants/repos.yml diff --git a/build.rb b/build.rb index 7045b504..8be3de3d 100755 --- a/build.rb +++ b/build.rb @@ -4,26 +4,21 @@ require 'liquid' require 'yaml' -def load_de_setup_partial(name, locale) +REPOS = YAML.load_file('constants/repos.yml').fetch('repos').freeze +REPO_ALIASES = REPOS.filter_map { |name, cfg| [cfg['alias'], name] if cfg['alias'] }.to_h.freeze + +def load_remote_partial(repo, name, locale) + repo = REPO_ALIASES[repo] || repo + branch = REPOS.dig(repo, 'branch') || 'main' remote_locale = locale == 'en' ? '' : locale - name = File.join(remote_locale, name) unless remote_locale.empty? - file = File.join("_partials", "#{name}.md") - content = URI.open("https://raw.githubusercontent.com/lewagon/data-engineering-setup/main/#{file}").read + path = remote_locale.empty? ? name : "#{remote_locale}/#{name}" + base_url = "https://github.com/lewagon/#{repo}/blob/#{branch}" + content = URI.open("https://raw.githubusercontent.com/lewagon/#{repo}/#{branch}/_partials/#{path}.md").read content.scan(/\!\[.*\]\((.*)\)/).flatten .reject { |ip| ip.start_with?("http") } - .each { |ip| content.gsub!(ip, "https://github.com/lewagon/data-engineering-setup/blob/main/#{ip}") } + .each { |ip| content.gsub!(ip, "#{base_url}/#{ip}") } content.scan(/src="(images\/.*)"/).flatten - .each { |ip| content.gsub!(ip, "https://github.com/lewagon/data-engineering-setup/blob/main/#{ip}") } - content -end - -def load_setup_partial(name, locale) - remote_locale = locale == 'en' ? '' : locale - name = File.join(remote_locale, name) unless remote_locale.empty? - file = File.join("_partials", "#{name}.md") - content = URI.open("https://raw.githubusercontent.com/lewagon/setup/master/#{file}").read - content.scan(/\!\[.*\]\((.*)\)/).flatten - .each { |ip| content.gsub!(ip, "https://github.com/lewagon/setup/blob/master/#{ip}") } + .each { |ip| content.gsub!(ip, "#{base_url}/#{ip}") } content end @@ -32,10 +27,8 @@ def load_local_partial(name, locale) end def load_partial(partial, locale) - if (m = partial.match(%r{\Ade_setup/(?[0-9a-z_]+)\z})) - load_de_setup_partial(m[:name], locale) - elsif (m = partial.match(%r{\Asetup/(?[0-9a-z_]+)\z})) - load_setup_partial(m[:name], locale) + if (m = partial.match(%r{\A(?[a-z][a-z0-9_-]*)/(?[a-z0-9_]+)\z})) + load_remote_partial(m[:repo], m[:name], locale) else load_local_partial(partial, locale) end diff --git a/constants/repos.yml b/constants/repos.yml new file mode 100644 index 00000000..ad94eac9 --- /dev/null +++ b/constants/repos.yml @@ -0,0 +1,6 @@ +repos: + setup: + branch: master + data-engineering-setup: + branch: main + alias: de_setup From 6dd42a219f22a2d7207b93a87f427c8ae58bef9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:36:09 +0200 Subject: [PATCH 22/37] default --- constants/repos.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/constants/repos.yml b/constants/repos.yml index ad94eac9..1dd9999d 100644 --- a/constants/repos.yml +++ b/constants/repos.yml @@ -2,5 +2,4 @@ repos: setup: branch: master data-engineering-setup: - branch: main alias: de_setup From 962083526cb31b3ae9a5c1290110043fef3b5e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:39:12 +0200 Subject: [PATCH 23/37] style --- build.rb | 7 ++++--- constants/repos.yml | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/build.rb b/build.rb index 8be3de3d..6c91ed6f 100755 --- a/build.rb +++ b/build.rb @@ -4,12 +4,13 @@ require 'liquid' require 'yaml' -REPOS = YAML.load_file('constants/repos.yml').fetch('repos').freeze -REPO_ALIASES = REPOS.filter_map { |name, cfg| [cfg['alias'], name] if cfg['alias'] }.to_h.freeze +_repos_cfg = YAML.load_file('constants/repos.yml') +REPO_BRANCHES = (_repos_cfg['branches'] || {}).freeze +REPO_ALIASES = (_repos_cfg['aliases'] || {}).freeze def load_remote_partial(repo, name, locale) repo = REPO_ALIASES[repo] || repo - branch = REPOS.dig(repo, 'branch') || 'main' + branch = REPO_BRANCHES[repo] || 'main' remote_locale = locale == 'en' ? '' : locale path = remote_locale.empty? ? name : "#{remote_locale}/#{name}" base_url = "https://github.com/lewagon/#{repo}/blob/#{branch}" diff --git a/constants/repos.yml b/constants/repos.yml index 1dd9999d..4314b528 100644 --- a/constants/repos.yml +++ b/constants/repos.yml @@ -1,5 +1,5 @@ -repos: - setup: - branch: master - data-engineering-setup: - alias: de_setup +branches: + setup: master + +aliases: + de_setup: data-engineering-setup From bd349d5046badfc586ddcdc9cef6cbbbb4c5ce9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:43:25 +0200 Subject: [PATCH 24/37] style --- build.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/build.rb b/build.rb index 6c91ed6f..6ca612ed 100755 --- a/build.rb +++ b/build.rb @@ -4,15 +4,12 @@ require 'liquid' require 'yaml' -_repos_cfg = YAML.load_file('constants/repos.yml') -REPO_BRANCHES = (_repos_cfg['branches'] || {}).freeze -REPO_ALIASES = (_repos_cfg['aliases'] || {}).freeze +REPOS_CFG = YAML.load_file('constants/repos.yml').freeze def load_remote_partial(repo, name, locale) - repo = REPO_ALIASES[repo] || repo - branch = REPO_BRANCHES[repo] || 'main' - remote_locale = locale == 'en' ? '' : locale - path = remote_locale.empty? ? name : "#{remote_locale}/#{name}" + repo = REPOS_CFG.dig('aliases', repo) || repo + branch = REPOS_CFG.dig('branches', repo) || 'main' + path = locale == 'en' ? name : "#{locale}/#{name}" base_url = "https://github.com/lewagon/#{repo}/blob/#{branch}" content = URI.open("https://raw.githubusercontent.com/lewagon/#{repo}/#{branch}/_partials/#{path}.md").read content.scan(/\!\[.*\]\((.*)\)/).flatten From a226254bb057c70cb34ae089b01f94ad00a32fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:47:26 +0200 Subject: [PATCH 25/37] move back partials --- _partials/{en => }/chrome.md | 0 _partials/{en => }/conda_uninstall.md | 0 _partials/{en => }/dbeaver.md | 0 _partials/{en => }/direnv.md | 0 _partials/{en => }/docker.md | 0 _partials/{en => }/dotfiles.md | 0 _partials/{en => }/dotfiles_installer.md | 0 _partials/{en => }/dotfiles_merge_upstream.md | 0 _partials/{en => }/dotfiles_new_laptop.md | 0 _partials/{en => }/dotfiles_new_student.md | 0 _partials/{en => }/dotfiles_same_laptop.md | 0 _partials/{en => }/end.md | 0 _partials/{en => }/gcp_cli_setup.md | 0 _partials/{en => }/gcp_setup.md | 0 _partials/{en => }/gcp_setup_end.md | 0 _partials/{en => }/gcp_setup_linux.md | 0 _partials/{en => }/gcp_setup_mid.md | 0 _partials/{en => }/gcp_setup_wsl.md | 0 _partials/{en => }/homebrew.md | 0 _partials/{en => }/intro.md | 0 _partials/{en => }/kata.md | 0 _partials/{en => }/keep_current.md | 0 _partials/{en => }/kitt.md | 0 _partials/{en => }/nbextensions.md | 0 _partials/{en => }/osx_python.md | 0 _partials/{en => }/osx_silicon.md | 0 _partials/{en => }/pip.md | 0 _partials/{en => }/python_checkup.md | 0 _partials/{en => }/ubuntu_docker.md | 0 _partials/{en => }/ubuntu_gcloud.md | 0 _partials/{en => }/ubuntu_python.md | 0 _partials/{en => }/virtualenv.md | 0 _partials/{en => }/vm_register.md | 0 _partials/{en => }/vm_start.md | 0 _partials/{en => }/vm_stop.md | 0 _partials/{en => }/vm_test.md | 0 _partials/{en => }/vscode_extensions.md | 0 _partials/{en => }/win_docker.md | 0 _partials/{en => }/win_jupyter.md | 0 _partials/{en => }/win_vs_redistributable.md | 0 _partials/{en => }/windows_browser.md | 0 41 files changed, 0 insertions(+), 0 deletions(-) rename _partials/{en => }/chrome.md (100%) rename _partials/{en => }/conda_uninstall.md (100%) rename _partials/{en => }/dbeaver.md (100%) rename _partials/{en => }/direnv.md (100%) rename _partials/{en => }/docker.md (100%) rename _partials/{en => }/dotfiles.md (100%) rename _partials/{en => }/dotfiles_installer.md (100%) rename _partials/{en => }/dotfiles_merge_upstream.md (100%) rename _partials/{en => }/dotfiles_new_laptop.md (100%) rename _partials/{en => }/dotfiles_new_student.md (100%) rename _partials/{en => }/dotfiles_same_laptop.md (100%) rename _partials/{en => }/end.md (100%) rename _partials/{en => }/gcp_cli_setup.md (100%) rename _partials/{en => }/gcp_setup.md (100%) rename _partials/{en => }/gcp_setup_end.md (100%) rename _partials/{en => }/gcp_setup_linux.md (100%) rename _partials/{en => }/gcp_setup_mid.md (100%) rename _partials/{en => }/gcp_setup_wsl.md (100%) rename _partials/{en => }/homebrew.md (100%) rename _partials/{en => }/intro.md (100%) rename _partials/{en => }/kata.md (100%) rename _partials/{en => }/keep_current.md (100%) rename _partials/{en => }/kitt.md (100%) rename _partials/{en => }/nbextensions.md (100%) rename _partials/{en => }/osx_python.md (100%) rename _partials/{en => }/osx_silicon.md (100%) rename _partials/{en => }/pip.md (100%) rename _partials/{en => }/python_checkup.md (100%) rename _partials/{en => }/ubuntu_docker.md (100%) rename _partials/{en => }/ubuntu_gcloud.md (100%) rename _partials/{en => }/ubuntu_python.md (100%) rename _partials/{en => }/virtualenv.md (100%) rename _partials/{en => }/vm_register.md (100%) rename _partials/{en => }/vm_start.md (100%) rename _partials/{en => }/vm_stop.md (100%) rename _partials/{en => }/vm_test.md (100%) rename _partials/{en => }/vscode_extensions.md (100%) rename _partials/{en => }/win_docker.md (100%) rename _partials/{en => }/win_jupyter.md (100%) rename _partials/{en => }/win_vs_redistributable.md (100%) rename _partials/{en => }/windows_browser.md (100%) diff --git a/_partials/en/chrome.md b/_partials/chrome.md similarity index 100% rename from _partials/en/chrome.md rename to _partials/chrome.md diff --git a/_partials/en/conda_uninstall.md b/_partials/conda_uninstall.md similarity index 100% rename from _partials/en/conda_uninstall.md rename to _partials/conda_uninstall.md diff --git a/_partials/en/dbeaver.md b/_partials/dbeaver.md similarity index 100% rename from _partials/en/dbeaver.md rename to _partials/dbeaver.md diff --git a/_partials/en/direnv.md b/_partials/direnv.md similarity index 100% rename from _partials/en/direnv.md rename to _partials/direnv.md diff --git a/_partials/en/docker.md b/_partials/docker.md similarity index 100% rename from _partials/en/docker.md rename to _partials/docker.md diff --git a/_partials/en/dotfiles.md b/_partials/dotfiles.md similarity index 100% rename from _partials/en/dotfiles.md rename to _partials/dotfiles.md diff --git a/_partials/en/dotfiles_installer.md b/_partials/dotfiles_installer.md similarity index 100% rename from _partials/en/dotfiles_installer.md rename to _partials/dotfiles_installer.md diff --git a/_partials/en/dotfiles_merge_upstream.md b/_partials/dotfiles_merge_upstream.md similarity index 100% rename from _partials/en/dotfiles_merge_upstream.md rename to _partials/dotfiles_merge_upstream.md diff --git a/_partials/en/dotfiles_new_laptop.md b/_partials/dotfiles_new_laptop.md similarity index 100% rename from _partials/en/dotfiles_new_laptop.md rename to _partials/dotfiles_new_laptop.md diff --git a/_partials/en/dotfiles_new_student.md b/_partials/dotfiles_new_student.md similarity index 100% rename from _partials/en/dotfiles_new_student.md rename to _partials/dotfiles_new_student.md diff --git a/_partials/en/dotfiles_same_laptop.md b/_partials/dotfiles_same_laptop.md similarity index 100% rename from _partials/en/dotfiles_same_laptop.md rename to _partials/dotfiles_same_laptop.md diff --git a/_partials/en/end.md b/_partials/end.md similarity index 100% rename from _partials/en/end.md rename to _partials/end.md diff --git a/_partials/en/gcp_cli_setup.md b/_partials/gcp_cli_setup.md similarity index 100% rename from _partials/en/gcp_cli_setup.md rename to _partials/gcp_cli_setup.md diff --git a/_partials/en/gcp_setup.md b/_partials/gcp_setup.md similarity index 100% rename from _partials/en/gcp_setup.md rename to _partials/gcp_setup.md diff --git a/_partials/en/gcp_setup_end.md b/_partials/gcp_setup_end.md similarity index 100% rename from _partials/en/gcp_setup_end.md rename to _partials/gcp_setup_end.md diff --git a/_partials/en/gcp_setup_linux.md b/_partials/gcp_setup_linux.md similarity index 100% rename from _partials/en/gcp_setup_linux.md rename to _partials/gcp_setup_linux.md diff --git a/_partials/en/gcp_setup_mid.md b/_partials/gcp_setup_mid.md similarity index 100% rename from _partials/en/gcp_setup_mid.md rename to _partials/gcp_setup_mid.md diff --git a/_partials/en/gcp_setup_wsl.md b/_partials/gcp_setup_wsl.md similarity index 100% rename from _partials/en/gcp_setup_wsl.md rename to _partials/gcp_setup_wsl.md diff --git a/_partials/en/homebrew.md b/_partials/homebrew.md similarity index 100% rename from _partials/en/homebrew.md rename to _partials/homebrew.md diff --git a/_partials/en/intro.md b/_partials/intro.md similarity index 100% rename from _partials/en/intro.md rename to _partials/intro.md diff --git a/_partials/en/kata.md b/_partials/kata.md similarity index 100% rename from _partials/en/kata.md rename to _partials/kata.md diff --git a/_partials/en/keep_current.md b/_partials/keep_current.md similarity index 100% rename from _partials/en/keep_current.md rename to _partials/keep_current.md diff --git a/_partials/en/kitt.md b/_partials/kitt.md similarity index 100% rename from _partials/en/kitt.md rename to _partials/kitt.md diff --git a/_partials/en/nbextensions.md b/_partials/nbextensions.md similarity index 100% rename from _partials/en/nbextensions.md rename to _partials/nbextensions.md diff --git a/_partials/en/osx_python.md b/_partials/osx_python.md similarity index 100% rename from _partials/en/osx_python.md rename to _partials/osx_python.md diff --git a/_partials/en/osx_silicon.md b/_partials/osx_silicon.md similarity index 100% rename from _partials/en/osx_silicon.md rename to _partials/osx_silicon.md diff --git a/_partials/en/pip.md b/_partials/pip.md similarity index 100% rename from _partials/en/pip.md rename to _partials/pip.md diff --git a/_partials/en/python_checkup.md b/_partials/python_checkup.md similarity index 100% rename from _partials/en/python_checkup.md rename to _partials/python_checkup.md diff --git a/_partials/en/ubuntu_docker.md b/_partials/ubuntu_docker.md similarity index 100% rename from _partials/en/ubuntu_docker.md rename to _partials/ubuntu_docker.md diff --git a/_partials/en/ubuntu_gcloud.md b/_partials/ubuntu_gcloud.md similarity index 100% rename from _partials/en/ubuntu_gcloud.md rename to _partials/ubuntu_gcloud.md diff --git a/_partials/en/ubuntu_python.md b/_partials/ubuntu_python.md similarity index 100% rename from _partials/en/ubuntu_python.md rename to _partials/ubuntu_python.md diff --git a/_partials/en/virtualenv.md b/_partials/virtualenv.md similarity index 100% rename from _partials/en/virtualenv.md rename to _partials/virtualenv.md diff --git a/_partials/en/vm_register.md b/_partials/vm_register.md similarity index 100% rename from _partials/en/vm_register.md rename to _partials/vm_register.md diff --git a/_partials/en/vm_start.md b/_partials/vm_start.md similarity index 100% rename from _partials/en/vm_start.md rename to _partials/vm_start.md diff --git a/_partials/en/vm_stop.md b/_partials/vm_stop.md similarity index 100% rename from _partials/en/vm_stop.md rename to _partials/vm_stop.md diff --git a/_partials/en/vm_test.md b/_partials/vm_test.md similarity index 100% rename from _partials/en/vm_test.md rename to _partials/vm_test.md diff --git a/_partials/en/vscode_extensions.md b/_partials/vscode_extensions.md similarity index 100% rename from _partials/en/vscode_extensions.md rename to _partials/vscode_extensions.md diff --git a/_partials/en/win_docker.md b/_partials/win_docker.md similarity index 100% rename from _partials/en/win_docker.md rename to _partials/win_docker.md diff --git a/_partials/en/win_jupyter.md b/_partials/win_jupyter.md similarity index 100% rename from _partials/en/win_jupyter.md rename to _partials/win_jupyter.md diff --git a/_partials/en/win_vs_redistributable.md b/_partials/win_vs_redistributable.md similarity index 100% rename from _partials/en/win_vs_redistributable.md rename to _partials/win_vs_redistributable.md diff --git a/_partials/en/windows_browser.md b/_partials/windows_browser.md similarity index 100% rename from _partials/en/windows_browser.md rename to _partials/windows_browser.md From 6216cdac69eb0dcc66529f3d827f2f3dfcc4e573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:49:09 +0200 Subject: [PATCH 26/37] move back partials --- build.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.rb b/build.rb index 6ca612ed..34c1e619 100755 --- a/build.rb +++ b/build.rb @@ -21,7 +21,8 @@ def load_remote_partial(repo, name, locale) end def load_local_partial(name, locale) - File.read(File.join("_partials", locale, "#{name}.md"), encoding: "utf-8") + path = locale == 'en' ? "_partials/#{name}.md" : "_partials/#{locale}/#{name}.md" + File.read(path, encoding: "utf-8") end def load_partial(partial, locale) From ae28437518719bd4018717a82d8621e1683ed5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:51:29 +0200 Subject: [PATCH 27/37] fix warning --- Gemfile | 1 + Gemfile.lock | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index ba8a2be1..632fced6 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,4 @@ source "https://rubygems.org" gem "liquid" gem "base64" +gem "cgi" diff --git a/Gemfile.lock b/Gemfile.lock index 4d67771b..29d32bb0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ GEM specs: base64 (0.3.0) bigdecimal (4.1.2) + cgi (0.5.1) liquid (5.12.0) bigdecimal strscan (>= 3.1.1) @@ -14,11 +15,13 @@ PLATFORMS DEPENDENCIES base64 + cgi liquid CHECKSUMS base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd + cgi (0.5.1) sha256=e93fcafc69b8a934fe1e6146121fa35430efa8b4a4047c4893764067036f18e9 liquid (5.12.0) sha256=5a3c2c2430cd925d21c53e4ed9abea52cd0a9da53b541422f81dee79aca2a673 strscan (3.1.8) sha256=aae2db611a225559f21ffbb71765c9a4e60fd262534a9ea84f4f11c7f32f679e From a9ab3a8ec1e06106edca8164c133d288d0ab7983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 11:52:20 +0200 Subject: [PATCH 28/37] fix gha --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef8eeef0..e7a743d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,11 +6,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Install dependencies + run: bundle install - name: Build run: | git config user.name github-actions git config user.email github-actions@github.com - ruby build.rb + bundle exec ruby build.rb if ! git diff --exit-code then git add . From 36f72785dde115c37e21cd4c9321bd72d6a4bf97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 12:12:05 +0200 Subject: [PATCH 29/37] correct gha --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e7a743d1..e6b731f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true - name: Install dependencies run: bundle install - name: Build From 9c56892b8c82a465ab4641ea9bfd01ecf0234f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 12:21:25 +0200 Subject: [PATCH 30/37] doc --- doc/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 doc/README.md diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 00000000..17bd1009 --- /dev/null +++ b/doc/README.md @@ -0,0 +1,30 @@ + +# NOTE(ssaunier): This script needs https://github.com/lewagon/setup to be cloned as well + +## Build guides + +`bundle exec ruby build.rb` generates the setup guide markdown files at the repo root (e.g. `macOS.md`, `macOS.es.md`). + +Each file in `builds/` defines one guide: + +```yaml +os: macos +locales: [en, es] +partials: + - intro # local: _partials/intro.md / _partials/es/intro.md + - setup/github # remote: lewagon/setup _partials/github.md + - de_setup/direnv # remote alias: lewagon/data-engineering-setup _partials/direnv.md +``` + +Partials without a `/` are loaded from `_partials/` (English) or `_partials/{locale}/` (other locales). +Partials with a `/` are fetched from GitHub: `{repo}/_partials/{locale}/{name}.md`. Remote repo branches and aliases are configured in `constants/repos.yml`. + +Template variables available in all partials are defined in `constants/constants.yml`. + +CI runs the build on every push and commits the generated files if they changed. + +## Guide descriptions + +`VM` — student installs VS Code, creates a GCP VM, runs setup on the VM + +`REMOTE_SETUP` — student installs VS Code, redeems a Le Wagon-provided VM, runs setup on the VM From 1da0d572b58c6392cb459208110d14adfb3d4d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 12:21:46 +0200 Subject: [PATCH 31/37] doc --- doc/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/README.md b/doc/README.md index 17bd1009..4bcfeecd 100644 --- a/doc/README.md +++ b/doc/README.md @@ -25,6 +25,6 @@ CI runs the build on every push and commits the generated files if they changed. ## Guide descriptions -`VM` — student installs VS Code, creates a GCP VM, runs setup on the VM +`VM`: student installs VS Code, creates a GCP VM, runs setup on the VM -`REMOTE_SETUP` — student installs VS Code, redeems a Le Wagon-provided VM, runs setup on the VM +`REMOTE_SETUP`: student installs VS Code, redeems a Le Wagon-provided VM, runs setup on the VM From 86b356fbb689a99c4ada772da6684c587be958a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 12:43:22 +0200 Subject: [PATCH 32/37] style --- constants/repos.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/constants/repos.yml b/constants/repos.yml index 4314b528..2fc6f3d9 100644 --- a/constants/repos.yml +++ b/constants/repos.yml @@ -1,3 +1,4 @@ + branches: setup: master From 631a8f63d0bd7e8ad15e4236a5b2fc4e964d2daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 14:11:29 +0200 Subject: [PATCH 33/37] web setup --- build.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.rb b/build.rb index 34c1e619..009ae82e 100755 --- a/build.rb +++ b/build.rb @@ -21,7 +21,8 @@ def load_remote_partial(repo, name, locale) end def load_local_partial(name, locale) - path = locale == 'en' ? "_partials/#{name}.md" : "_partials/#{locale}/#{name}.md" + localized = "_partials/#{locale}/#{name}.md" + path = (locale != 'en' && File.exist?(localized)) ? localized : "_partials/#{name}.md" File.read(path, encoding: "utf-8") end @@ -58,7 +59,7 @@ def generate_files(loaded, builds, constants) File.open(output, "w:utf-8") do |f| build[:partials].each do |entry| content = loaded["#{partial_name(entry)}.#{locale}"].clone - variables = constants.merge(partial_vars(entry)) + variables = constants.merge(partial_vars(entry)).merge('build_md' => output) f << render_content(content, build[:os], variables) f << "\n\n" end From cf69562e71bdb6762f0a9633cca73a54d5a1df77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 17:02:50 +0200 Subject: [PATCH 34/37] horrible hash pasta --- build.rb | 83 ++++++-------------------------------------------- lib/builder.rb | 52 +++++++++++++++++++++++++++++++ lib/partial.rb | 56 ++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 74 deletions(-) create mode 100644 lib/builder.rb create mode 100644 lib/partial.rb diff --git a/build.rb b/build.rb index 009ae82e..192cc02b 100755 --- a/build.rb +++ b/build.rb @@ -1,81 +1,16 @@ -#!/usr/bin/env ruby -wU +#!/usr/bin/env ruby +# frozen_string_literal: true -require 'open-uri' -require 'liquid' require 'yaml' +require_relative 'lib/builder' -REPOS_CFG = YAML.load_file('constants/repos.yml').freeze - -def load_remote_partial(repo, name, locale) - repo = REPOS_CFG.dig('aliases', repo) || repo - branch = REPOS_CFG.dig('branches', repo) || 'main' - path = locale == 'en' ? name : "#{locale}/#{name}" - base_url = "https://github.com/lewagon/#{repo}/blob/#{branch}" - content = URI.open("https://raw.githubusercontent.com/lewagon/#{repo}/#{branch}/_partials/#{path}.md").read - content.scan(/\!\[.*\]\((.*)\)/).flatten - .reject { |ip| ip.start_with?("http") } - .each { |ip| content.gsub!(ip, "#{base_url}/#{ip}") } - content.scan(/src="(images\/.*)"/).flatten - .each { |ip| content.gsub!(ip, "#{base_url}/#{ip}") } - content -end - -def load_local_partial(name, locale) - localized = "_partials/#{locale}/#{name}.md" - path = (locale != 'en' && File.exist?(localized)) ? localized : "_partials/#{name}.md" - File.read(path, encoding: "utf-8") -end - -def load_partial(partial, locale) - if (m = partial.match(%r{\A(?[a-z][a-z0-9_-]*)/(?[a-z0-9_]+)\z})) - load_remote_partial(m[:repo], m[:name], locale) - else - load_local_partial(partial, locale) - end -end - -def partial_name(entry) = entry.is_a?(Array) ? entry[0] : entry -def partial_vars(entry) = entry.is_a?(Array) ? entry[1] : {} - -def collect_partials(builds) - builds.flat_map { |_filename, build| - build[:locales].flat_map { |locale| - build[:partials].map { |e| [partial_name(e), locale] } - } - }.uniq.map { |partial, locale| - ["#{partial}.#{locale}", load_partial(partial, locale)] - }.to_h -end - -def render_content(content, os_name, variables) - Liquid::Template.parse(content).render(variables.merge('os' => os_name)) -end - -def generate_files(loaded, builds, constants) - builds.each do |filename, build| - build[:locales].each do |locale| - output = locale == 'en' ? "#{filename}.md" : "#{filename}.#{locale}.md" - - File.open(output, "w:utf-8") do |f| - build[:partials].each do |entry| - content = loaded["#{partial_name(entry)}.#{locale}"].clone - variables = constants.merge(partial_vars(entry)).merge('build_md' => output) - f << render_content(content, build[:os], variables) - f << "\n\n" - end - end - end - end -end +repos_cfg = YAML.load_file('constants/repos.yml').freeze +constants = YAML.load_file('constants/constants.yml').freeze -builds = Dir['builds/*.yml'].map { |f| - name = File.basename(f, '.yml') - data = YAML.load_file(f) +builds = Dir['builds/*.yml'].map { |filename| + name = File.basename(filename, '.yml') + data = YAML.load_file(filename) [name, { os: data['os'], locales: data['locales'], partials: data['partials'] }] }.to_h.freeze -loaded = collect_partials(builds) - -constants = YAML.load_file('constants/constants.yml').freeze - -generate_files(loaded, builds, constants) +Builder.new(builds, constants, repos_cfg).run diff --git a/lib/builder.rb b/lib/builder.rb new file mode 100644 index 00000000..368dd337 --- /dev/null +++ b/lib/builder.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require 'liquid' +require_relative 'partial' + +class Builder + def initialize(builds, constants, repos_cfg) + @builds = builds + @constants = constants + @repos_cfg = repos_cfg + end + + def run + builds = @builds.transform_values { |build| + build.merge(partials: build[:locales].to_h { |locale| + [locale, build[:partials].map { |name| Partial.from(name, locale, @repos_cfg) }] + }) + } + loaded = collect_partials(builds) + generate_files(loaded, builds) + end + + private + + def collect_partials(builds) + builds.flat_map { |_filename, build| + build[:partials].flat_map { |_locale, partials| partials } + }.uniq { |partial| partial.url } + .sort_by { |partial| partial.url } + .map { |partial| Thread.new { [partial.url, partial.content] } } + .map { |t| t.value } + .to_h + end + + def generate_files(loaded, builds) + builds.each do |filename, build| + build[:locales].each do |locale| + output = locale == 'en' ? "#{filename}.md" : "#{filename}.#{locale}.md" + + warn "building #{output}" + File.open(output, 'w:utf-8') do |f| + build[:partials][locale].each { |partial| f << render(loaded[partial.url].clone, build[:os], partial.vars, output) } + end + end + end + end + + def render(content, os, vars, output) + variables = @constants.merge(vars).merge('os' => os, 'build_md' => output) + "#{Liquid::Template.parse(content).render(variables)}\n\n" + end +end diff --git a/lib/partial.rb b/lib/partial.rb new file mode 100644 index 00000000..a8f89741 --- /dev/null +++ b/lib/partial.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require 'open-uri' + +module Partial + REMOTE_REGEX = %r{\A(?[a-z][a-z0-9_-]*)/(?[a-z0-9_]+)\z} + + # entry is either a plain string or a hash: { 'name' => '...', 'vars' => { ... } } + def self.from(entry, locale, repos_cfg) + name = entry.is_a?(Hash) ? entry['name'] : entry + vars = entry.is_a?(Hash) ? entry.fetch('vars', {}) : {} + if (m = name.match(REMOTE_REGEX)) + Remote.new(m[:repo], locale, m[:name], vars, repos_cfg) + else + Local.new(locale, name, vars) + end + end + + class Remote + attr_reader :url, :vars + + def initialize(repo, locale, name, vars, repos_cfg) + repo = repos_cfg.dig('aliases', repo) || repo + branch = repos_cfg.dig('branches', repo) || 'main' + path = locale == 'en' ? name : "#{locale}/#{name}" + @base_url = "https://github.com/lewagon/#{repo}/blob/#{branch}" + @url = "https://raw.githubusercontent.com/lewagon/#{repo}/#{branch}/_partials/#{path}.md" + @vars = vars + end + + def content + warn "fetching #{@url}" + text = URI.open(@url).read + # Rewrite relative image paths to absolute GitHub URLs so they render outside their source repo + text.scan(/\!\[.*\]\((.*)\)/).flatten + .reject { |ip| ip.start_with?('http') } + .each { |ip| text.gsub!(ip, "#{@base_url}/#{ip}") } + text.scan(/src="(images\/.*)"/).flatten + .each { |ip| text.gsub!(ip, "#{@base_url}/#{ip}") } + text + end + end + + class Local + attr_reader :url, :vars + + def initialize(locale, name, vars) + localized = "_partials/#{locale}/#{name}.md" + english = "_partials/#{name}.md" + @url = (locale != 'en' && File.exist?(localized)) ? localized : english + @vars = vars + end + + def content = File.read(@url, encoding: 'utf-8') + end +end From 714935bbe4f2a3c22c06acf9e5001146c780f750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 17:19:23 +0200 Subject: [PATCH 35/37] a little bit awesomer --- build.rb | 20 ++++++++++------ lib/build_spec.rb | 18 ++++++++++++++ lib/builder.rb | 53 ++++++++---------------------------------- lib/generator.rb | 27 +++++++++++++++++++++ lib/localized_build.rb | 18 ++++++++++++++ lib/partial_cache.rb | 17 ++++++++++++++ 6 files changed, 103 insertions(+), 50 deletions(-) create mode 100644 lib/build_spec.rb create mode 100644 lib/generator.rb create mode 100644 lib/localized_build.rb create mode 100644 lib/partial_cache.rb diff --git a/build.rb b/build.rb index 192cc02b..702f5a5c 100755 --- a/build.rb +++ b/build.rb @@ -4,13 +4,19 @@ require 'yaml' require_relative 'lib/builder' -repos_cfg = YAML.load_file('constants/repos.yml').freeze -constants = YAML.load_file('constants/constants.yml').freeze +build_specs = Dir['builds/*.yml'].map { |filename| -builds = Dir['builds/*.yml'].map { |filename| - name = File.basename(filename, '.yml') data = YAML.load_file(filename) - [name, { os: data['os'], locales: data['locales'], partials: data['partials'] }] -}.to_h.freeze -Builder.new(builds, constants, repos_cfg).run + BuildSpec.new( + name: File.basename(filename, '.yml'), + os: data['os'], + locales: data['locales'], + partials: data['partials'] + ) +} + +constants = YAML.load_file('constants/constants.yml').freeze +repos_cfg = YAML.load_file('constants/repos.yml').freeze + +Builder.new(build_specs, constants, repos_cfg).run diff --git a/lib/build_spec.rb b/lib/build_spec.rb new file mode 100644 index 00000000..a86d1646 --- /dev/null +++ b/lib/build_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require_relative 'localized_build' + +class BuildSpec + attr_reader :name, :os, :locales, :partials + + def initialize(name:, os:, locales:, partials:) + @name = name + @os = os + @locales = locales + @partials = partials + end + + def localized_builds(repos_cfg) + @locales.map { |locale| LocalizedBuild.new(self, locale, repos_cfg) } + end +end diff --git a/lib/builder.rb b/lib/builder.rb index 368dd337..9a22437a 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -1,52 +1,19 @@ # frozen_string_literal: true -require 'liquid' -require_relative 'partial' +require_relative 'build_spec' +require_relative 'partial_cache' +require_relative 'generator' class Builder - def initialize(builds, constants, repos_cfg) - @builds = builds - @constants = constants - @repos_cfg = repos_cfg + def initialize(build_specs, constants, repos_cfg) + @build_specs = build_specs + @constants = constants + @repos_cfg = repos_cfg end def run - builds = @builds.transform_values { |build| - build.merge(partials: build[:locales].to_h { |locale| - [locale, build[:partials].map { |name| Partial.from(name, locale, @repos_cfg) }] - }) - } - loaded = collect_partials(builds) - generate_files(loaded, builds) - end - - private - - def collect_partials(builds) - builds.flat_map { |_filename, build| - build[:partials].flat_map { |_locale, partials| partials } - }.uniq { |partial| partial.url } - .sort_by { |partial| partial.url } - .map { |partial| Thread.new { [partial.url, partial.content] } } - .map { |t| t.value } - .to_h - end - - def generate_files(loaded, builds) - builds.each do |filename, build| - build[:locales].each do |locale| - output = locale == 'en' ? "#{filename}.md" : "#{filename}.#{locale}.md" - - warn "building #{output}" - File.open(output, 'w:utf-8') do |f| - build[:partials][locale].each { |partial| f << render(loaded[partial.url].clone, build[:os], partial.vars, output) } - end - end - end - end - - def render(content, os, vars, output) - variables = @constants.merge(vars).merge('os' => os, 'build_md' => output) - "#{Liquid::Template.parse(content).render(variables)}\n\n" + builds = @build_specs.flat_map { |spec| spec.localized_builds(@repos_cfg) } + cache = PartialCache.new(builds) + Generator.new(builds, cache, @constants).run end end diff --git a/lib/generator.rb b/lib/generator.rb new file mode 100644 index 00000000..56708be9 --- /dev/null +++ b/lib/generator.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'liquid' + +class Generator + def initialize(localized_builds, cache, constants) + @localized_builds = localized_builds + @cache = cache + @constants = constants + end + + def run + @localized_builds.each do |build| + warn "building #{build.output_filename}" + File.open(build.output_filename, 'w:utf-8') do |f| + build.partials.each { |partial| f << render(partial, build) } + end + end + end + + private + + def render(partial, build) + variables = @constants.merge(partial.vars).merge('os' => build.os, 'build_md' => build.output_filename) + "#{Liquid::Template.parse(@cache[partial.url].clone).render(variables)}\n\n" + end +end diff --git a/lib/localized_build.rb b/lib/localized_build.rb new file mode 100644 index 00000000..7bb8f9d9 --- /dev/null +++ b/lib/localized_build.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require_relative 'partial' + +class LocalizedBuild + attr_reader :os, :locale, :partials + + def initialize(spec, locale, repos_cfg) + @name = spec.name + @os = spec.os + @locale = locale + @partials = spec.partials.map { |entry| Partial.from(entry, locale, repos_cfg) } + end + + def output_filename + @locale == 'en' ? "#{@name}.md" : "#{@name}.#{@locale}.md" + end +end diff --git a/lib/partial_cache.rb b/lib/partial_cache.rb new file mode 100644 index 00000000..91ab0c1e --- /dev/null +++ b/lib/partial_cache.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class PartialCache + def initialize(localized_builds) + @cache = localized_builds + .flat_map(&:partials) + .uniq { |partial| partial.url } + .sort_by { |partial| partial.url } + .map { |partial| Thread.new { [partial.url, partial.content] } } + .map { |thread| thread.value } + .to_h + end + + def [](url) + @cache[url] + end +end From 03ba9b2bc0b5a92b68229fd5eee75494c8a5f21e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 17:22:02 +0200 Subject: [PATCH 36/37] split partial classes --- lib/partial.rb | 41 ++--------------------------------------- lib/partial/local.rb | 16 ++++++++++++++++ lib/partial/remote.rb | 30 ++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 39 deletions(-) create mode 100644 lib/partial/local.rb create mode 100644 lib/partial/remote.rb diff --git a/lib/partial.rb b/lib/partial.rb index a8f89741..a7f39515 100644 --- a/lib/partial.rb +++ b/lib/partial.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true -require 'open-uri' +require_relative 'partial/remote' +require_relative 'partial/local' module Partial REMOTE_REGEX = %r{\A(?[a-z][a-z0-9_-]*)/(?[a-z0-9_]+)\z} @@ -15,42 +16,4 @@ def self.from(entry, locale, repos_cfg) Local.new(locale, name, vars) end end - - class Remote - attr_reader :url, :vars - - def initialize(repo, locale, name, vars, repos_cfg) - repo = repos_cfg.dig('aliases', repo) || repo - branch = repos_cfg.dig('branches', repo) || 'main' - path = locale == 'en' ? name : "#{locale}/#{name}" - @base_url = "https://github.com/lewagon/#{repo}/blob/#{branch}" - @url = "https://raw.githubusercontent.com/lewagon/#{repo}/#{branch}/_partials/#{path}.md" - @vars = vars - end - - def content - warn "fetching #{@url}" - text = URI.open(@url).read - # Rewrite relative image paths to absolute GitHub URLs so they render outside their source repo - text.scan(/\!\[.*\]\((.*)\)/).flatten - .reject { |ip| ip.start_with?('http') } - .each { |ip| text.gsub!(ip, "#{@base_url}/#{ip}") } - text.scan(/src="(images\/.*)"/).flatten - .each { |ip| text.gsub!(ip, "#{@base_url}/#{ip}") } - text - end - end - - class Local - attr_reader :url, :vars - - def initialize(locale, name, vars) - localized = "_partials/#{locale}/#{name}.md" - english = "_partials/#{name}.md" - @url = (locale != 'en' && File.exist?(localized)) ? localized : english - @vars = vars - end - - def content = File.read(@url, encoding: 'utf-8') - end end diff --git a/lib/partial/local.rb b/lib/partial/local.rb new file mode 100644 index 00000000..92bb9929 --- /dev/null +++ b/lib/partial/local.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Partial + class Local + attr_reader :url, :vars + + def initialize(locale, name, vars) + localized = "_partials/#{locale}/#{name}.md" + english = "_partials/#{name}.md" + @url = (locale != 'en' && File.exist?(localized)) ? localized : english + @vars = vars + end + + def content = File.read(@url, encoding: 'utf-8') + end +end diff --git a/lib/partial/remote.rb b/lib/partial/remote.rb new file mode 100644 index 00000000..67391ce5 --- /dev/null +++ b/lib/partial/remote.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'open-uri' + +module Partial + class Remote + attr_reader :url, :vars + + def initialize(repo, locale, name, vars, repos_cfg) + repo = repos_cfg.dig('aliases', repo) || repo + branch = repos_cfg.dig('branches', repo) || 'main' + path = locale == 'en' ? name : "#{locale}/#{name}" + @base_url = "https://github.com/lewagon/#{repo}/blob/#{branch}" + @url = "https://raw.githubusercontent.com/lewagon/#{repo}/#{branch}/_partials/#{path}.md" + @vars = vars + end + + def content + warn "fetching #{@url}" + text = URI.open(@url).read + # Rewrite relative image paths to absolute GitHub URLs so they render outside their source repo + text.scan(/\!\[.*\]\((.*)\)/).flatten + .reject { |ip| ip.start_with?('http') } + .each { |ip| text.gsub!(ip, "#{@base_url}/#{ip}") } + text.scan(/src="(images\/.*)"/).flatten + .each { |ip| text.gsub!(ip, "#{@base_url}/#{ip}") } + text + end + end +end From aec38e55c994a34da31807fbaa9efaf6627a8c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Manchon?= Date: Tue, 2 Jun 2026 17:24:22 +0200 Subject: [PATCH 37/37] smoother logs --- lib/generator.rb | 2 +- lib/partial/remote.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/generator.rb b/lib/generator.rb index 56708be9..55cfdca8 100644 --- a/lib/generator.rb +++ b/lib/generator.rb @@ -11,10 +11,10 @@ def initialize(localized_builds, cache, constants) def run @localized_builds.each do |build| - warn "building #{build.output_filename}" File.open(build.output_filename, 'w:utf-8') do |f| build.partials.each { |partial| f << render(partial, build) } end + warn "built #{build.output_filename}" end end diff --git a/lib/partial/remote.rb b/lib/partial/remote.rb index 67391ce5..33a86ba9 100644 --- a/lib/partial/remote.rb +++ b/lib/partial/remote.rb @@ -16,7 +16,6 @@ def initialize(repo, locale, name, vars, repos_cfg) end def content - warn "fetching #{@url}" text = URI.open(@url).read # Rewrite relative image paths to absolute GitHub URLs so they render outside their source repo text.scan(/\!\[.*\]\((.*)\)/).flatten @@ -24,6 +23,7 @@ def content .each { |ip| text.gsub!(ip, "#{@base_url}/#{ip}") } text.scan(/src="(images\/.*)"/).flatten .each { |ip| text.gsub!(ip, "#{@base_url}/#{ip}") } + warn "fetched #{@url}" text end end