Image 1 of 1: ‘Comic: a PhD student sends "FINAL.doc" to their supervisor, but after several increasingly intense and frustrating rounds of comments and revisions they end up with a file named "FINAL_rev.22.comments49.corrections.10.#@$%WHYDIDCOMETOGRADSCHOOL????.doc"’
Image 1 of 1: ‘A diagram demonstrating how a single document grows as the result of sequential changes’
Figure 3
Image 1 of 1: ‘A diagram with one source document that has been modified in two different ways to produce two different versions of the document’
Figure 4
Image 1 of 1: ‘A diagram that shows the merging of two different document versions into one document that contains all of the changes from both versions’
Figure 5
Image 1 of 1: ‘Accessing Git visual tools in PyCharm’
Image 1 of 1: ‘A diagram showing how "git add" registers changes in the staging area, while "git commit" moves changes from the staging area to the repository’
Figure 2
Image 1 of 1: ‘A diagram showing two documents being separately staged using git add, before being combined into one commit using git commit’
Figure 3
Image 1 of 1: ‘A diagram showing how git restore can be used to restore the previous version of two files’
Figure 4
Image 1 of 1: ‘A diagram showing the entire git workflow: local changes are staged using git add, applied to the local repository using git commit, and can be restored from the repository using git checkout’
Image 1 of 1: ‘Explore projects page with tab “Most starred” open. The tab shows a list of projects with icon, name, descriptions, and four statistical values for each entry.’
Project overview page
Figure 4
Image 1 of 1: ‘Create blank project form’
Create blank project form
Figure 5
Image 1 of 1: ‘Project homepage for a new project’
Fresh project homepage
Figure 6
Image 1 of 1: ‘Local repository with staging area’
Figure 7
Image 1 of 1: ‘The local and remote Git repos’
Figure 8
Image 1 of 1: ‘Accessing a GitLab repo via SSH’
Figure 9
Image 1 of 1: ‘The SSH Keys page in GitLab’
Figure 10
Image 1 of 1: ‘Adding a new key in GitLab’
Figure 11
Image 1 of 1: ‘GitLab repo after first push’
Figure 12
Image 1 of 1: ‘Project Members page’
Project members page
Figure 13
Image 1 of 1: ‘Adding a new member to your GitLab project’
Image 1 of 1: ‘A diagram showing that "git clone" can create a copy of a remote GitLab repository, allowing a second person to create their own local repository that they can make changes to.’
Figure 2
Image 1 of 1: ‘Reviewing commit changes in GitLab’
Figure 3
Image 1 of 1: ‘Commenting on commit changes in GitLab’
Figure 4
Image 1 of 1: ‘A diagram showing a conflict that might occur when two sets of independent changes are merged’
Figure 5
Image 1 of 1: ‘Solving merge conflicts using PyCharm’
Figure 6
Image 1 of 1: ‘Git feature branch workflow diagram’
Figure 7
Image 1 of 1: ‘Software project's main branch’
Figure 8
Image 1 of 1: ‘Software project's develop branch’
Figure 9
Image 1 of 1: ‘Merge Request button after pushing to a branch’
Figure 10
Image 1 of 1: ‘Merge Request form’
Figure 11
Image 1 of 1: ‘Merge Request Lifecycle’
Figure 12
Image 1 of 1: ‘Merge Request blocked because of conflicts’
Installing and managing Python distributions, external libraries and
virtual environments is, well, complex. There is an abundance of tools
for each task, each with its advantages and disadvantages, and there are
different ways to achieve the same effect (and even different ways to
install the same tool!). Note that each Python distribution comes with
its own version of pip - and if you have several Python
versions installed you have to be extra careful to use the correct
pip to manage external packages for that Python
version.
For a novice in this area it is very easy to quickly get overwhelmed,
leading to situation like this:
Python Environment Hell From
XKCD (Creative
Commons Attribution-NonCommercial 2.5 License)
In order to avoid this “Python environment hell” problem, in this
course we will only focus on venv and pip.
Only focusing on these has several advantages, especially for novice
users:
venv and pip have been around for quite a
while, they are widely used, are very stable, and there is ample online
documentation for both of them.
venv and pip are quite low-level, and
minimalistic, so you do not have to deal with the feature explosion and
bloatware that other tools may experience.
finally, many of the more high-level tools use the functionality
provided by venv and pip as building blocks,
so having a good understanding of these provides a solid foundation to
expand to more sophisticated tools.
In the next sections we will look at how to use venv and
pip from the command line, similar to the approach we took
when learning git
Making Sure You Can Invoke Python
You can test your Python installation from the command line with:
BASH
$ python3 --version# on Mac/Linux$ python --version# on Windows — Windows installation comes with a python.exe file rather than a python3.exe file
Python Hangs in Git Bash on Windows
If you are using Windows and invoking python command
causes your Git Bash terminal to hang with no error message or output,
you may have to use winpty - a Windows software package
providing an interface similar to a Unix pty-master for communicating
with Windows command line tools. Inside the shell type:
BASH
alias python="winpty python.exe"
This alias will be valid for the duration of the shell session. For a
more permanent solution, from the shell do: