Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Structuring a Python Application (Overview)

Python, though opinionated on syntax and style, is surprisingly flexible when it comes to structuring your applications. On the one hand, this flexibility is great: it allows different use cases to use structures that are necessary for those use cases. On the other hand, though, it can be very confusing to the new developer. The Internet isn’t a lot of help either. There are as many opinions as there are Python blogs!

In this course, you’ll:

  • Walk through a dependable Python application layout reference guide that you can refer to for most use cases
  • See examples of common Python application structures, including command-line applications (CLI apps), one-off scripts, installable packages, and web application layouts with popular frameworks like Flask and Django


Sample Code (.zip)

29.8 KB


Course Slides (.pdf)

1.1 MB

Comments & Discussion

drewmullen on April 29, 2020

What do you gain from including the version inside your helloworld.py file? ive only been maintaining in my setup.py and it has seemed to work OK for me.

Denis Roy on April 30, 2020

Here are clickable links of the references made in the video:

Modules & packages refresher:


Article from Kyle Stratis:


Lots of .gitignore files:


RealPython article on Pipenv:


Choose a license:


Hints on writing a good README:


blackray on May 2, 2020

hi drewmullen, i think Chris is trying to convey that if you have the code itself manage the version, and your setup.py file reads it from there, you don’t have to worry about aligning them. (09:55)

plus, he has the readme file pointing to the same variable. So when his version got updated, readme file get updated too.

Hope that helps.

andersgs on May 3, 2020

hi drewmullen, in addition to blackray’s comment, I would add that it is considered good practice to keep your version string with the code and import it in to your setup.py because then you can access the version string programmatically (e.g., import pandas; print(pandas.version).

That said, I am not sure you need to use the regex expression. I would just have added an import line:

from helloworld import __version__ as version


drewmullen on May 4, 2020

great point @andersgs. now that you mention it, i have actually ran into problems with apps where the version isnt available. it can be helpful if you use the code downstream and want to say “if version < 0.x behave one way or another”

Become a Member to join the conversation.