The QuTech Software Maturity Model (QSMM)
Version Control
- Version control is like an unlimited ‘undo’.
- Version control also allows many people to work in parallel.
- Use
git config
with the--global
option to configure a user name, email address, editor, and other preferences once per machine.
-
git init
initializes a repository. - Git stores all of its repository data in the
.git
directory.
- Use git from the command line for maximum control over workflows.
- Using visual tools for some of the advanced Git workflows will increase productivity and reduce errors.
Basic Git Commands
-
git status
shows the status of a repository. - Files can be stored in a project’s working directory (which users see), the staging area (where the next commit is being built up) and the local repository (where commits are permanently recorded).
-
git add
puts files in the staging area. -
git commit
saves the staged content as a new commit in the local repository. - Write a commit message that accurately describes your changes.
-
git diff
displays differences between commits. -
git restore
recovers old versions of files.
- The .gitignore file is a text file that tells Git which files to track and which to ignore in the repository.
- You can list specific files or folders to be ignored by Git, or you can include files that would normally be ignored.
GitLab
- Projects are GitLab’s primary entity of organization.
- You can explore/search projects visible to you on the “Explore projects” page.
- Groups can contain projects and other groups.
- You can explore/search groups visible to you on the ”Explore groups” page.
- Creating a GitLab project requires not more than a few clicks and providing a name.
- A project’s visibility can be set to either private, internal, or public.
- Adding others as members allows them to directly contribute to your projects
- Members with sufficient rights can independently contribute to repositories
Advanced Git Commands
-
git clone
copies a remote repository to create a local repository with a remote calledorigin
automatically set up. - Conflicts occur when two or more people change the same lines of the same file.
- The version control system does not allow people to overwrite each other’s changes blindly, but highlights conflicts so that they can be resolved.
- A branch is one version of your project that can contain its own set of commits.
- Feature branches enable us to develop / explore / test new code
features without affecting the stable
main
code. - GitLab merge requests provide a structured process approach to Git branch merging
Python Virtual Environments
- “Virtual environments keep Python versions and dependencies required by different projects separate.”
- “A virtual environment is itself a directory structure.”
- “Use
venv
to create and manage Python virtual environments.” - “Use
pip
to install and manage Python external (third-party) libraries.” - “
pip
allows you to declare all dependencies for a project in a separate file (by convention calledrequirements.txt
) which can be shared with collaborators/users and used to replicate a virtual environment.” - “Use
python3 -m pip freeze > requirements.txt
to take snapshot of your project’s dependencies.” - “Use
python3 -m pip install -r requirements.txt
to replicate someone else’s virtual environment on your machine from therequirements.txt
file.”