03 - Setting Up Python¶
Home: README
Who this is for¶
- Absolute beginners with zero coding experience.
- Learners using Windows, macOS, or Linux.
- Learners who want exact copy/paste setup steps and expected results.
What you will build¶
- A working Python workspace.
- A virtual environment (
.venv). - A first script and a first passing test.
- Safe credential habits for SQL-auth workflows.
Prerequisites¶
- One device with internet access.
- Permission to install apps on your device.
- 45 to 90 minutes for first-time setup.
- For database labs later in this plan: database credentials (SQLite works locally with no setup; PostgreSQL for production practice).
Step-by-step lab pack¶
Choose your platform¶
| Platform | Guide |
|---|---|
| Windows | Windows Setup |
| macOS | macOS Setup |
| Linux | Linux Setup |
Each guide walks you through the complete setup: installing Python, choosing an editor, creating a project folder, setting up a virtual environment, running your first script, and running your first test.
Mobile learners (Android/iOS)¶
Mobile devices are fine for early fundamentals but you will need a desktop or laptop for advanced work (drivers, ETL jobs, dashboards, CI).
Android (Termux):
Install Termux, then run pkg install -y python and follow the Linux guide — most commands are identical.
iOS: Use a Python app such as Pyto or Pythonista. These apps have built-in editors and consoles. Virtual environments are not fully supported on iOS — treat it as a learning-only path and transition to desktop before enterprise phases.
Expected output¶
- A working
hello_smeproject with: hello.pytest_hello.py.venvpython hello.pysucceeds.pytest -qsucceeds.- You can explain your credential safety rules.
Break/fix drills¶
- Deactivate venv and run
pytestto see failure mode. - Rename
test_hello.pytohello_test.pyand observe discovery behavior. - Intentionally misspell
assertand read the traceback. - Switch interpreter in editor, then switch back to the project venv.
- Add a fake credential directly in code, then remove it and replace with env var access.
Troubleshooting¶
pythonorpython3not found: reopen terminal, confirm install finished, reinstall and ensure PATH/shell setup.- See platform-specific troubleshooting in each guide: Windows | macOS | Linux
Mastery check¶
You pass setup when you can: - set up a fresh folder from scratch, - create and activate an isolated environment, - run one script and one test, - explain why credentials must not be hardcoded.
Learning-style options (Play/Build/Dissect/Teach-back)¶
- Play: change script output and test assertions to observe behavior.
- Build: follow exact steps and verify each expected output.
- Dissect: explain each command and what changes on disk.
- Teach-back: create a one-page setup guide for a friend on your same OS.
Primary Sources¶
- Using Python on Windows
- Using Python on macOS
- Using Python on Unix
- venv
- VS Code Python tutorial
- pytest getting started
Optional Resources¶
- Thonny (beginner-friendly Python IDE)
- Termux docs
- Pyto
- Pythonista
- Automate the Boring Stuff
- Python Tutor