A Magazine, Not a Textbook
When you open c’t Python-Projekte 2020, the editorial makes the framing explicit: “You are not holding a textbook. Instead, this special issue presents projects that each present a problem and solve it with Python.” Editor Pina Merkert describes the collection as “examples without didactic concept” – a deliberate choice that places the burden of adaptation on the reader. The result is a 170-page snapshot of Python’s 2020 applied-engineering surface: beginner scripts, everyday automation, machine-learning pipelines, testing strategies, and advanced engineering topics, all written in German with German identifiers and comments.
The through-line is a single teaching artifact – the c’t SESAM password manager – iteratively refined across five sections from a 22-line script to a modular, encrypted, JSON-persisted application. This evolution demonstrates standard-library cryptography, byte/string handling, object-oriented design, serialization, compression, and authenticated encryption while documenting each simplification’s security and operational trade-offs.
The SESAM Spine: Visible Evolution with Explicit Trade-offs
SESAM derives per-service passwords from a master password plus domain using PBKDF2-HMAC-SHA512 with 4,096 iterations, then encodes the 512-bit digest into a curated 83-symbol alphabet via repeated modulo division. The design teaches UTF-8 encoding, modulo bias analysis (2^512 mod 83 is nearly uniform), and the danger of domain concatenation without a separator – “paypal” and “www.paypal.com” would collide.
A second layer introduces a 64-byte random key-encryption-key (KGK) encrypted under a PBKDF2-derived key. This allows master-password rotation without regenerating service passwords. The KGK design prevents offline verification because AES decryption yields random bytes without a padding oracle. However, the implementation uses AES-CBC with PKCS7 padding and no HMAC or AEAD – a deliberate simplification flagged in the text as a learning exercise, not a production pattern.
The security simplifications are presented openly: 4,096 PBKDF2 iterations (OWASP 2024 recommends ≥600,000 for PBKDF2-SHA512), a fixed “pepper” salt reused across all derivations, no memory-hard KDF such as Argon2 or scrypt, no forward secrecy, and domain concatenation without a separator. The text explicitly notes that the extended version in the next article uses per-password salts – a pedagogical progression that makes the trade-offs visible rather than hidden.
Patterns That Transfer Beyond the Page
Relative-Coordinate OCR Pipelines
The canteen-menu extractor uses percentage-based cropping (soup_x=0.102, soup_y=0.21) and a row-first slicing function that splits each row into five equal horizontal boxes. One constant set works across DIN A4 and A3 PDFs because the layout is proportional, not absolute. German Tesseract language data (tesseract-ocr-deu) is mandatory for umlaut recognition. This template transfers to any fixed-layout table – invoices, timetables – where grid structure is stable but absolute dimensions vary.
Offline Breach Monitoring via Binary Search
The Have I Been Pwned SHA-1 list (version 5, 25 GB unpacked) is searched locally via recursive binary search over byte offsets: seek midpoint, scan backward to line start with a custom get_full_line(), compare hex strings lexicographically (valid because A-F > 0-9 in Unicode). A query completes in roughly 0.027 seconds. The script replicates Troy Hunt’s UTF-8-before-SHA-1 encoding. A console alternative using sha1sum | grep requires no Python at all.
Property-Based Testing as Invariant Specification
Hypothesis replaces example enumeration with round-trip invariants: encrypt/decrypt, square/square-root. It discovered x = -1 as a counterexample for sqrt(square(x)) == x and the 64-bit float precision boundary at approximately 9×10^15 where math.sqrt collisions appear. The effort shifts from writing cases to designing accurate strategies; incorrect constraints yield false positives or false negatives.
Declarative Visualization Replacing Imperative Plotting
Altair’s alt.Chart(df).mark_bar().encode(…) renders Vega-Lite output (PNG, SVG, HTML) in Jupyter, replacing verbose Matplotlib code. A banking example produces a stacked bar chart of monthly spend by category from a 627-row CSV. The limitation: Altair’s browser-dependent JavaScript runtime impacts offline and export workflows.
Qt Thread-Affinity via Signal/Slot with QueuedConnection
Worker threads inheriting Thread + QObject must explicitly call QObject.__init__ (method resolution order calls only the first base). Signals emitted from worker threads connected with Qt.QueuedConnection execute slots in the receiver’s thread (the main GUI thread), satisfying Qt’s widget-affinity rule. Cross-thread widget access silently fails with only a console warning – a pattern applicable to any background I/O (network, disk, inference) updating Qt widgets.
Machine-Learning Pipelines: Prototype to Edge Deployment
The issue covers ESRGAN super-resolution, LSTM text tagging, CycleGAN style transfer, CNN blur detection, and TensorFlow Lite quantization. Training times are cited for specific GPUs: CycleGAN ~24 hours on a GTX 1080 Ti for “sufficient” results; LSTM tagger achieves 39% validation c_score versus 3% for a simple RNN and 0% for a fully connected network (single run, no confidence intervals). The LSTM chapter notes training took over six hours on a Tesla P100 with batch-size tuning for that specific GPU – no CPU fallback mentioned.
Quantization is framed as a deployment strategy, not just compression. TensorFlow Lite INT8 quantization reduces model size to roughly 25% of float32; calibration requires only a few hundred unlabeled representative samples. However, on x86 CPUs (2020) the same quantized InceptionV3 runs dramatically slower than float32 because Google optimized kernels for ARM – a hardware-specific result that may have changed with newer TensorFlow Lite versions. The guidance: INT8 for ARM edge, float32 for x86/CUDA.
Synthetic Data Generation with Artifact Acknowledgment
The blur-detection training pipeline degrades sharp photos via Gaussian blur (σ=0.5-6.0), motion blur (rotated 9×9 line kernel), focus-mask blending (radial gradient), and sensor-noise simulation. The author notes that synthetic noise differs from real Poisson shot noise, read noise, and fixed-pattern noise; the linear shake kernel assumes uniform motion; focus blending creates artificial transitions unlike optical depth-of-field. Overfitting to pipeline artifacts pushes training accuracy above 90% but harms real-world generalization – an acknowledged limitation without independent benchmark against Laplacian variance thresholding.
Testing Strategy Ladder
The issue demonstrates a cost/benefit progression: unit (unittest) → integration (Flask test_client, Django TestCase) → UI (Selenium headless) → mutation (MutMut) → property-based (Hypothesis). MutMut produced 887 mutants for a Markdown converter; a surviving mutant changed HTTP 200→201 (killed by adding assertEqual(200, response.status_code)); another pos+=1→pos=1 caused an infinite loop (timeout category). CI integration (GitHub Actions) rejects commits on test failure or coverage drop. Django parallel test overhead measured 11.3 seconds parallel versus 3.6 seconds serial on a 4-core i5 – a single project; overhead ratio may vary.
Reproducible Experiment Tracking
Sacred’s @ex.config/@ex.automain captures hyperparameters, source code, random seeds, and system provenance (CPU, GPU, OS, Git commit, dependencies) into MongoDB. A custom queue processor enables overnight GPU utilization across machines. The determinism claim (seeding all RNGs) is a feature claim, not independently verified.
Limitations That Shape Usage
- German-language identifiers and content reduce accessibility: variable names (F_BREITE, F_HOEHE, bilder_gut, bilder_schlecht), comments, and UI text are German throughout; short links (ct.de/wmeh, ct.de/wtnz, ct.de/wmh4, ct.de/wbxj) risk link rot.
- Hardware dependencies limit reproducibility: GPU-required chapters assume CUDA/cuDNN, Nvidia driver, developer account; training times cited for specific GPUs (GTX 1080 Ti, Tesla P100) without CPU fallbacks.
- Minimal error handling and production hardening: no retry logic, circuit breakers, structured logging, or deployment hardening (uWSGI+Nginx mentioned without TLS, rate limiting, secrets management).
- Proprietary or private data in examples: genomic analysis uses the author’s MyHeritage/Ancestry/23andMe files; banking CSV (bankdaten.csv) local; health data from Noom/Lose It!/Yazio – none reproducible by readers.
- No pedagogical scaffolding: readers must self-direct adaptation; no exercises, solutions, or progression markers.
- AssetStorm cache invalidation scales poorly: full-subtree JSON embedding invalidates changed asset and all ancestors on mutation; no schema-evolution strategy; no built-in frontend.
2020 Library Versions Lock Examples
TensorFlow 1.x graph/session APIs (placeholder, Session, checkpoint files) appear in super-resolution and LSTM chapters; PyQt5 (not PyQt6/PySide6); requests_oauthlib syntax assumed stable; Python ≤3.7 required for TensorFlow 2.1.0 (3.8 incompatible at writing). These version locks mean a 2024 reader must update imports, APIs, and security practices – Argon2 instead of PBKDF2, AEAD instead of AES-CBC, TensorFlow 2.x/Keras, PyQt6/PySide6.
A Pattern Catalog for the Present
For a contemporary reader, the issue serves best as a pattern catalog: relative-coordinate OCR templates, binary-search breach checking, quantization deployment heuristics, property-based testing invariants, Qt thread-affinity patterns – each requiring version updates, security review, and adaptation to current best practices. The pedagogical value lies in the visible evolution of SESAM from 22 lines to a modular encrypted store, where each simplification is explicitly flagged with its trade-off. Python enables rapid prototype construction; production readiness remains a separate engineering discipline not covered in these pages.