Skip to content

Added --output-dir option to CLI - #228

Merged
klemen1999 merged 3 commits into
mainfrom
feat/output_dir
Aug 7, 2026
Merged

Added --output-dir option to CLI#228
klemen1999 merged 3 commits into
mainfrom
feat/output_dir

Conversation

@klemen1999

@klemen1999 klemen1999 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Purpose

  • Added optional CLI flag --output-dir in case you don't want your output in the it in defualt shared_with_containe
  • Fixes --help command which wasn't working because we tried to display encodings default value (which was None)

Specification

None / not applicable

Dependencies & Potential Impact

None / not applicable

Deployment Plan

None / not applicable

Testing & Validation

None / not applicable

AI Usage

Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]

Submitted code was reviewed by a human: YES/NO

The author is taking the responsibility for the contribution: YES/NO

Summary by CodeRabbit

  • New Features

    • Added an optional --output-dir CLI option for storing generated conversion artifacts in a custom location.
    • Conversion outputs continue to use the default output location when no custom directory is provided.
    • Updated CLI help to document output directory behavior and RGB/BGR encoding choices.
  • Tests

    • Added coverage for CLI help and custom output directory handling, including generated archive verification.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e540b019-bd03-4d39-9f6a-d3483ecd4cfd

📥 Commits

Reviewing files that changed from the base of the PR and between 369fd7c and b4f2105.

📒 Files selected for processing (1)
  • tests/test_unittests.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/test_unittests.py

📝 Walkthrough

Walkthrough

The conversion CLI now accepts an optional --output-dir. The value flows through Config, the exporter registry, and all YOLO exporters. Generated artifacts use the custom directory or the existing default.

Changes

Configurable conversion output directory

Layer / File(s) Summary
CLI and configuration contract
tools/main.py, tools/utils/config.py, README.md
The CLI defines output_dir, stores it in Config, updates help text, and removes the displayed default for encoding.
Exporter output path handling
tools/modules/exporter.py, tools/yolo/*, tools/yolov6r1/*, tools/yolov6r3/*, tools/yolov7/*, tools/yolox/*
The base exporter selects the custom or default output root. YOLO exporter constructors forward output_dir to the base exporter.
Registry wiring and validation
tools/conversion_registry.py, tests/test_unittests.py
Exporter factories and create_exporter forward output_dir. Tests cover CLI help and artifact creation in a custom directory.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • luxonis/tools#223: Introduces the exporter registry and CLI flow extended by this change.
  • luxonis/tools#226: Adds YOLOX support extended here with output-directory propagation.
  • luxonis/tools#217: Modifies the YOLO26 conversion path and shared exporter classes.

Suggested reviewers: rolandocortez

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding the --output-dir option to the CLI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/output_dir

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/test_unittests.py (1)

43-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover both help-output changes.

The test checks only successful rendering and --version. Assert that --output-dir appears and that the --encoding help block does not show [default: None].

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_unittests.py` around lines 43 - 48, Update test_help to assert
that the CLI help output includes --output-dir and that the --encoding help
section does not contain “[default: None]”, while preserving the existing
successful-rendering and --version assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_unittests.py`:
- Around line 235-256: Update test_explicit_output_dir to make the
default-output assertion independent of prior tests sharing test_workspace:
snapshot the default directory state before _run_tools, then verify the state is
unchanged afterward while retaining validation of custom-output artifacts.
Alternatively, provide this test with a fresh workspace rather than relying on
shared state.

---

Nitpick comments:
In `@tests/test_unittests.py`:
- Around line 43-48: Update test_help to assert that the CLI help output
includes --output-dir and that the --encoding help section does not contain
“[default: None]”, while preserving the existing successful-rendering and
--version assertions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 281ba5df-b225-4409-a2cd-a49824b8d85e

📥 Commits

Reviewing files that changed from the base of the PR and between f3c1c2c and 369fd7c.

📒 Files selected for processing (16)
  • README.md
  • tests/test_unittests.py
  • tools/conversion_registry.py
  • tools/main.py
  • tools/modules/exporter.py
  • tools/utils/config.py
  • tools/yolo/yolo26_exporter.py
  • tools/yolo/yolov10_exporter.py
  • tools/yolo/yolov5_exporter.py
  • tools/yolo/yolov6_exporter.py
  • tools/yolo/yolov8_exporter.py
  • tools/yolov6r1/yolov6_r1_exporter.py
  • tools/yolov6r3/gold_yolo_exporter.py
  • tools/yolov6r3/yolov6_r3_exporter.py
  • tools/yolov7/yolov7_exporter.py
  • tools/yolox/yolox_exporter.py

Comment thread tests/test_unittests.py
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2031 1133 56% 0% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: b4f2105 by action🐍

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Test Results

  6 files    6 suites   14m 53s ⏱️
 34 tests  34 ✅ 0 💤 0 ❌
204 runs  204 ✅ 0 💤 0 ❌

Results for commit b4f2105.

♻️ This comment has been updated with latest results.

@rolandocortez rolandocortez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on Ubuntu with YOLOv8. --output-dir writes the ONNX and NNArchive to the custom path and leaves the default shared_with_container/outputs untouched. --help also works as expected. LGTM 👍

@klemen1999
klemen1999 merged commit 8839855 into main Aug 7, 2026
28 checks passed
@klemen1999
klemen1999 deleted the feat/output_dir branch August 7, 2026 12:27
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.

2 participants