Fix broken demo, silent flag swallowing; add tests and LICENSE - #2
Open
mtisza1 wants to merge 1 commit into
Open
Fix broken demo, silent flag swallowing; add tests and LICENSE#2mtisza1 wants to merge 1 commit into
mtisza1 wants to merge 1 commit into
Conversation
- build_awk_cmd now defaults to `{print}` when no awk program and no
-f are given but stdin is not a tty, so `something | awkplot` works
like bare uplot. examples/demo.sh's first four steps used exactly
this form and previously failed immediately.
- Reject awkplot/uplot-looking flags placed after the awk program (or
after -f) instead of silently forwarding them to awk as bogus input
files. argparse.REMAINDER stopped honoring them there; now it is a
hard error with a hint instead of a quietly wrong plot.
- Detect empty awk output before invoking uplot and print a clear
"awkplot: awk produced no output" message instead of leaking uplot's
Ruby backtrace.
- Add --version flag.
- Add LICENSE (MIT), matching pyproject.toml's declared license.
- Fix examples/demo.sh's bar/scatter steps, which need -d ' ' since
uplot defaults to a tab delimiter while awk's default OFS is a
space; this was previously masked by the step 1 failure.
- Add unit tests for build_awk_cmd, build_uplot_cmd, and parse_size,
plus CLI-level --dry-run smoke tests, and a GitHub Actions workflow
that runs pytest across Python versions and demo.sh as a smoke test.
Closes #1
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the issues from #1:
build_awk_cmdnow defaults the awk program to{print}when neither a program nor-fis given and stdin isn't a tty,so
something | awkplotworks as a drop-in replacement for bareuplot.examples/demo.sh's first four steps relied on exactly this form andpreviously failed on step 1 (
awkplot: awk program required...). Steps2 and 3 also needed
-d ' 'sinceuplotdefaults to a tab delimiterwhile awk's default
OFSis a space — this was masked by the step 1failure and is fixed too so the demo actually runs end-to-end.
(or after
-f) used to be silently forwarded toawkas bogus inputfiles because
argparse.REMAINDERstops honoring-x-style tokens oncethe first positional is seen.
awkplotnow rejects any leftoverpositional that looks like a flag and isn't an existing file, with a
hint to move flags before the program/files, instead of producing a
plausible-looking but wrong plot.
detected before invoking
uplot, printingawkplot: awk produced no outputinstead of a Ruby backtrace.LICENSEfile matchingpyproject.toml's declared license.--versionflag.tests/test_awkplot_cli.pycoveringbuild_awk_cmd,build_uplot_cmd,parse_size, and CLI-level--dry-runsmoke tests for the two bug fixes above.pyproject.tomlgained
[tool.pytest.ini_options]sopytestruns out of the box.CI workflow not included in this PR
Item 3 also asks for a GitHub Actions job. I could not push
.github/workflows/ci.ymlwith this PR because the automation's tokenlacks the
workflowOAuth scope (GitHub rejects pushes that add/modifyworkflow files without it). Please add the following as
.github/workflows/ci.ymlmanually (verified locally:pytest -vandbash examples/demo.shboth pass with this branch):Not addressed
Left out of scope for this focused fix, per the issue's "smaller
follow-ups" section:
--uplot-args/--passthrough, packaging as a properpackage directory, and pinning
install.sh'sAWKPLOT_REF. Happy tofollow up on any of these separately.
Test plan
pytest -v(18 tests, all passing)bash examples/demo.shruns end-to-end without errorstdin | awkplot --dry-run, flags after the awkprogram now error out, empty-input error message,
--version,-f prog.awk, invalid-pchoice still rejected by argparseCloses #1