Skip to content

Broken demo, silent flag swallowing, and missing test/CI/license infrastructure #1

Description

@mtisza1

Findings from a read-through of main at bd431f4, with each item reproduced locally against awk 5.x, python 3.13, and youplot 0.5.0.

1. No default awk program, so stdin-only invocation is impossible (examples/demo.sh is broken)

build_awk_cmd requires a positional awk program whenever -f is absent (awkplot_cli.py:116). That makes the plain "pipe something in and plot it" form fail:

$ awk 'BEGIN{srand(42);for(i=1;i<=200;i++)print int(rand()*50)}' | awkplot -p hist -t "test"
awkplot: awk program required as first positional argument
  hint: awkplot [opts] 'awk program' [file ...]

Steps 1–4 of examples/demo.sh all use exactly this form, so the demo dies on the first plot under set -euo pipefail:

$ bash examples/demo.sh
=== 1. Histogram of random integers ===
awkplot: awk program required as first positional argument

Suggested fix: when no program and no -f are given, default the program to {print}. The error should only fire when there is no program and stdin is a TTY (nothing to read). As a bonus this makes awkplot a drop-in replacement for bare uplot.

2. Flags placed after the awk program are silently swallowed

args uses nargs=argparse.REMAINDER (awkplot_cli.py:73), which captures every remaining token including things that look like awkplot flags. They are then appended to the awk command as input files:

$ awkplot --dry-run '{print $1}' d.csv -p bar -t hi
awk '{print $1}' d.csv -p bar -t hi | uplot hist

-p bar and -t hi are ignored, the plot silently comes out as a hist, and awk is handed -p, bar, -t, hi as filenames. No warning is printed and the exit code is 0.

Suggested fix: switch to parse_known_args with manual program/file splitting, or at minimum error out when a leftover positional starts with - and is not an existing file. Silent wrong output is worse than a hard failure here.

3. No tests and no CI

There is no test suite and no workflow. Both bugs above are trivially detectable from --dry-run, which already returns a deterministic string:

4. LICENSE file is missing

pyproject.toml:11 declares license = { text = "MIT" }, but there is no LICENSE file in the tree. Reuse terms are ambiguous without it.

5. uplot's raw errors leak to the user

Empty awk output produces a Ruby backtrace rather than an awkplot-level message:

$ printf '' | awkplot -p hist '{print $1}'
Failed to parse the text.
/…/gems/youplot-0.5.0/lib/youplot/dsv.rb:13:in `parse'

Detecting empty upstream output and printing something like awkplot: awk produced no output would be friendlier. Exit codes themselves are correct (awk syntax error → 2, empty input → 1).

Smaller follow-ups

  • No uplot passthrough. Users are limited to the six mapped flags with no escape hatch for the rest of uplot's options. A --uplot-args or a -- separator would help.
  • No --version flag, despite a version in pyproject.toml.
  • Packaging. py-modules = ["awkplot_cli"] installs a bare top-level awkplot_cli module into site-packages; a proper package directory would avoid the namespace collision risk.
  • Installer tracks main. install.sh defaults AWKPLOT_REF=main, so curl | bash installs whatever HEAD happens to be. Pinning to a released tag would make installs reproducible.

Metadata

Metadata

Assignees

Labels

nightlyTriaged in a nightly repo review

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions