Reuven Lerner's Python Courses/Intro Python: Modules and Packages

  • $180

Intro Python: Modules and Packages

  • Closed

Write less Python code! Learn to use existing module, as well as to write your own. Also: Virtual environments and publishing to PyPI. With more than 4 hours of video and a dozen exercises.

Get this course, and many others, as part of my LernerPython membership, at https://LernerPython.com.

Contents

Introduction and welcome

Section 1: Using modules

In this section, you'll learn how to use Python's "import" statement — what it does, how it searches for modules, and how to use data and functions within those modules.
Section 1 — Using modules.ipynb
1. What are modules?
2. Basic importing
03 sys.path
04 import ... as
05 from .. import
06 Why from ... import * is bad
Preview
07 Python's standard library
08 Exercises 1
exercise-1.txt
09 Exercise solutions 1

Section 2: Writing modules

In this section, you'll learn how to write modules. Moreover, you'll learn how Python knows whether it has already imported a module, and how the special __name__ variable allows us to make decisions when our module is imported
Section 2 — Writing modules.ipynb
10 The simplest module
11 Globals, attributes, and reloading
12 sys.modules
Preview
13 Docstrings
14 Modules are executed when imported
15 __name__ and "__main__"
16 Using __name__ and "__main__"
17 Mutual imports and __name__
18 Warnings with names
19 Exercises 2
exercise-2.txt
20 Exercise 2 solutions

Section 3: PyPI

In this section, we'll talk about PyPI, the Python Package Archive — how to download and install packages from it, and how to use the site intelligently.

Section 3 — PyPI.ipynb
21 Intro to PyPI
22 Installing packages with pip
23 Trusting PyPI code
24 awesome-python.com
25 Installing into your own directory
26 Versions and upgrading
27 Exercises 3
exercise-3.txt
28 Exercise 3 solutions

Section 4: Virtual environments

In this section, we'll talk about virtual environments, which ensure that each of our projects has its own, separate list of installed packages.
29 Intro to virtual environments
30 Creating virtual environments
31 Activating and deactivating venvs
32 Generating and using a requirements.txt file
33 Exercises 4
exercise-4.txt
34 Exercise 4 solutions

Section 5: Packages

In this section, we'll learn about Python's "packages," which allow us to create collections of modules for easier maintenance and distribution.
Section 5 — Packages.ipynb
35 Packages
36 More complex package hierarchies
37 __init__.py files
38 Hierarchies and relative imports
39 Exercises 5
exercise-5.txt
40 Exercise solutions 5

Section 6: Advanced topics

In this section, we'll discuss a few more advanced topics regarding modules and packages — things that you don't necessarily need to know, but which will really come in handy.
Section 6 — Advanced topics.ipynb
41 sys.modules
42 __all__
43 .pyc files
44 Defined dunder names in modules and packages

Section 7: Distributions

In this section, we get a taste of how to publish own own packages to PyPI. I use "Poetry" in this section, and both develop and publish a package of my own.
45 Packages vs. distributions
46 Installing manually with setup.py files
47 Wheelfiles
48 Introduction to Poetry
49 Creating a distribution
50 Publishing to PyPI
51 Dependencies with Poetry
52 Conclusion