Summary and Schedule
This workshop will focus on tools and concepts that are a step beyond an introductory python workshop. The learner will be assumed to have a basic understanding of the following python / programming concepts:
- Basic python syntax
- Writing Conditionals and “For” loops
- Installing and running third party libaries
- Basic Version control with git
We will cover the following topics in the course of this workshop:
- Virtual Environments
- Classes and Object Oriented Programming
- Inheritance and Composition
- Creating a Python Module
- Static Code Analysis
- Unit Testing
- Publishing a python package
Prior to the workshop, please ensure that you have a working python
installation (3.9 or higher) and the uv
package manager
installed. Setup instructions for both can be found below.
Setup Instructions | Download files required for the lesson | |
Duration: 00h 00m | 1. Virtual Environments |
What is a Virtual Environment? / Why use a Virtual Environment? How do I create a Virtual Environment? |
Duration: 00h 00m | 2. Creating A Module |
How do I create a Python module? How do I import a local module into my code? |
Duration: 00h 12m | 3. Class Objects |
What is a class object? How can I defined a class object in Python? How can I use a class object in my module? |
Duration: 00h 24m | 4. Unit Testing |
What is unit testing? Why is unit testing important? How do you write a unit test in Python? |
Duration: 00h 36m | 5. Extending Classes with Inheritance |
What if we want classes that are similar, but handle slightly different
cases? How can we avoid duplicating code in our classes? |
Duration: 00h 48m | 6. Inheritance and Composition |
How does Composition differ from Inheritance? When should I use Composition over Inheritance? |
Duration: 01h 00m | 7. Static Code Analysis |
What is static code analysis? How can static code analysis tools help improve code quality? |
Duration: 01h 12m | 8. Building and Deploying a Package | How do we build and deploy our project as a package? |
Duration: 01h 24m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
This workshop content assumes that you have the following prerequisites:
- A laptop or desktop computer running Windows, MacOS, or Linux
- An installation of Python 3.9 or later
- An installation of the UV package management tool
- (Optional) A GitHub account
- (Optional) A TestPyPi account
- (Optional) Git Version Control, authenticated to your GitHub account
Software Setup - Python
This workshop relies on an installation of python on your device. You will need to have at least python version 3.9 or later for the project that we will create here.
If you do not already have python installed on the device you are bringing to the workshop, you can go to the python.org downloads page and download the most recent version.
Software Setup - UV
We will also be working with the UV package management tool. You can follow the install instructions found on the project website.
Software Setup - git and GitHub (Optional)
We will be demonstrating the use of GitHub during the workshop, however if you would prefer not to use the service it is not required to have an account in order to participate in the workshop.
We will be using git and GitHub to manage our code during the workshop. If you do not already have a GitHub account, you can create one for free at github.com.
Once you have an account, you will need to authorize git on your device to push code to your GitHub account. If you are familiar with SSH keys, you can use those. If not, you can use a personal access token (PAT).
Creating a Personal Access Token
Once you are logged into GitHub, click on your profile icon in the upper right corner of the screen, and select “Settings” from the dropdown menu. On the left side of the screen, select “Developer settings”, then “Personal access tokens”, and finally “Fine-grained tokens”.
Select “Generate new token”, then “Generate new token” again on the next screen. You will be prompted to give your token a name, description and expiration date. Under “Repository access”, select “All repositories”. Click the “Add Permissions” button and select “Contents” and “Commit Statuses”. Update the dropdown for each to “Read and write”. Finally, click the “Generate token” button at the bottom of the page.
Your token is only ever shown once, so be sure to either copy it to your clipboard or leave the window open while you complete the next step.
Authorizing git to use your Personal Access Token
On your device, open a command line / terminal window. You will need to configure git to use your PAT when pushing code to GitHub. You can do this by running the following commands:
Then, run the following command, replacing your-username
with your GitHub username:
You will be prompted for your GitHub username and password. For the password, paste in the PAT you created in the previous step. Your credentials will be stored on your device, and you should not have to enter them again.
Account Setup - TestPyPi (Optional)
We will be using TestPyPi to publish our package during the workshop. If you would like to follow along and publish your package to the test instance, you will need to create an account on TestPyPi if you do not already have one. You can do that at test.pypi.org.