Skip to content

Drop ASCII-art dividers, colourise example output, ASCII-only source - #1

Merged
sbryngelson merged 2 commits into
sbryngelson:mainfrom
comp-physics:cleanup/ascii-and-example-output
Jun 14, 2026
Merged

sbryngelson merged 2 commits into
sbryngelson:mainfrom
comp-physics:cleanup/ascii-and-example-output

Conversation

@sbryngelson

Copy link
Copy Markdown
Owner

Summary

Two cleanups to the examples' presentation and to source-text hygiene. No library behaviour changes — all edits are display strings, comments, and docstrings.

1. Examples: drop ASCII-art dividers, colourise output

  • Removed "=" * N / "-" * N printed dividers and # ----/# ==== comment rules across the examples.
  • Added small helpers in examples/_common.py, following the conventional logging palette:
    • head() — bold green section headers (INFO), replacing the old =-banner blocks.
    • aside() — dim explanatory notes, so commentary recedes behind the numbers.
    • showwarning override — yellow warnings (WARNING), with each distinct warning shown once per run (collapses DispatchFloorWarning's per-call-site repeats).
  • All colour is tty-guarded and NO_COLOR-aware: piped output / redirected files stay plain text. The library's warning filters are untouched (only the render step is overridden).

2. ASCII-only source

  • Replaced 853 non-ASCII symbols across 70 files (aneforge/, tests/, bench/, + 3 native .mm/.h) with ASCII equivalents: em/en dash -> -, →->->, ×->x, ᵀ->^T, L⁻¹->L^-1, ≤/≥-><=/>=, ✓->OK, ·->*, etc.
  • All occurrences were in comments, docstrings, and string labels — none in executable logic.

Verification

  • ruff check: passes (CI lint job green).
  • python -m compileall / py_compile: clean across all source; native dylib rebuilds from the edited .mm/.h.
  • tests/op_smoketest.py: 22/22 ops correct on the ANE (M5 Pro).
  • Full corpus (pytest tests/, forked): 524/527 passed.

Note on the 3 non-passing tests (pre-existing, NOT introduced here)

  • test_cross_compile.py::test_relu_rejected_below_the_mil_floor — deterministic pre-existing bug: cross_compile_check for a sub-MIL-floor family (h11) raises ValueError in _targets.py instead of returning False. Reproduces identically on the unmodified code (the diff to _targets.py is comment-only).
  • test_train_cifar.py::test_conv2d_pad_grad_matches_torch, ::test_group_norm_train_grad_matches_torch — pass in isolation; only segfault (signal 11) during the full forked mass-run (torch/libomp under hundreds of sequential forks). test_train_cifar.py is unmodified by this PR.

Tracking fixes for these separately.

@sbryngelson
sbryngelson merged commit cfc934f into sbryngelson:main Jun 14, 2026
9 checks passed
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.

1 participant