4  Setting up your computer environment

To better understand the contents of this course, we will encourage a hands-on approach to all of the learning activities. For this reason, preparing your computer for tinkering and playing around with these concepts is an important pre-requisite that we should get out of the way before diving into the fundamental concepts of building physics and other related topics.

In no particular order, here are the tools that we will be making use of throughout the course and that you should configure/install on your computer as soon as possible so that you can familiarize yourself with them:

During the lecture today, I will explore the use of git, Quarto, Anaconda, Jupyter Notebooks and Python all together by manipulating one particular notebook file found in this link:

The Jupyter Notebook in question (linked above) was generated directly from a source Markdown file using Quarto, which can ve found here: [Quarto Source]

Similarly, the same source file can generate other version of the same notebook such as: [HTML] and [PDF]

4.1 Following along

Here’s a run down of the things we plan to do so that you can try them again at your own pace:

  1. Install Anaconda following the instructions on the site.

  2. Follow the Getting Started guide for Anaconda.

  3. Use the command line through your comptuer’s terminal emulator application (or the Anaconda Prompt) to test a few of the conda commands, including:

    • conda --version – To see the current version of conda that is installed.
    • conda update conda – To update conda to the latest version.
    • Work with environments by creating, activating and deactivating them:
      • conda create --name [enviornment name] [packages to include] to create an environment (substitute [description] with the appropriate value you want for it)
      • conda activate [environment name] to activate the environment
      • conda deactivate to deactivate and go back to the base environment
  4. Work with Jupyter Notebooks and learn what they are. Specifically, we will follow the instructions on this Jupyter Notebook after downloading it and running jupyter notebook from the command line on the same folder where we downloaded it.

  5. Make yourself familiar with the particular command-line shell used by your operating system. In particular, a Unix-like shell will be used extensively throuhgout the course and in the final project. As such, you may want to read some resources such as this or skim the contents of a full course such as this.

  6. Work with git repositories. In particular, cloning, pulling, committing and pushing into a respository.

    • Create a public repository on GitHub
    • Clone the repository locally by issuing, on a terminal, the command git clone [github repository's address] (if you have SSH access configured, you can use the SSH address, otherwise use the HTTPS one).
    • Add some files to the repository by, for example, copying the Jupyter Notebook we used earlier into the repository, and then staging it to be committed by issuing git add Lecture_2_Setting_Up_Your_Environment.ipynb
    • Create a commit with a simple message by issuging git commit -m 'Added a jupyter notebook'
    • To push the changes to the remote repository, you’ll need to authenticate with GitHub. Nowadays, unless you use special tools such as the GitHub CLI, you will need to create a personal access token. You can do this by following these instructions.
    • Using this access token, you can now proceed to push your changes by issuing git push or to be more precise git push origin main (which says, push to the remote repository called origin – now pointing to the remote server on GitHub – and, in there, to the branch called main).
  7. Learn more about git by following the links on the Jupyter Notebook or this useful GitHub resource for it.

We will not discuss the details of BOPTEST, Docker or Quarto… but will do that later in future lectures.

4.2 What have you learned?

After the lecture, here are some questions that you may want to try to answer yourself to see if you really understood things.

  1. Assuming that I know the URL for the git repository that hosts the course’s website, how do I go about cloning it?
  2. What are branches in a git repository? Why are they useful?
  3. After cloning a repository, is it advisable to make changes to it on the main branch, or on a separate branch created for that purpose?
  4. What are conda environments and why are they useful?
  5. How can I check the status of a local git repository from within a Jupyter Notebook?