Installations
There are several IDE´s you can use when programming in python. In this elective we will use a combination of VS Code and a Jupyter Notebook. Beneath you can find guides to the installation of the software needed for the course.
Install python
Go to www.python.org and find the download button, and install python.
On Mac its recomended to install python (and other software) through brew.
$ brew install python
When done open you Terminal (mac) og Powershell (win) and type
$ python3 --version
Python 3.11.4
you should see something like this. If not, python is not installed, or maybe something else went wrong (ask Claus).
Install VS Code
Go to code.visualstudio.com and find the download button for your operating system. Download and install VS Code.
Mac
$ brew install --cask visual-studio-code
Setup the development environment
Add the python and jupyter extension in VS Code
Open VS Code.
Click on the “Extensions” icon in the left sidebar.
Search for “python” and install the Python extension from Microsoft.
Search for “jupyter” and install the Jupyter extension pack (4) from Microsoft.
Setting Up the Class Repository in VS Code:
1. Clone the Repository:
Open VS Code.
Click the “Source Control” icon on the left (square with a branch).
Click “Clone Repository”.
Enter the URL: https://github.com/python-elective-kea/fall2023-code-examples-from-teachings.git
Choose a local folder to clone to and click “Clone”.
3. Set Up Git:
If the Git status bar isn’t visible at the bottom-left, click the “Source Control” icon.
Click the displayed branch name (e.g., “main” or “master”).
Type “playground” to create a new branch or click “+” and name it “playground”.
The status bar should now show “playground” as the active branch.
4. Open the File:
Locate playground.ipynb in the “Explorer” panel.
Double-click to open it.
5. Set Up Python Environment:
On the top right corner.
Select Kernel.
Choose Python environments.
Click on Create Python Environment.
Opt for Venv Create a ‘.venv’ in the current workspace.
Select your Python version (e.g., 3.11.3).
This process establishes a ‘.venv’ virtual environment for the playground.ipynb file.
6. Note:
Always choose the .venv environment when running code in this repository in the future.
Working with Code and Exercises for the Semester:
Always pull the master branch for new files added to the repository.
Create a new branch for:
Playing with files.
Completing exercises.
Never merge your branches into the master branch.
Important Note:
Do not edit files directly in the master branch.
Keep the master branch clean to avoid merge errors.
Copilot+
If you want to try out the new Copilot+ extension for VS Code, you can follow the instructions here: https://copilot.github.com/
and have a look at this video: https://www.youtube.com/watch?v=gDJzr9DBKTI