Skip to content

Commit 23fff91

Browse files
committed
Merge feature/docs-site-overhaul: docs-site overhaul (uvx-first, hero, dark mode, How It Works + FAQ, social cards, v0.4.0)
2 parents fe55d9c + c383ae6 commit 23fff91

15 files changed

Lines changed: 952 additions & 61 deletions

File tree

.github/workflows/pages.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
cache-dependency-path: requirements-docs.txt
2727
- uses: actions/configure-pages@v5
2828
- run: python -m pip install -r requirements-docs.txt
29+
- name: Install social-card system deps
30+
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pango1.0-tools
2931
- run: mkdocs build --strict
3032
- uses: actions/upload-pages-artifact@v3
3133
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,6 @@ dmypy.json
138138
/pythonlings/.git/
139139
/pythonlings/.pythonlings.toml
140140
/pythonlings/exercises/
141+
142+
# Docs build venv
143+
.venv-docs/

docs-site/assets/favicon.svg

Lines changed: 6 additions & 0 deletions
Loading

docs-site/assets/logo.svg

Lines changed: 5 additions & 0 deletions
Loading

docs-site/faq.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# FAQ
2+
3+
## How is this different from Rustlings?
4+
5+
Pythonlings brings the same fix-broken-exercises idea to Python. Instead of Rust's compiler, it uses a terminal TUI built with [Textual](https://textual.textualize.io/) and runs hidden `assert`-based checks in a subprocess each time you save.
6+
7+
## Do I need `uv`?
8+
9+
No. The easiest zero-install path is `uvx pythonlings`, but you can also install with `pipx install pythonlings`, `uv tool install pythonlings`, or plain `pip install pythonlings`.
10+
11+
## Which Python versions are supported?
12+
13+
Python 3.9 and above (`requires-python = ">=3.9"`).
14+
15+
## Where is my progress stored?
16+
17+
Progress lives in the learner workspace you create with `pythonlings init`, at `<workspace>/.pythonlings/state.json`. It is written atomically with a `.bak` recovery copy and is never stored inside the installed package.
18+
19+
## How do I update or reset?
20+
21+
Run `pythonlings update` to pull the latest exercises into an existing workspace. To restore a single exercise to its original broken state, run `pythonlings reset <exercise> --yes`.
22+
23+
## Does it work offline?
24+
25+
Yes. All exercises and the bundled local Python reference (press `F5` in the TUI) work without a network connection. Only the "open official docs" shortcut (`O`) requires internet access.
26+
27+
## Is Pythonlings on PyPI?
28+
29+
Yes — install it as [`pythonlings`](https://pypi.org/project/pythonlings/) (current release: `v0.4.0`).
30+
31+
## How do I see the reference answer?
32+
33+
Run `pythonlings solution <exercise>` (alias: `sol`). This executes the reference solution for the named exercise.

docs-site/how-it-works.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# How It Works
2+
3+
![Pythonlings demo](https://raw.githubusercontent.com/abhiksark/pythonlings/main/docs/assets/demos/pythonlings-demo.gif)
4+
5+
Pythonlings follows a tight edit-check-advance loop. Here is what happens at each step.
6+
7+
---
8+
9+
## The Learner Loop
10+
11+
1. **Open the next pending exercise** — the TUI shows the first incomplete exercise in the curriculum.
12+
2. **Edit the broken code** — fix the intentional mistake directly in the built-in editor (or any external editor you prefer).
13+
3. **Checks rerun automatically** — roughly 0.6 s after you stop typing, Pythonlings re-evaluates the exercise in a fresh subprocess. There is no filesystem watcher; the debounce fires inside the TUI editor.
14+
4. **Remove the `# I AM NOT DONE` marker** — the marker is your explicit "I'm finished" signal. Passing checks alone does not advance the exercise (see below).
15+
5. **Advance** — once checks are green *and* the marker is gone, the exercise is marked complete and the TUI moves to the next one.
16+
17+
---
18+
19+
## The `# I AM NOT DONE` Marker
20+
21+
Every exercise file begins with the comment:
22+
23+
```python
24+
# I AM NOT DONE
25+
```
26+
27+
You must delete this line to finish the exercise. This is intentional: it prevents an accidental fix (or a pre-written solution) from silently skipping an exercise before you have thought it through. The marker is your deliberate "I understand this and I'm moving on" confirmation.
28+
29+
---
30+
31+
## Worked Example
32+
33+
**Broken exercise** (`exercises/variables/variables1.py`):
34+
35+
```python
36+
# I AM NOT DONE
37+
38+
# Assign the integer 42 to the variable `answer`.
39+
answer = "forty-two"
40+
```
41+
42+
The hidden check (`checks/variables/variables1.py`) does something like:
43+
44+
```python
45+
assert answer == 42, f"Expected 42, got {answer!r}"
46+
```
47+
48+
Running with the code above, the check fails. Fix the exercise:
49+
50+
**Fixed exercise:**
51+
52+
```python
53+
# Assign the integer 42 to the variable `answer`.
54+
answer = 42
55+
```
56+
57+
Note that `# I AM NOT DONE` has been removed. Now the check passes *and* the marker is gone, so Pythonlings marks `variables1` complete and opens the next exercise.
58+
59+
---
60+
61+
## How Checks Run
62+
63+
Pythonlings generates a tiny runner script that `exec()`s your exercise source, then the hidden check source, in a shared namespace inside a fresh subprocess (5 s timeout). Because the check runs in the same namespace as the exercise, it can inspect any variable you set — that is why checks are bare `assert` statements rather than a pytest file.
64+
65+
---
66+
67+
## Where Progress Is Stored
68+
69+
Progress lives in your learner workspace, not in the Pythonlings package:
70+
71+
```
72+
<workspace>/.pythonlings/state.json
73+
```
74+
75+
The file is written atomically (write to a temp file, then rename), and a `.bak` copy is kept so Pythonlings can recover if `state.json` is ever corrupted. The workspace itself is created by `pythonlings init`.

docs-site/index.md

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
1-
# Pythonlings
2-
3-
Python learnings, Rustlings-style, in a live terminal TUI.
1+
---
2+
hide:
3+
- toc
4+
---
5+
6+
<div class="pl-hero" markdown>
7+
<div class="pl-eyebrow">Rustlings for Python</div>
8+
<div class="pl-title">Learn Python by fixing tiny broken programs.</div>
9+
<div class="pl-subtitle">292 exercises across 31 topics. Hidden checks rerun the
10+
instant you save — fix the code, watch it go green, advance.</div>
11+
<div class="pl-install">$ uvx pythonlings init</div>
12+
<div class="pl-ctas">
13+
<a class="pl-btn" href="quick-start/">Get started →</a>
14+
<a class="pl-btn pl-btn--ghost" href="https://github.com/abhiksark/pythonlings">View on GitHub</a>
15+
</div>
16+
<div class="pl-stats"><span><b>292</b> exercises</span><span><b>31</b> topics</span><span><b>zero</b> setup</span></div>
17+
</div>
418

519
![Pythonlings terminal demo](https://raw.githubusercontent.com/abhiksark/pythonlings/main/docs/assets/demos/pythonlings-demo.gif)
620

7-
Pythonlings helps learners practice Python by fixing small broken programs and
8-
watching checks rerun as they work. The project includes 292 exercises across
9-
31 topics, hidden pytest-style checks, a Textual editor, progressive hints, and
10-
bundled Python documentation snippets for offline-friendly practice.
21+
## What you get
22+
23+
- Rustlings-inspired Python practice, entirely in your terminal.
24+
- Hidden checks that rerun as you type and advance you automatically.
25+
- Topic picker, progress tracking, reset, progressive hints, and one-shot CLI commands.
26+
- A local docs window with links back to the official Python documentation.
27+
- A self-contained learner workspace created by `pythonlings init`.
1128

12-
## Start Here
29+
## Start here
1330

1431
```bash
15-
pipx install "git+https://github.com/abhiksark/pythonlings.git@v0.1.0"
16-
pythonlings init --path ~/pythonlings-workspace
32+
uvx pythonlings init --path ~/pythonlings-workspace
1733
cd ~/pythonlings-workspace
18-
pythonlings
34+
uvx pythonlings
1935
```
2036

21-
The package name reserved for PyPI publishing is `pythonlings`. Until the
22-
PyPI release is live, install the stable v0.1.0 release from the GitHub tag.
23-
24-
## What You Get
25-
26-
- Rustlings-inspired Python coding practice in the terminal.
27-
- Live exercise verification while editing.
28-
- Topic picker, progress tracking, reset, hints, and one-shot CLI commands.
29-
- Local docs window with links back to the official Python documentation.
30-
- A self-contained learner workspace created by `pythonlings init`.
37+
Prefer a permanent install? See [Quick Start](quick-start.md) for `pipx`, `uv tool`, and `pip`.
3138

32-
## Project Status
39+
## Project status
3340

34-
Pythonlings is currently `v0.1.0` alpha. The public API, CLI, and curriculum are
35-
usable, but the project is still hardening packaging, docs, first-run flow, and
36-
release automation.
41+
Pythonlings is `v0.4.0`, published on PyPI as `pythonlings`. The learner loop, CLI, and
42+
curriculum are stable; see the [Roadmap](roadmap.md) for what's next.

docs-site/interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
![Coding screen](https://raw.githubusercontent.com/abhiksark/pythonlings/main/docs/assets/screenshots/coding-screen.png)
66

77
The coding screen keeps the exercise, editor, output, progress, and exercise
8-
list in one terminal view. Checks rerun as files change.
8+
list in one terminal view. Checks rerun automatically after each edit (debounced).
99

1010
## Topic Picker
1111

docs-site/quick-start.md

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
# Quick Start
22

3-
## Install
3+
> Current release: **v0.4.0** · [PyPI](https://pypi.org/project/pythonlings/)
44
5-
Install the current release from GitHub:
5+
## Zero-Install (uvx)
6+
7+
No installation required — run Pythonlings directly with [uv](https://docs.astral.sh/uv/):
68

79
```bash
8-
pipx install "git+https://github.com/abhiksark/pythonlings.git@v0.1.0"
10+
uvx pythonlings init --path ~/pythonlings-workspace
11+
cd ~/pythonlings-workspace
12+
uvx pythonlings
913
```
1014

11-
After PyPI publishing is enabled, the package install path will be:
15+
## Install Options
1216

13-
```bash
14-
pipx install pythonlings
15-
```
17+
=== "uv (recommended)"
18+
```bash
19+
uvx pythonlings # zero-install, always latest
20+
uv tool install pythonlings
21+
```
22+
23+
=== "pipx"
24+
```bash
25+
pipx install pythonlings
26+
```
1627

17-
The command installed by the package is `pythonlings`.
28+
=== "pip"
29+
```bash
30+
pip install pythonlings
31+
```
1832

19-
## Create A Workspace
33+
## Create a Workspace
2034

2135
```bash
2236
pythonlings init --path ~/pythonlings-workspace
@@ -25,27 +39,27 @@ pythonlings
2539
```
2640

2741
`pythonlings init` copies exercises, hidden checks, reference solutions, and reset
28-
snapshots into a learner workspace. Run `pythonlings` from that workspace to open
29-
the first pending exercise.
42+
snapshots into a self-contained learner workspace. Running `pythonlings` (or
43+
`pythonlings watch`) from that workspace opens the first pending exercise in the
44+
TUI.
3045

3146
## Useful Commands
3247

3348
```bash
34-
pythonlings list
35-
pythonlings topics
36-
pythonlings hint variables1
37-
pythonlings run variables1
38-
pythonlings dry-run variables1
39-
pythonlings reset variables1 --yes
40-
pythonlings update
49+
pythonlings list # show all topics and progress
50+
pythonlings topics # open the topic picker in the TUI
51+
pythonlings start variables # launch TUI on a specific topic
52+
pythonlings hint variables1 # print the hint for an exercise
53+
pythonlings solution variables1 # run the reference solution for an exercise
54+
pythonlings run variables1 # run a single exercise and show output
55+
pythonlings dry-run variables1 # non-interactive run (CI-friendly)
56+
pythonlings reset variables1 --yes # restore exercise to its original state
57+
pythonlings update # pull new exercises into an existing workspace
4158
```
4259

43-
Use `pythonlings list` to inspect progress, `pythonlings hint <exercise>` for help, and
44-
`pythonlings reset <exercise> --yes` to restore an exercise to its original broken
45-
state.
46-
4760
## Exercise Loop
4861

49-
Each exercise contains a `# I AM NOT DONE` marker. Fix the code, remove the
50-
marker, and let Pythonlings run the hidden check. Passing checks mark the exercise
51-
complete and move the progress state forward.
62+
Each exercise contains a `# I AM NOT DONE` marker. Open the file in the TUI
63+
editor (or any editor), fix the broken code, then remove the marker. Pythonlings
64+
runs the hidden check automatically; when the check passes and the marker is gone,
65+
the exercise is marked complete and progress advances to the next one.

docs-site/roadmap.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# Roadmap
22

3-
Pythonlings is currently `v0.1.0` alpha. The core learner loop works, but the
4-
project still needs product hardening before calling it stable.
3+
Pythonlings is `v0.4.0`, published on PyPI as `pythonlings`. Install with
4+
`uvx pythonlings` or `pip install pythonlings`.
55

6-
## Current Release
6+
## Shipped
77

88
- 292 exercises across 31 topics.
99
- Live Textual editor and automatic checks.
1010
- Topic picker, progress state, reset, hints, and CLI commands.
1111
- Bundled Python docs snippets with official docs links.
12-
- GitHub install path for `v0.1.0`.
12+
- Published on PyPI as `pythonlings`; canonical install is `uvx pythonlings`.
1313

1414
## Next Work
1515

16-
- Finish PyPI publishing for the `pythonlings` project name.
1716
- Improve first-run onboarding and empty-state copy.
1817
- Harden keyboard flow around `Enter`, `Esc`, `F4`, and `F5`.
1918
- Add more TUI tests for the coding screen, docs window, and topic picker.

0 commit comments

Comments
 (0)