Git と Docker を使ってデータ解析の再現性を向上させる

千葉大学 西千葉キャンパス アカデミック・リンク・センター

2024年5月30日(木)と31日(金)

10:00 - 17:00 (JST)

インストラクター: ニッタ ジョエル, 西田 孝三

基本情報

The Carpentriesプロジェクトは、 インストラクター、トレーナー、メンテナンス担当者、ヘルパー、およびサポーターで構成される Software CarpentryData CarpentryLibrary Carpentry の コミュニティから成り立っており、「研究者に基本的な計算科学とデータサイエンスのスキルを教える」という使命を共有しています。

The Carpentriesについてもっと学び、関わり続けたいですか?
「Carpentries Clippings」は、The Carpentriesの隔週ニュースレターで、コミュニティのニュース、コミュニティの求人情報などを共有しています。 将来の版を受け取り、完全なアーカイブを読むには次の URL から「サインアップ」を行ってください:https://carpentries.org/newsletter/

Software Carpentryは、基本的な研究計算スキルを教えることによって、研究者がより少ない時間と苦痛で仕事を終えられるようにすることを目指しています。 この実践的なワークショップでは、プログラム設計、バージョン管理、データ管理、タスク自動化を含む基本的な概念とツールについてカバーします。 参加者は互いに助け合い、学んだことを自身の研究課題に応用することが奨励されます。

私たちが何を教え、なぜ教えるのかの詳細については、 私たちの論文「科学計算のベストプラクティス」をご覧ください。

対象: 研究者(大学院生、教員) 本ワークショップで勉強するツール(ソフト)の経験を問いません。

登録: Connpassから登録して下さい。

場所: 千葉大学 西千葉キャンパス アカデミック・リンク・センター(図書館)I棟「まなび」. OpenStreetMapGoogle Mapsで場所を確認する.

日程: 2024年5月30日(木)と31日(金). Googleカレンダーに追加.

参加条件: 参加者は、管理者権限を持つ Mac/Linux/Windows OSを搭載した ノートパソコン(タブレットや Chromebook などではなく)を持参する必要があります。 いくつかの特定のソフトウェアパッケージ( 下部の「セットアップ」以降の Bash, Git, Text Editor, Docker)をインストールしてください。

アクセシビリティ: 私たちは、このワークショップへのアクセシビリティを約束します。 ワークショップの主催者は次のことを確認しています:

事前に主催者に連絡することで、必要に応じて事前に資料を配布したり、 拡大印刷した配布資料を用意したりしています。 学習を容易にするためのお手伝い(例:手話通訳者や授乳施設など)が必要な場合は、 下記連絡先までご連絡ください。

連絡先: お問い合わせは joelnitta@chiba-u.jp にメールをお送りください。

役割: ワークショップでの役割(誰が何をするのか)を知るには、 ワークショップ のFAQをご参照ください。


行動規範

カーペントリーズの活動に参加するすべての人は、行動規範を遵守しなければなりません。 この文書には、必要に応じてインシデントが発生した場合の報告方法の概要も記載されています。


スケジュール

5月30日(木)

10:00 概要とセットアップ
10:20 シェルの使い方
11:00 リポジトリの作成
12:00 昼休み
13:00 変更内容の記録、履歴の探索
14:30 休憩
15:00 共同研究
16:00 GitHubのワークフロー
17:00 終了

5月31日(金)

10:00 コンテナとイメージについて
10:30 DockerのCLIの基本
11:00 コンテナを走らせる方法
12:00 昼休み
13:00 DockerHubについて
14:30 休憩
15:00 イメージの作り方(書き方)
16:00 再現性とコンテナについて
17:00 終了

以上のスケージュルは目安で、実際の内容とは異なることがあります。

ワークショップの教材はこちらから見られます:gitユニックス シェルDocker


セットアップ

ソフトウェア・カーペントリー のワークショップに参加するためには、 以下のソフトウェアにアクセスできる必要があります。 さらに、最新のWebブラウザが必要になります。

講師向けの参考資料として、 「構成の問題と解決策」のwikiページ上で、インストール中に発生しがちな問題のリストを管理しています。

なお、インストールの説明は現時点、英語のみとなっています(翻訳を貢献したい方は是非インストラクターまでご連絡お願いします(joelnitta@chiba-u.jp)。

The Bash Shell

Bash is a commonly-used shell that gives you the power to do tasks more quickly.

  1. Download the Git for Windows installer.
  2. Run the installer and follow the steps below:
    1. Click on "Next" four times (two times if you've previously installed Git). You don't need to change anything in the Information, location, components, and start menu screens.
    2. From the dropdown menu, "Choosing the default editor used by Git", select "Use the Nano editor by default" (NOTE: you will need to scroll up to find it) and click on "Next".
    3. On the page that says "Adjusting the name of the initial branch in new repositories", ensure that "Let Git decide" is selected. This will ensure the highest level of compatibility for our lessons.
    4. Ensure that "Git from the command line and also from 3rd-party software" is selected and click on "Next". (If you don't do this Git Bash will not work properly, requiring you to remove the Git Bash installation, re-run the installer and to select the "Git from the command line and also from 3rd-party software" option.)
    5. Select "Use bundled OpenSSH".
    6. Ensure that "Use the native Windows Secure Channel Library" is selected and click on "Next".
    7. Ensure that "Checkout Windows-style, commit Unix-style line endings" is selected and click on "Next".
    8. Ensure that "Use Windows' default console window" is selected and click on "Next".
    9. Ensure that "Default (fast-forward or merge) is selected and click "Next"
    10. Ensure that "Git Credential Manager" is selected and click on "Next".
    11. Ensure that "Enable file system caching" is selected and click on "Next".
    12. Click on "Install".
    13. Click on "Finish" or "Next".
  3. If your "HOME" environment variable is not set (or you don't know what this is):
    1. Open command prompt (Open Start Menu then type cmd and press Enter)
    2. Type the following line into the command prompt window exactly as shown:

      setx HOME "%USERPROFILE%"

    3. Press Enter, you should see SUCCESS: Specified value was saved.
    4. Quit command prompt by typing exit then pressing Enter

This will provide you with both Git and Bash in the Git Bash program.

Video Tutorial

The default shell in Mac OS X Ventura and newer versions is Zsh, but Bash is available in all versions, so no need to install anything. You access Bash from the Terminal (found in /Applications/Utilities). See the Git installation video tutorial for an example on how to open the Terminal. You may want to keep Terminal in your dock for this workshop.

To see if your default shell is Bash type echo $SHELL in Terminal and press the Return key. If the message printed does not end with '/bash' then your default is something else, you can change your current shell to Bash by typing bash and then pressing Return. To check your current shell type echo $0 and press Return.

To change your default shell to Bash type chsh -s /bin/bash and press the Return key, then reboot for the change to take effect. To change your default back to Zsh, type chsh -s /bin/zsh, press the Return key and reboot. To check available shells, type cat /etc/shells.

Video Tutorial

The default shell is usually Bash and there is usually no need to install anything.

To see if your default shell is Bash type echo $SHELL in Terminal and press the Return key. If the message printed does not end with '/bash' then your default is something else, you can change your current shell to Bash by typing bash and then pressing Return. To check your current shell type echo $0 and press Return.

To change your default shell to Bash type chsh -s /bin/bash and press the Return key, then reboot for the change to take effect. To change your default back to Zsh, type chsh -s /bin/zsh, press the Return key and reboot. To check available shells, type cat /etc/shells.

Git

Git is a version control system that lets you track who made changes to what when and has options for easily updating a shared or public version of your code on github.com. You will need a supported web browser.

You will need an account at github.com for parts of the Git lesson. Basic GitHub accounts are free. We encourage you to create a GitHub account if you don't have one already. Please consider what personal information you'd like to reveal. For example, you may want to review these instructions for keeping your email address private provided at GitHub.

For macOS, install Git for Mac by downloading and running the most recent "mavericks" installer from this list. Because this installer is not signed by the developer, you may have to right click (control click) on the .pkg file, click Open, and click Open on the pop up window. After installing Git, there will not be anything in your /Applications folder, as Git is a command line program. For older versions of OS X (10.5-10.8) use the most recent available installer labelled "snow-leopard" available here.

Video Tutorial

If Git is not already available on your machine you can try to install it via your distro's package manager. For Debian/Ubuntu run sudo apt-get install git and for Fedora run sudo dnf install git.

Text Editor

When you're writing code, it's nice to have a text editor that is optimized for writing code, with features like automatic color-coding of key words. The default text editor on macOS and Linux is usually set to Vim, which is not famous for being intuitive. If you accidentally find yourself stuck in it, hit the Esc key, followed by :+Q+! (colon, lower-case 'q', exclamation mark), then hitting Return to return to the shell.

nano is a basic editor and the default that instructors use in the workshop. It is installed along with Git.

nano is a basic editor and the default that instructors use in the workshop. See the Git installation video tutorial for an example on how to open nano. It should be pre-installed.

Video Tutorial

nano is a basic editor and the default that instructors use in the workshop. It should be pre-installed.

Docker

Please see the Docker lesson setup instructions.