Skip to content

Add materials folders for four tutorials (imports, Thonny, project layouts, memory management) - #897

Merged
martin-martin merged 1 commit into
masterfrom
materials/add-4-cta-folders-20261019
Oct 19, 2026
Merged

martin-martin merged 1 commit into
masterfrom
materials/add-4-cta-folders-20261019

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Adds companion code folders for four tutorials that had no folder in this repo, so each one can offer a "Get Your Code" opt-in. Each folder mirrors the tutorial's current update draft (the maintenance pass waiting to publish).

Folder Tutorial Card
absolute-vs-relative-python-imports/ Absolute vs Relative Imports in Python https://trello.com/c/EAykbP3C
python-thonny/ Thonny: The Beginner-Friendly Python Editor https://trello.com/c/zlB8I9CN
python-application-layouts/ Python Project Structure: How to Choose the Right Layout https://trello.com/c/5TSeMBIu
python-memory-management/ Memory Management in Python https://trello.com/c/wqH8KcI3

What's in each folder

  • absolute-vs-relative-python-imports/: the tutorial's project/ tree as two runnable copies, absolute/ and relative/, so readers can compare the import styles (python main.py, python -m package1.module1). Also includes the import-style example as a reference file.

  • python-thonny/: the factorial programs, the simplecalculator script in its working version and its deliberately buggy version (the one the reader debugs in Thonny), and a fixed version, with simplecalculator==0.0.4 pinned.

  • python-application-layouts/: one project per layout example in the tutorial:

    • statkit (src layout library, fully working with tests)
    • weatherly (flat-layout CLI, using a fake data source and no network calls)
    • portfolio (Django)
    • bloggy (Flask)
    • bookapi (FastAPI)
    • notely (PySide6 GUI)

    Each has its own pyproject.toml with pinned dependencies and its own README.

  • python-memory-management/: refcount.py runs the tutorial's reference-counting snippets and prints sys.getrefcount() after each step. The tutorial gains a short pointer to it.

How it was verified

  • Every script was run on Python 3.14. Thonny's scripts were also run on 3.8, and the refcount script on 3.12 and 3.13. Outputs match the tutorials.
  • python-application-layouts/ projects:
    • statkit, weatherly, bloggy, bookapi and notely: installed into a fresh venv, with all tests passing (notely runs Qt offscreen).
    • portfolio: manage.py check and manage.py test pass.
    • bookapi: also served with uvicorn and queried.
  • uvx ruff@0.14.1 format --check and uvx ruff@0.14.1 check with the repo config, and .github/workflows/dircheck.py: all clean.

🤖 Generated with Claude Code

Absolute vs Relative Imports, Thonny, Python Project Structure (application
layouts), and Memory Management.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@martin-martin
martin-martin merged commit cb3df3e into master Oct 19, 2026
1 check passed
@martin-martin
martin-martin deleted the materials/add-4-cta-folders-20261019 branch October 19, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants