Quick-Start Guide: Minimalistic Python Workflow
Get up and running with Python, git Bash, and VS Code in ~30 minutes.
Programming is hard enough on its own, but getting started can be even harder. This article is intended to help you install the tools required for modern Python development. I’d recommend that you use the Windows 10 or Ubuntu 18+ operating systems if you are following along.
Accessing the terminal
For those who are already familiar, feel free to skip this section.
However, if you are new to development, it’s essential for you to understand how to access the Command-Line Interface (CLI) of your operating system.
The terms “CLI”, “command-line interface”, “command-line”, and “terminal” are used interchangeably by developers. A CLI is a program used to send instructions to your operating system , one of its sub-systems, or an application you’ve installed. Windows 10 has “PowerShell” and “Command Prompt”, whereas Linux and MacOS have the “Terminal”.
In Ubuntu 18+, right-click anywhere on the desktop and select “Open in Terminal”. There are plenty of other ways to get to the terminal, so if that doesn’t work for you then just look up how to open terminal in Ubuntu and try a few alternatives.
In Windows 10, click the start menu icon and type in “PowerShell” to search for Windows PowerShell. Command Prompt is an alternative that you can use, but it’s not as user-friendly as PowerShell in many cases and nowadays there are multiple commands that overlap between Linux’s Bash syntax for terminal and PowerShell’s syntax (making it easier to learn both at once).
If you’ve never used a CLI before or are using a new one that you’re not familiar with, I’d highly recommend you start by typing
help and hitting Enter.
No, I’m not joking. CLI’s typically have very impressive documentation and “help” is a fairly universal command. There are very few features in any given terminal that cannot somehow be traced back to the “help” command. By starting there, you should be armed with the ability to find out more.
Make sure you are able to open one up and type the command above. Type some other stuff as well. Try to break it…. you likely won’t guess any system-breaking commands on your own. It will come in handy later on, I promise.
Installing and Verifying Python
In the interest of getting up and running as quickly as possible, I recommend installing base Python until there is a significant need to do otherwise.
Installing Python on Windows 10
For Windows 10 users, download Python here and run the installer. The important thing to note is that there are two check-boxes on the very first screen in the installation wizard that you should pay attention to (something along the lines of “Install for all users” and “Add Python to PATH”).
Please ensure that “Add Python to PATH” is checked. Most tutorials recommend that you also check “Install for all users”, but I actually recommend that you don’t check that option because sometimes an installation for all users leads to permissions issues when you are trying to download packages via Python’s package manager, pip. Once both of those settings are properly configured, click “Install Now” and follow the remaining prompts.
If you install Python for just your own user, you shouldn’t run into any problems when trying to install packages. Otherwise, you may have to use the Administrator account (which is not the same as your personal account having Administrator rights…).
Installing Python on Ubuntu 18+
If you are using Ubuntu 18+, you likely already have Python 2.7 installed (accessible by typing
python into the terminal). However, there are a number of improvements that have been made in Python 3. In order to get those updates, the first thing you should do is type
python3 into your terminal and see what happens when you run it.
You will likely see the following:
Command 'python3' not found, but can be installed with:sudo apt install python3
Assuming you see that error, first make sure the APT package installer is updated before attempting to install Python 3. Open up the terminal and type in the following:
sudo apt update && upgrade
Once that process finishes, go ahead and run the command to install Python 3:
sudo apt install python3
Verifying the installation (Windows 10 or Ubuntu 18+):
Try running the
python3 command in Linux terminal (see below) or the
python command in PowerShell for Windows. The output should look roughly the same, indicating the version of Python that started up.
>>> symbol indicates that Python is running and waiting for some code to be entered. This is commonly referred to as a Read-Evaluate-Print-Loop (REPL). In a REPL, you type in commands by hand and they are executed (or throw exceptions) when you hit enter. It’s very important for Python beginners to understand that this is possible. Try typing in the following command in the REPL (excluding the
>>> symbol) and hit the Enter key:
>>> print('Hello, world!')
You should see
Hello, world! print out in the terminal. This is the most classic command used as a test across all programming languages.
However, it’s boring. Run the following command instead:
>>> x = lambda x : print('<3' * x); x(9000);
Both of the commands above were valid and should show some output without complaining or throwing errors. If you run into an error, you need to check your installation steps. Feel free to add comments below if you run into issues.
Once you get a command to work successfully, try executing a command that is absolutely not valid:
I encourage this for beginners because errors happen all the time and it’s important not to be afraid of failure.
You ran into a NameError. It certainly won’t be the last one you ever see, so don’t worry about it.
Go ahead and exit the Python interpreter:
Typically, processes that are running in any terminal (regardless of operating system) can be stopped by typing Ctrl+C. However, there are a few exceptions and Python is one of them. You must use the command above or close the terminal to exit the Python REPL.
By this point, you’ve successfully configured and executed Python commands in a real interpreter. The Python REPL is very powerful and is also one of the easiest ways to test an idea separately from your project-in-progress.
If you’re using Linux, you’ll also want to install the package manager for Python (pip), so go ahead and install it for both Python 2.7 and Python 3.x using the commands below. Pip allows you to download code that others have written and use it in your own programs.
sudo apt install pip
sudo apt install pip3
If you can get this far, you are in business!
Installing git Bash
Git will likely be installed if you are using Ubuntu, but doesn’t come with Windows by default.
Git is a version controlling system used by developers across the world and is, without a doubt, the current world standard for code management and distribution. Note that git is separate from GitHub (which is an incredibly popular hosting site for git repositories).
Git is important to use for the following reasons:
- Making sure your code is safe and can be reverted back to a prior version if it breaks
- Making sure you can track your changes (and other people’s changes) with a clear history log
- Enabling you and others to share code with each other and contribute to each other’s projects without breaking them
You don’t need to understand quite how to use it yet, but you should install it and watch/read a few tutorials on it at the very least.
Similarly to Python, you can test if git is installed by typing the
git command into your terminal (the command is the same between Windows and Ubuntu).
If you don’t see a list of commands and descriptions print out when you run the
git command, download it here:
The default settings for the git installer should be fine to use. Once git is installed, run the following command:
The output should look something like this:
fatal: not a git repository (or any of the parent directories): .git
That looks bad, but it’s simply an error indicating that the folder the terminal is running from is not a git repository. If you see that message, it means git has been successfully installed!
There are two last commands to configure git. These commands will set your username and email for all commits.
git config --global user.name "YourUserName"
git config --global user.email "YourEmail@SomeDomain.com"
To learn more, I’d highly recommend you read the documentation and watch a few tutorials.
Installing and Configuring Visual Studio Code
Visual Studio Code is a text editor and lightweight Integrated Development Environment (IDE) for creating applications in just about any programming language. It’s used to edit and manage files in a project as well as providing tools for debugging your applications and integrating with all kinds of development tools and services.
Everyone has a favorite text editor and IDE, they’re often two different applications, but Visual Studio Code is the best of both worlds in many ways. It’s free, it’s extensible, and it’s much less intimidating to brand new coders than most full-blown IDE’s. There’s very little you can’t do with VS Code, and it starts out very lightweight so you can add additional components to it as you learn and grow as a developer.
Visual Studio Code - Code Editing. Redefined
Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud…
You should have no issues installing Visual Studio Code on any major platform. Simply click the link above and run through the installer or download it from the Ubuntu Software store. Once it’s installed, I highly recommend updating your settings to the following (this can be done via the GUI, but it’s easier to click the icon in the screenshot below):
Visual Studio Code also allows for the download and usage of extensions. There are thousands of them out there, but if you’re using VS Code for Python development then I would recommend the following:
- Python: Basic Python support with syntax highlighting, linting, debugging, etc. This one is an absolute must.
- autoDocstring: Automatic generation of documentation within your classes, methods, and functions. Makes it extremely easy to generate robust and consistent documentation for your code.
- Markdown All in One: Improved Markdown previewing, editing, and table of contents.
- Markdownlint: Markdown linting to ensure proper formatting.
- GitLens: Robust tooling for viewing historic changes in git, blame analysis, comparing against prior revisions, etc.
Conclusion and further reading
If you followed the instructions above, you should have a workflow that is fully capable of building applications and tools using the Python language. I highly recommend you read the documentation of both git and Python rather than relying heavily on tutorial videos. By exposing yourself to the real documentation, the mystery of how these technologies work will be diminished.