Local Machine Setup
For this course, you will need a Mac or Ubuntu (GNU/Linux) machine.
If you are using Windows, you can run Ubuntu inside Windows thanks to WSL.
Package Manager
First, let's get a package manager to help install the software that will be needed.
- macOS
- Ubuntu
macOS doesn't come with a package manager by default, so we will install Homebrew.
Open a terminal and run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once Homebrew is installed, you can install software by running:
brew install <package-name>
Ubuntu comes with a package manager called apt
. To install software, run the following command in a terminal:
sudo apt install <package-name>
Shell
A shell is a program that takes commands from the keyboard and gives them to the operating system to perform. In the old days, it was the only user interface available on a Unix-like system such as Linux. Nowadays, we have graphical user interfaces (GUIs) in addition to command line interfaces (CLIs) such as the shell.
To open a shell, you can use the following keyboard shortcut:
- Mac:
Cmd + Space
and typeTerminal
- Linux:
Ctrl + Alt + T
BASH
bash
is a Unix shell and command language written by Brian Fox for the GNU
Project as a free software replacement for the Bourne shell. First released in
1989, it has been used widely as the default login shell for most Linux
distributions and Apple's macOS Mojave and earlier versions.
We will not go into the details of bash
here, but you can find more
information on the Wikipedia page.
While we will not be using bash
as our default shell, it is still a good idea
to know how to use it.
Furthermore, many of the commands we will be using in this course are written
for bash
.
ZSH
zsh
is a Unix shell that can be used as an interactive login shell and as a
command interpreter for shell scripting. Zsh is an extended Bourne shell with a
large number of improvements, including some features of Bash, ksh, and tcsh.
We will be using zsh
as our default shell in this course.
Install
- macOS
- Ubuntu
brew install zsh
sudo apt install zsh
Set as default shell
Set zsh
as default shell:
chsh -s $(which zsh)
Oh-My-Zsh
Oh-My-Zsh is an open source, community-driven framework for managing your zsh configuration (and it comes with a bunch of plugins and themes).
Install
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
.zshrc
The .zshrc
file is a script that is executed each time a new zsh
shell is
started. It is located in your home directory (~/.zshrc
).
You can edit the .zshrc
file with your favorite text editor.
We will be adding some configuration to the .zshrc
file in the next sections.
Git
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
A version control system (VCS) allows you to track the history of a collection of files. It supports creating different versions of this collection. Each version captures a snapshot of the files at a certain point in time and the VCS allows you to switch between these versions.
Check out the Git documentation for more information.
To check if you have Git installed, open a shell and run the following command:
git --version
If you don't have Git installed, you can install it with your package manager
Visual Studio Code
Visual Studio Code is a free source-code editor made by Microsoft for Windows, Linux and macOS. Features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git.
We will be using Visual Studio Code as our code editor.
To install it, run:
- macOS
- Ubuntu
brew install --cask visual-studio-code
sudo apt install code
It is a good idea to install the following extensions for Visual Studio Code. These extensions will make your life easier when working on the assignments.
Extensions
Open Visual Studio Code and click on the Extensions icon in the sidebar.
Live Share
This extension allows you to share your code with others and collaborate in real time.
Remote Dev
This extension allows you to develop inside a container, on a remote machine, or in the Windows Subsystem for Linux (WSL).
Python
This extension adds support for Python to Visual Studio Code.
Jupyter
This extension adds support for Jupyter notebooks to Visual Studio Code.
Python
Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation. Python is a popular programming language that is used for many different things: from web development to data science.
We will be using it as the main programming language.
Python 3 is the latest version of Python. It should be installed by default on macOS and Ubuntu.
To check if you have Python 3 installed, run:
python3 --version
Pip
Pip is the package manager for Python.
To check if you have Pip installed, run:
pip3 --version
If you don't have Pip installed, you can install it by running:
- macOS
- Ubuntu
brew install pip
sudo apt install python3-pip
Virtual Environments
To avoid conflicts between different Python projects, it is a good idea to use virtual environments. A virtual environment is a directory tree which contains Python executable files and other files which indicate that it is a virtual environment.
Install
Let's install the virtualenv
package and virtualenvwrapper
extension for
Python.
pip3 install --user virtualenv virtualenvwrapper
.zshrc
We will be adding some configuration to the .zshrc
file.
Open the .zshrc
file with your favorite text editor and add the following
lines:
# Python
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source virtualenvwrapper.sh
Jupyter
Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text.
We will be using Jupyter Notebook to write some assignments.
Install
pip3 install jupyter