Skip to content

docsy(v2): CLI parameter customization example#1206

Open
ppiegaze wants to merge 1 commit into
mainfrom
docsy/v2-cli-custom-params-example
Open

docsy(v2): CLI parameter customization example#1206
ppiegaze wants to merge 1 commit into
mainfrom
docsy/v2-cli-custom-params-example

Conversation

@ppiegaze

@ppiegaze ppiegaze commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a new how-to page user-guide/task-deployment/custom-cli.md ("Build a custom CLI") showing how to wrap a Flyte 2.0.x task in your own command-line interface — parse args with tyro / argparse / click / hydra, then flyte.init_from_config() + flyte.run().

Resolves DOC-1066 — "Example for customizing CLI with different parameters" (Ketan's ask to show how you can customize the CLI for different parameters using click/argparse/tyro/hydra).

Grounding (verify-live)

  • Grounded in flyte-sdk PR #175 — the shipped example examples/customize/custom_cli.py (tyro → flyte.init_from_config()flyte.run(main, config)). The tyro example is reproduced verbatim from that file.
  • Verified flyte.init_from_config() signature and the positional flyte.run(main, config) form against the live flyte-sdk main (src/flyte/_initialize.py).

Relationship to #1180 (coordinated, not overlapping)

PR #1180 (DOC-436/663, docsy/v2-cli-input-passing) documents the built-in flyte run CLI — typed input passing via --<input_name>, positional args, per-type syntax — by editing run-command-options.md and _index.md.

This PR is the distinct topic the DOC-1066 triage flagged: building your own CLI wrapper around flyte.run(). To avoid colliding with #1180's heavy edits, this PR:

Status

Held draft — DOC-1066's feature (flyte-sdk #175) has already shipped, so this is publish-ready on review; kept draft pending human disposition per docsy posture.

Linear: DOC-1066

New page user-guide/task-deployment/custom-cli.md showing how to wrap a
Flyte task in your own CLI (tyro/argparse/click/hydra) via
flyte.init_from_config() + flyte.run(). Grounded in flyte-sdk PR #175
(examples/customize/custom_cli.py). Distinct from the built-in flyte run
CLI covered by #1180.

DOC-1066

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Peeter Piegaze <1153481+ppiegaze@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

GHA build & deploy preview

Built by .github/workflows/build-pr.yml and deployed to the docs CF Pages project by .github/workflows/deploy-pr-preview.yml.

Branch alias https://pr-1206-docsy-v2-cli-custom.docs-dog.pages.dev
This commit https://626eedbb.docs-dog.pages.dev
Commit SHA 809cf2c0e0adabe2f0d07f194ae3ef40bd0cd9de

Updated automatically on every push.

@ppiegaze ppiegaze marked this pull request as ready for review July 13, 2026 14:22
Copilot AI review requested due to automatic review settings July 13, 2026 14:22
@ppiegaze ppiegaze requested a review from dansola July 13, 2026 14:22

Copilot AI 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.

Pull request overview

Adds a new task-deployment how-to page documenting how to build a bespoke command-line interface (CLI) around flyte.run() using common Python argument-parsing libraries, complementing the existing docs for the built-in flyte run CLI.

Changes:

  • Introduces a new “Build a custom CLI” page that explains the general wrapper pattern (parse args → flyte.init_from_config()flyte.run()).
  • Provides a concrete typed example using tyro plus a parallel argparse example, and links to related run docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +86 to +88
input. The `config` object is passed **positionally** to `main`, mapping to its
`config` parameter — the same positional form documented in
[Run command options](./run-command-options).
Comment on lines +71 to +73
flyte.init_from_config()
r = flyte.run(main, config)
print(r.url)
Comment on lines +114 to +116
flyte.init_from_config()
r = flyte.run(main, foo=args.foo, bar=args.bar)
print(r.url)
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