Setting the Scene


Figure 1

Course overview diagram. Arrows connect the following boxed text in order: 1) Setting up software environment 2) Verifying software correctness 3) Software development as a process 4) Collaborative development for reuse
Course overview diagram

Section 1: Setting Up Environment For Collaborative Code Development


Figure 1

Tools needed to collaborate on code development effectively
Section 1 Overview

1.1 Introduction to Our Software Project


Figure 1

Snapshot of the inflammation dataset

1.2 Virtual Environments For Software Development


Figure 1

Python environment hell XKCD comic
Python Environment Hell from XKCD (Creative Commons Attribution-NonCommercial 2.5 License)

1.3 Integrated Software Development Environments


Figure 1

View of an opened project in PyCharm

Figure 2

Missing Python Interpreter Warning in PyCharm

Figure 3

  • Select Virtualenv Environment from the list on the left and ensure that Existing environment checkbox is selected within the popup window. In the Interpreter field point to the Python 3 executable inside your virtual environment’s bin directory (make sure you navigate to it and select it from the file browser rather than just accept the default offered by PyCharm). Note that there is also an option to create a new virtual environment, but we are not using that option as we want to reuse the one we created from the command line in the previous episode. Configuring Python Interpreter in PyCharm

  • Figure 4

    Packages Currently Installed in a Virtual Environment in PyCharm

    Figure 5

  • Select the + icon at the top of the window. In the window that appears, search for the name of the library (pytest), select it from the list, then select Install Package. Once it finishes installing, you can close that window. Installing a package in PyCharm

  • Figure 6

  • Select Add new run configuration... then Python. Adding a Run Configuration in PyCharm

  • Figure 7

  • In the new popup window, in the Script path field select the folder button and find and select inflammation-analysis.py. This tells PyCharm which script to run (i.e. what the main entry point to our application is). Run Configuration Popup in PyCharm

  • Figure 8

    Syntax Highlighting Functionality in PyCharm

    Figure 9

    Code Completion Functionality in PyCharm

    Figure 10

    Code References Functionality in PyCharm

    Figure 11

    Code Search Functionality in PyCharm

    Figure 12

    Code Search Functionality in PyCharm

    Figure 13

    Version Control Functionality in PyCharm

    Figure 14

    Running a script from PyCharm

    1.4 Software Development Using Git and GitLab


    Figure 1

    Development lifecycle with Git, containing Git commands add, commit, push, fetch, restore, merge and pull
    Software development lifecycle with Git

    Figure 2

    git-distributed

    Figure 3

    Git feature branch workflow diagram

    Figure 4

    Software project's main branch

    Figure 5

    Software project's develop branch

    1.5 Python Code Style Conventions


    Figure 1

    Python code indentation settings in PyCharm

    Figure 2

    Python code whitespace settings in PyCharm

    1.6 Verifying Code Style Using Linters


    1.7 Optional Exercises


    Section 2: Ensuring Correctness of Software at Scale


    Figure 1

    Tools for scaled software testing
    Section 2 Overview

    2.1 Automatically Testing Software


    2.2 Scaling Up Unit Testing


    2.3 Continuous Integration for Automated Testing


    Figure 1

    You will see a list of Jobs and likely see a marker indicating that it is still in progress. Continuous Integration with GitLab CI/CD - Initial Build


    Figure 2

    Continuous Integration with GitLab CI/CD - Build Log

    Figure 3

    Continuous Integration with GitLab CI/CD - Build Details

    2.4 Type annotations


    2.5 Diagnosing Issues and Improving Robustness


    Figure 1

    NumPy arrays of incompatible shapes

    Figure 2

    NumPy arrays' shapes after adding a new_axis

    Figure 3

    NumPy arrays' shapes after broadcasting

    Figure 4

    Setting up test framework in PyCharm

    Figure 5

    Running pytest in PyCharm

    Figure 6

    Ensuring testing configurations in PyCharm are correct

    Figure 7

    Running a single test in PyCharm

    Figure 8

    Setting a breakpoint in PyCharm

    Figure 9

    Debugging in PyCharm

    Figure 10

    Debugging in PyCharm

    Figure 11

    All tests in PyCharm are successful

    2.6 Optional Exercises for Section 2


    Section 3: Software Development as a Process


    Figure 1

    Software design and architecture overview flowchart

    3.1 Software Requirements


    3.2 Software Architecture and Design


    Figure 1

    Writing good code comic

    Figure 2

    Diagram showing proposed architecture of the problem

    3.3 Code Decoupling & Abstractions


    3.4 Code Refactoring


    3.5 Software Architecture Revisited


    Section 4: Collaborative Software Development for Reuse


    4.1 Developing Software In a Team: Code Review


    Figure 1

    Code review process sequence

    Figure 2

  • Create a new merge request by clicking the blue New merge request button. GitLab merge requests tab

  • Figure 3

    Adding a collaborator in GitLab

    Figure 4

    Locate up the merge request from the GitLab’s Merge Requests tab on the home page of your fellow learner’s software repository, then head to the Files changed tab on the merge request. The files changed tab of a merge request


    Figure 5

    When you find a line that you want to add a comment to, click on the blue plus (+) button next to the line. This will bring up a “Write” box to add your comment. Adding a review comment to a merge request You can also add comments referring to multiple lines by clicking the plus and dragging down over the relevant lines. If you want to make a concrete suggestion or a change to the code directly, such as renaming a variable, you can click the Add a suggestion button (which looks like a document with a plus and a minus in it). This will populate the comment with the existing code, and you can edit it to be what you think the code should be.


    Figure 6

    Note: you can only make direct code suggestions if you are a collaborator on a repository. Otherwise, you can add comments only. Adding a suggestion to a merge request GitLab will then provide a button for the code author to apply your changes directly.


    Figure 7

  • To do this, click the Finish your review button at the top of the Files changed tab. Using the finishing your review dialog In the comment box, you can add any other comments that are not associated with a specific line. For example, you can put the list of tests that you want to see added here.

  • 4.2 Preparing Software for Reuse and Release


    4.3 Packaging Code for Release and Distribution


    Wrap-up


    Figure 1

    Usefulness versus time to master grid

    Figure 2

    Overview of tools and techniques covered in the course

    Figure 3

    Overview of topics covered in the course based on level of difficulty