I assume here that students are scientists, mainly graduate students and postdocs that might have a basic previous experience in programming, but we want to introduce a new programming language, Python and more advanced strategies like version control and unit testing.
I believe the best way to motivate scientists is through data, in this case feedback given by previous students that took the same class before.
Of course this would work only after at least 4 or 5 times we had already taught this class.
It would be the most useful to gather feedback from students both just after the class and a couple of months later.
In the questionnaire just after class we should try to get data that (hopefully!!) address student concerns related to how to approach the class, for example how difficult is to master the material presented, how much effort is required, what are some tricks to be successful and what are the expectations on the final test.
The questionnaire a couple of months later instead should gather data on how the topics taught in the class affected the research work of the scientists, and this would (hopefully!) reassure the students that down the road there will be evident benefits from learning those topics.
Questionnaire should be designed to gather data also about other elements that influence motivation, like how supportive is the environment or the best study methods or how fair is evaluation if any.
The data can be presented with several kind of high quality plots, the data import/analysis operations in pandas and plotting with matplotlib/seaborne can be used as an example later in the class.
Negative feedback is of course going to be very useful instead for improving the class itself, then subsequent classes would build upon that and achieve a more positive feedback that can be useful for motivating the students.