Skip to content

Commit 6bd9c7c

Browse files
Build beginner-first Jekyll course website
1 parent cfbdcd1 commit 6bd9c7c

59 files changed

Lines changed: 3353 additions & 649 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pages.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy course website
1+
name: Deploy Jekyll course website
22

33
on:
44
push:
@@ -15,20 +15,37 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v6
23+
24+
- name: Set up Ruby
25+
uses: ruby/setup-ruby@v1
26+
with:
27+
ruby-version: "3.3"
28+
bundler-cache: true
29+
30+
- name: Configure Pages
31+
id: pages
32+
uses: actions/configure-pages@v6
33+
34+
- name: Build website
35+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
36+
env:
37+
JEKYLL_ENV: production
38+
39+
- name: Upload website
40+
uses: actions/upload-pages-artifact@v4
41+
1842
deploy:
1943
environment:
2044
name: github-pages
2145
url: ${{ steps.deployment.outputs.page_url }}
46+
needs: build
2247
runs-on: ubuntu-latest
2348
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v4
26-
- name: Configure Pages
27-
uses: actions/configure-pages@v5
28-
- name: Upload website
29-
uses: actions/upload-pages-artifact@v3
30-
with:
31-
path: .
3249
- name: Deploy to GitHub Pages
3350
id: deployment
34-
uses: actions/deploy-pages@v4
51+
uses: actions/deploy-pages@v5

00-setup/README.md

Lines changed: 197 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,248 @@
1-
# Setup: Run Python on Your Computer
1+
---
2+
layout: default
3+
title: Setup
4+
nav_order: 4
5+
has_children: true
6+
permalink: /setup/
7+
course_lesson: true
8+
course_index: "00"
9+
next_page: /lessons/fundamentals/
10+
next_title: Python Fundamentals
11+
---
12+
13+
# Setup: Run Your First Python Program
14+
15+
This page helps you install Python, create one file, and see your first successful output. Complete the quick start before learning about virtual environments.
16+
17+
## Before installing anything
18+
19+
If you use a school or office computer, ask a parent, teacher, or administrator before installing software. Do not remove a Python installation that already belongs to the operating system.
20+
21+
You need:
22+
23+
- a computer running Windows, macOS, or Linux;
24+
- permission to install software;
25+
- a text editor;
26+
- a terminal, which is a window where you type commands.
27+
28+
Choose only the section for your operating system.
29+
30+
## Windows quick start
31+
32+
### Step 1 — install Python
33+
34+
Use the official [Python Install Manager instructions](https://docs.python.org/3/using/windows.html). It can be installed from Python.org or the Microsoft Store.
35+
36+
After installation, open **PowerShell** from the Start menu and type:
37+
38+
```powershell
39+
python --version
40+
```
241

3-
## Goal
42+
If your installation uses the `py` command, this also works:
443

5-
By the end of this section you can install Python, open a terminal, run Python code, create a project folder, and use an isolated virtual environment.
44+
```powershell
45+
py --version
46+
```
647

7-
## Which Python should I install?
48+
You should see a Python 3 version. The exact numbers may be newer than examples in this course.
849

9-
Use a current stable Python 3 release from [python.org/downloads](https://www.python.org/downloads/). Do not install a pre-release for this course.
50+
### Step 2 — create a learning folder
1051

11-
## macOS
52+
```powershell
53+
mkdir python-learning
54+
cd python-learning
55+
```
56+
57+
- `mkdir` creates a folder.
58+
- `cd` moves the terminal into that folder.
59+
60+
### Step 3 — create and run `hello.py`
61+
62+
Open the `python-learning` folder in your editor. Create a file named `hello.py` and type:
1263

13-
1. Download the macOS installer from [Python Releases for macOS](https://www.python.org/downloads/macos/).
14-
2. Run the installer and complete the prompts.
15-
3. Open Terminal and verify:
64+
```python
65+
print("Hello, Python!")
66+
```
67+
68+
Save the file. Return to PowerShell and run:
69+
70+
```powershell
71+
python hello.py
72+
```
73+
74+
If `python` does not work but `py` does, run:
75+
76+
```powershell
77+
py hello.py
78+
```
79+
80+
Expected output:
81+
82+
```text
83+
Hello, Python!
84+
```
85+
86+
## macOS quick start
87+
88+
### Step 1 — install Python
89+
90+
Download the current supported Python 3 installer from [Python Releases for macOS](https://www.python.org/downloads/macos/). Use the normal `.pkg` installer and complete its instructions.
91+
92+
Open **Terminal** and type:
1693

1794
```bash
1895
python3 --version
1996
```
2097

21-
4. Create a workspace:
98+
You should see a Python 3 version. Do not delete or modify Python supplied by macOS or Apple development tools.
99+
100+
### Step 2 — create a learning folder
22101

23102
```bash
24103
mkdir python-learning
25104
cd python-learning
26-
python3 -m venv .venv
27-
source .venv/bin/activate
28-
python --version
29105
```
30106

31-
## Linux
107+
### Step 3 — create and run `hello.py`
108+
109+
Open the `python-learning` folder in your editor. Create `hello.py`:
110+
111+
```python
112+
print("Hello, Python!")
113+
```
32114

33-
Python is already available on many distributions. Use your distribution's package manager and prefer Python 3. On Debian or Ubuntu:
115+
Save it and run:
116+
117+
```bash
118+
python3 hello.py
119+
```
120+
121+
Expected output:
122+
123+
```text
124+
Hello, Python!
125+
```
126+
127+
## Linux quick start
128+
129+
Python 3 is already available on many Linux distributions. First try:
130+
131+
```bash
132+
python3 --version
133+
```
134+
135+
If Python is unavailable on Debian or Ubuntu, use:
34136

35137
```bash
36138
sudo apt update
37139
sudo apt install python3 python3-venv python3-pip
38-
python3 --version
140+
```
141+
142+
For Fedora, Arch, or another distribution, use its package manager and the [official Python Unix guide](https://docs.python.org/3/using/unix.html).
143+
144+
Create the learning folder:
145+
146+
```bash
39147
mkdir python-learning
40148
cd python-learning
149+
```
150+
151+
Create `hello.py` in your editor:
152+
153+
```python
154+
print("Hello, Python!")
155+
```
156+
157+
Save it and run:
158+
159+
```bash
160+
python3 hello.py
161+
```
162+
163+
## What just happened?
164+
165+
```text
166+
hello.py -> Python reads the file -> print() displays text -> terminal shows output
167+
```
168+
169+
- `hello.py` is a Python source file.
170+
- `.py` is the usual filename ending for Python code.
171+
- `python`, `py`, or `python3` starts the Python interpreter.
172+
- An **interpreter** is the program that reads and runs Python instructions.
173+
174+
If you saw `Hello, Python!`, pause and enjoy that small win. Your computer has successfully run your code.
175+
176+
## Recommended next step: a virtual environment
177+
178+
A virtual environment is a private project box for Python tools and installed packages. One project's packages will not interfere with another project's packages.
179+
180+
```text
181+
computer Python
182+
├── project A .venv -> project A packages
183+
└── project B .venv -> project B packages
184+
```
185+
186+
The Basic examples use the standard library and can run without extra packages. Creating `.venv` now is still a useful habit.
187+
188+
### macOS and Linux
189+
190+
From inside `python-learning`:
191+
192+
```bash
41193
python3 -m venv .venv
42194
source .venv/bin/activate
43195
python --version
44196
```
45197

46-
For Fedora, Arch, and other distributions, follow the distribution-specific instructions in the [official Unix guide](https://docs.python.org/3/using/unix.html).
198+
### Windows PowerShell
47199

48-
## Windows
49-
50-
1. Install Python using the official [Windows installation guide](https://docs.python.org/3/using/windows.html) or the Python Install Manager from [python.org/downloads](https://www.python.org/downloads/).
51-
2. Open PowerShell and verify:
200+
From inside `python-learning`:
52201

53202
```powershell
54-
py --version
203+
python -m venv .venv
204+
.venv\Scripts\Activate.ps1
205+
python --version
55206
```
56207

57-
3. Create a workspace and virtual environment:
208+
If you normally use `py`, create it with:
58209

59210
```powershell
60-
mkdir python-learning
61-
cd python-learning
62211
py -m venv .venv
63-
.venv\Scripts\Activate.ps1
64-
python --version
65212
```
66213

67-
If PowerShell blocks activation, use the Python interpreter directly with `.venv\Scripts\python.exe`, or ask an administrator to review the execution-policy setting. Do not randomly change system security settings.
68-
69-
## First program
214+
When activation succeeds, the terminal prompt normally begins with `(.venv)`. Activation makes the plain `python` command select the environment's interpreter.
70215

71-
Create a file named `hello.py`:
216+
To leave the environment later:
72217

73-
```python
74-
print("Hello, Python!")
218+
```text
219+
deactivate
75220
```
76221

77-
Run it from the activated environment:
222+
If PowerShell blocks activation, do not randomly weaken computer security. You may run the environment directly:
78223

79-
```bash
80-
python hello.py
224+
```powershell
225+
.venv\Scripts\python.exe hello.py
81226
```
82227

228+
## Choose an editor
229+
230+
Read [Editor Setup](editor-setup.md). Any editor that saves plain `.py` files is acceptable. IDLE, which is included with many Python installations, is enough for this course.
231+
232+
## Learn six terminal commands
233+
234+
Read [Terminal Basics](terminal-basics.md). You only need a few commands to move between folders and run files.
235+
83236
## Setup checkpoint
84237

85-
- [ ] Python 3 is installed.
86-
- [ ] The version command works.
87-
- [ ] A virtual environment was created.
88-
- [ ] The environment was activated.
89-
- [ ] `hello.py` runs successfully.
90-
- [ ] You know how to deactivate it with `deactivate`.
238+
- [ ] A Python 3 version command works.
239+
- [ ] The `python-learning` folder exists.
240+
- [ ] `hello.py` contains the one-line program.
241+
- [ ] Running the file displays `Hello, Python!`.
242+
- [ ] I know which command works on my computer: `python`, `py`, or `python3`.
243+
- [ ] I either created `.venv` or understand that I can return to that optional step.
244+
245+
If a checkpoint fails, open [Setup Troubleshooting](troubleshooting.md).
91246

92247
---
93248

00-setup/editor-setup.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
1+
---
2+
layout: default
3+
title: Editor Setup
4+
parent: Setup
5+
nav_order: 1
6+
permalink: /setup/editor/
7+
---
8+
19
# Editor Setup
210

311
Use any editor that supports Python syntax. Visual Studio Code is a convenient option, but the course does not depend on a particular editor.
412

13+
## Easiest choice: IDLE
14+
15+
IDLE is included with many official Python installations. Open IDLE, choose **File → New File**, type your program, save it with a `.py` ending, and choose **Run → Run Module**.
16+
17+
## Visual Studio Code choice
18+
19+
1. Install Visual Studio Code from its official website.
20+
2. Open the complete `python-learning` folder.
21+
3. Install Microsoft's official Python extension when prompted.
22+
4. Select the Python interpreter from `.venv` if you created one.
23+
5. Open the integrated terminal and run the file with the command from Setup.
24+
25+
An **editor** is where you write and save code. A **terminal** is where you type commands that run the saved code. They may appear in one application, but they have different jobs.
26+
527
Recommended habits:
628

729
- Open the repository folder, not just one file.
830
- Install the editor's official Python extension if available.
931
- Select the `.venv` interpreter.
1032
- Keep one experiment per file while learning.
1133
- Run programs from the terminal so the command is familiar.
34+
35+
---
36+
37+
[Back to Setup](README.md) · [Terminal Basics](terminal-basics.md) · [Troubleshooting](troubleshooting.md)

0 commit comments

Comments
 (0)