feat(cli): add samples annotation-template and upload-multiplexed commands#13
Conversation
…mands Implements User Story 5 (Phase 5) of the flowbio CLI: the full multiplexed upload flow of downloading a server-generated annotation sheet, filling it in, and submitting multiplexed reads alongside it. - `samples annotation-template` wraps the existing `get_annotation_template`, writing the `.xlsx` bytes to `-o/--output`. Because the body is binary, `-o` is required whenever it would clash with the stream that owns stdout — an interactive terminal or `--json` — failing fast with a usage error before any network call. With a piped stdout in human mode it streams the workbook to stdout. - `samples upload-multiplexed` wraps `upload_multiplexed_data`, reporting the data identifiers, annotation identifier, and any warnings. Warnings are reported but the upload proceeds by default (matching the library default); `--reject-warnings` opts into rejecting them. The samples parser registration is split into one `_configure_*` helper per verb, each taking a public `argparse.ArgumentParser`, keeping `register()` a concise verb registry without leaking argparse's private subparsers type. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@claude please review this PR |
|
Claude finished @mhusbynflow's task in 1m 58s —— View job Review:
|
…ering Addresses review feedback on the Phase 5 commands: - Make `-o/--output` always required for `samples annotation-template` and drop the stdout-streaming branch. The workbook is binary and the streamed path was both untestable (the test harness's StringIO has no `.buffer`) and prone to clashing with the JSON document on stdout. Requiring an output path is a strict superset of the previous "required when stdout is a terminal" rule; the contract and docs are updated to match. - Guard the output write against `OSError` (e.g. a missing parent directory or an unwritable path), re-raising as a `CliUsageError` so a bad `--output` returns exit 2 instead of an uncaught traceback — symmetric with the input-side `existing_file` guard. - Correct the `-o` help text (no longer claims it is only conditionally required). - Render annotation warnings one per line via `_format_warning` instead of a raw list-of-dicts repr. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
Implements User Story 5 (Phase 5) of the flowbio CLI — the full multiplexed upload flow:
samples annotation-template— downloads the server-generated annotation sheet (.xlsx) for a sample type (defaultgeneric, sent as-is) via the existingclient.samples.get_annotation_template, writing the bytes to-o/--output. Since the body is binary,-ois required whenever it would clash with the stream that owns stdout — an interactive terminal or--json— failing fast with exit 2 before any network call. With a piped stdout in human mode it streams the workbook to stdout.samples upload-multiplexed— wrapsclient.samples.upload_multiplexed_data, reportingdata_ids,annotation_id, and anywarnings. Warnings are reported but the upload proceeds by default (matching the library default);--reject-warningsopts into rejecting them (exit 5).docs/cli.md.Design notes (from review feedback)
_configure_*helper per verb, each taking a publicargparse.ArgumentParser, soregister()stays a concise verb registry and no argparse private type (_SubParsersAction) is referenced.--reject-warnings(off by default →ignore_warnings=True) is intentional: the spec default is "proceed despite warnings". A--ignore-warningsflag defaulting false would invert that documented default.Verification
234 passedacrosstests/unit(78 intests/unit/cli).flowbio samples --help.Out of scope
batch-template, US4upload-batch, polish) remain unimplemented.🤖 Generated with Claude Code