Course Description
Once students have mastered the basics of Python via the Introduction to Python course or their own work, it’s time to move on to applying Python to daily programming needs. This 4-day course picks up where Python 3 Programming Introduction leaves off, covering some topics in more detail, and adding many new ones, with a focus on enterprise development. This is a hands-on programming class. All concepts are reinforced by informal practice during the lecture followed by lab exercises. Many labs build on earlier labs, which helps students retain the earlier material. The length of the refresher section (Section 1) will vary based on each class’s level of Python preparation. It may range from one hour to half a day. Because of this, the last two chapters (Advanced Data Handling and Type Hinting) will covered as time permits.
Pre-requisites
Students should have attended an introductory Python course such as our Python 3 Programming Introduction or have six months of Python programming experience.
Who is this course for?
Advanced users, system administrators and web site administrators who want to use Python to support their server installations, as well as anyone else who wants to automate or simplify common tasks with the use of Python scripts.
Course content
Python Refresher
Variables
Basic Python Data Types
Sequence Types
Mapping Types
Program Structure
Files & Console I/O
Conditionals
Loops
Builtins
Functions
Modules
Packages
OS Services
The os module
Paths, Directories & Filenames
Walking Directory Trees
Environment Variables
Launching External Programs
Dates and Times
Python modules for dates & times
Ways to store dates & times
Basic dates & times
Formatting dates & times
Parsing date/time strings
Parsing dates the easier way
Converting dates & times
Time zones
Generating calendars
Binary Data
“Binary” (raw or non-delimited data)
Binary vs text data
Using Struct
Bitwise operations
Pythonic Programming
Tuples
Iterable unpacking
Unpacking function arguments
The sorted() function
Custom sort keys
Lambda functions
List comprehensions
Dictionary comprehensions
Set comprehensions
Iterables
Generator expressions
Generator functions
String formatting
f-strings
Functions, Modules & Packages
Function Parameters
Default Parameters
Python Function Parameter Behaviour
Name Resolution (aka Scope)
The global Statement
Modules
Using import
How import * can be Dangerous
Module Search Path
Executing Modules as Scripts
Packages
Configuring import with __init__.py
Documenting modules & packages
Python Style
Intermediate Classes
Defining Classes
Object Instances
Instance Attributes
Instance Methods
Constructors
Getters & Setters
Properties
Class Data
Class Methods
Inheritance
Using super()
Multiple Inheritance
Abstract Base Classes
Special Methods
Static Methods
Metaprogramming
globals() and locals()
The inspect Module
Working with Attributes
Adding Instance Methods
Decorators
Applying Decorators
Trivial Decorator
Decorator Functions
Decorator Classes
Decorator Parameters
Creating Cl;asses at Runtime
Monkey Patching
Callable Classes
Do you need a metaclass ?
About metaclasses
Mechanics of a metaclass
Singleton with a metaclass
Developer Tools
Comments
pylint
Customising pylint
Using pyreverse
The Python debugger
Starting debug mode
Stepping through a program
Setting breakpoints
Profiling
Benchmarking
Unit Tests with pytest
The pytest module
Creating tests
Running tests (basics)
Special Assertions
Fixtures
User-defined Fixtures
Built-in Fixtures
Configuring Fixtures
Parameterising Tests
Marking Tests
Running tests (advanced)
Skipping & Failing
Mocking Data
pymock objects
Pytest and Unittest
Database Access
Connecting to a Server
Creating a Cursor
Executing a Statement
Fetching Data
SQL Injection
Parameterized Statements
Dictionary Cursors
Metadata
Transactions
Object-Relational Mappers
No SQL
PyQt
Event-driven Applications
External Anatomy of a PyQt Application
Internal Anatomy of a PyQt Application
Using designer
Designer-based Application Workflow
Naming Conventions
Common Widgets
Layouts
Selectable Buttons
Actions & Events
Signal/Slot Editor
Editing Modes
Menu Bar
Status Bar
Forms & Validation
Using Pre-defined Dialogs
Tabs
Niceties
Working with Images
Network Programming
Consuming Web Services
HTTP the Easy Way
Sending email
Email Attachments
Remote Access
Copying Files with Paramiko
Multiprogramming
What are Threads ?
The Python Thread Manager
The threading Module
Threads for the Impatient
Creating a thread Class
Variable Sharing
Using Queues
Debugging Threaded Programs
The multiprocessing Module
Using pools
Alternatives to multiprogramming
Effective Scripts
Using shlex.split()
The subprocess Module
Subprocess convenience functions
Capturing stdout and stderr
Permissions
Using shutil
Creating a Useful Command Line Script
Creating Filters
Parsing the command line
Simple Logging
Formatting Log Entries
Logging Exceptions
Logging to other Destinations
Serializing Data
Which Module to use
Getting Started with ElementTree
How ElementTree works
Elements
Creating a New XML Document
Parsing an XML Document
Navigating the XML Document
Using XPath
About JSON
Reading JSON
Writing JSON
Customizing JSON
Reading and Writing XML
Reading CSV Data
Nonstandard CSV
Using csv.DictReader
Writing CSV Data
Pickle
Advanced Data Handling
Default Dictionary Values
Counting with Counter
Named Tuples
Printing Data Structures
Zipped Archives
TAR Archives
Serializing Data
Type Hinting
Static Analysis Tools
Runtime Analysis Tools
The typing Module
Input Types
Variance
Union and Optional
Stub Type Hinting