⏲️ Est. time to complete: 45 min. ⏲️
You wil learn the following:
- Installing Git
- Installing Python
- Installing Python Libraries
- Setting up Python Virtual Environment
- Installing Visual Studio Code
- Install Git
- Install Visual Studio Code
- Install Python
- Clone To-Do Application Repository
- Setup Python Virtual Environment
- Install Python Libraries
Depending on the operating system you are using, chose appropriate installation method below. For more details on Git and various installation refer to Install Git on GitHub
Most versions of MacOS already have Git installed, and you can activate it through the terminal with git version. If you don't have Git installed, you can install the latest version using instructions below.
- Navigate to the latest macOS Git Installer and download the latest version.
- Once the installer has started, follow the instructions as provided until the installation is complete.
- Open the command prompt "terminal" and type git version to verify Git was installed.
Note: git-scm is a popular and recommended resource for downloading Git on a Mac. The advantage of downloading Git from git-scm is that your download automatically starts with the latest version of Git. The download source is the same macOS Git Installer as referenced in the steps above.
Follow the instructions below install VS Code on your computer. Visit Visual Studio Code download page to download latest version of installation package for your computer operating system.
- Download VS Code installation package for Mac by clicking here
- Go to the Downloads folder on Mac and double click on installation package to extract packages.
- Move the Visual Studio Code application to the Application folder to make it available in the macOS launchpad.
- Launch Visual Studio Code from Applications to make sure it is working as expected
- Download latest stable release of Python installation package for Mac by clicking here.
- Once the download is complete, go to the download folder and double-click on the package file to start installing Python.
- Click Continue and follow onscreen instructions to install Python. Once installation is completes, it opens Python folder.
- To verify that the latest version of Python and IDLE installed correctly, double click on IDLE to show Python shell.
- Review Python version in the shell to confirm Python is installed correctly.
We now need to create a local copy of the To-Do Application repository that we created in an earlier step.
-
From the To-Do Application repository on GitHub, click on the "Code" button and copy the link to the repository
-
Open a terminal/console window. For windows users you can use the command prompt or powershell (i.e., "cmd.exe"). For Mac and Linux users you can use the terminal application.
-
Navigate to the directory where you want to store the project
-
Run the following command to clone the repository:
git clone <link_to_this_repo>
-
Navigate to the project directory:
cd <project directory>
-
From the terminal window, navigate to the project directory
cd <project directory>
[!TIP] The repository for this training has a directory named
myApplication
that you can use as your default working directory while building the application or feel free to choose any directory where you would like to put this application. -
Copy the following
requirements.txt
file from Sprint 0 into your project directory. -
Open up Visual Studio Code in the project directory by executing the following command.
code .
-
From Visual Studio Code, either select "View/Command Palette" or press
Ctrl+Shift+P
to open the command palette. -
In the search box, type
Python
and then select the optionPython: Create Environement...
from the list of options. -
An environment type selection box will appear. Select
Venv Create a '.venv' environment in the current workspace
from the list of options. -
Select the Python interpreter version to use for the virtual environment. If you have multiple versions of Python installed, you should select the version that you installed in the previous step.
-
Check the box next to the
requirements.txt
file to install the required packages in the virtual environment and hit ok. -
You will see a notification in the bottom right corner of the screen indicating that the virutal environment is being created. This can take a few minutes to complete.
-
Once the virtual environment is created, you should see a notification in the bottom right corner of the screen indicating that the virtual environment has been created. This will create a new directory called
.venv
in the project directory that will contain the virtual environment. All python packages installed in this environment will be isolated from the global python environment. -
Open up a terminal window in Visual Studio Code and activate the virtual environment by running the following command.
.venv\Scripts\Activate
You should see the name of the virtual environment in the terminal prompt to indicate that the virtual environment is active.
Code examples in some of the sprints uses following Python libraries. If these modules are not already installed, install these libraries by following the instructions below. Note however if you have already installed the virtual environment, you can skip this step as the libraries were installed as part of the virtual environment setup.
-
Open Visual Studio Code if it is already not open
-
Open Terminal window or Create a new terminal window in VS Code
-
Make sure pip package manager installed in VS Code to install Python libraries. If not installed, follow the instructions below.
-
Download get-pip.py
-
Run below command in the VS Code terminal window
python <Local folder path>\get-pip.py
-
-
Copy the following
requirements.txt
file from Sprint 0 into your project directory. -
Now, install the required libraries by running the following command in the terminal window:
pip install requirements.txt