Development Environment Setup


Introduction

Set up Your Computer (Windows)

  1. Open powershell in administrator mode. Type win+x then a.
  2. Install choco

    Set-ExecutionPolicy AllSigned
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
    
  3. Wait for it to install

  4. Close the powershell window and reopen a new window in administrator mode with win+x then a.
  5. install the following packages

    choco install -y git.install python3 vscode
    
  6. Close the powershell window when complete

Set up git

  1. open "Git Bash" in the start menu

  2. provide your email and name by providing the following commands, taking care to replace the email and name with your own:

    git config --global user.email "your-email@address.com"
    git config --global user.name "Your Name"
    

    For example,

    git config --global user.email "danaukes@danaukes.com"
    git config --global user.name "Dan Aukes"
    

Set up VSCode

You can install all the extensions this in a single cut-paste operation from Windows Powershell.

  1. Type win+x then i to open a fresh powershell window
  2. Once powershell opens, paste in the following:

    $extensions = @("donjayamanne.githistory", "mhutchie.git-graph", "ms-python.black-formatter", "ms-python.debugpy", "ms-python.pylint", "ms-python.python", "ms-python.vscode-pylance", "ms-python.vscode-python-envs","pycom.pymakr-preview")
    foreach ($extension in $extensions) {
        Invoke-Expression "code --install-extension $extension"
    }
    
  3. You can also import my settings and keybindings. On windows, paste this into a fresh powershell window

    $URL="https://files.danaukes.com/notebook/vscode-setup/settings.json"
    $DEST="$HOME\AppData\Roaming\Code\User\settings.json"
    Invoke-WebRequest $URL -OutFile $DEST
    
    $URL="https://files.danaukes.com/notebook/vscode-setup/keybindings.json"
    $DEST="$HOME\AppData\Roaming\Code\User\keybindings.json"
    Invoke-WebRequest $URL -OutFile $DEST
    

Set up Your Computer (Linux)

Create a new project folder

  1. Navigate to the location on your computer where you keep your projects (Say C:/users/your_user_name/documents or /home/your_user_name/projects/)
  2. Create a new folder to serve as your project folder. We will call it intelligent-project-design in this tutorial.
  3. Open the folder in VSCode

    1. In windows explorer, right click on the folder and select "open with Code".

      In Linux/Gnome, right click on the folder and select "open with..." and then select VSCode 1. If you don't wish to use co-pilot, select "continue without signing in" 1. Select your color preference 1. The workspace should open up, but the folder is not in trusted mode. Click on the "manage" link in the top banner

    2. Select "Trust"

    3. Select allow

Create a Virtual Environment

  1. Create a new file with ctrl+n and paste in the following:

    esptool
    thonny
    bleak
    
  2. Save as requirements.txt

  3. type ctrl+shift+p to open the command bar

  4. in the command bar, type "create environment" and select "Python: Create Environment" when it appears.

    If you have more than one folder open in the explorer window, it will ask which folder to apply the virtual environment to. Select your project folder, intelligent-product-design

  5. Select "quick create" to create a new python environment and install all project dependencies in requirements

    This process could take a few minutes, so be patient. When complete, you should see a message and a new .venv folder in the file explorer.

If you ever need to switch environments, use ctrl+shift+p and search for "python: select interpreter". This will allow you to re-select the proper environment per top level folder in your project explorer window.

Initialize Git

  1. First, create a new file (ctrl+n) and save it (ctrl+s) as README.md. This, and requirements.txt, will represent the first contribution to your repository

  2. Open the version control window using the branch icon in the vertical ribbon on the left side of the workspace, or ctrl+shift+g.

  1. Select Initialize Repository to create a new empty repository and then "publish to github" in order to connect to your github account and create a new repository

  1. You will now add your first file to your first "commit" to your repository. Select the plus icon next to "hello.txt", as seen below. This will "stage" your file

  2. Next, type a message into the window (I typed "first commit") and select "commit". This will create a "commit" from the files you "staged".

  3. Select "Publish Branch"

  4. Press "Allow" to continue signing in

  5. You will be directed to sign in to github.

  6. Once you have finished logging in, authorize github to connect VSCode to your account:

  7. Sellect open to let your browser connect back to VSCode, checking the "always" box.

  8. Type the name of the repository you want to create in the top ribbon (selecting "public" or "private"), and then hit enter:

  9. At this point, VS Code will ask for more permissions. Click through to authorize.

  10. Once complete, you will be notified that the repository has been published.The "commit" button should also gray out, indicating you have no more changed files:

  11. Click on the small git icon () next to "changes" in the source control window. If you don't see the icon, resize the source control window until you can see it

    This should open up your git history, which is useful to browse to see more information about the changes you've made to your repository. All we see for now is your first commit