Skip to content

Refactor CLI for better DX and Documentation - #9

Merged
dcode merged 2 commits into
mainfrom
refactor-cli-cyclopts-17353565500630855185
Feb 23, 2026
Merged

Refactor CLI for better DX and Documentation#9
dcode merged 2 commits into
mainfrom
refactor-cli-cyclopts-17353565500630855185

Conversation

@dcode

@dcode dcode commented Feb 12, 2026

Copy link
Copy Markdown
Owner

This PR refactors the CLI to leverage cyclopts features more effectively, providing a better developer experience (DX). Key changes include:

  • Global Flags: Implemented --verbose and --debug using cyclopts meta app, removing the need for mixed argparse usage.
  • Auth Command: Refactored auth into a proper subcommand group with login, show, clear commands, using rich for interactive prompts.
  • Documentation: Split documentation into distinct sections for CLI Users and SDK Developers, adding clear installation and authentication guides.
  • Code Quality: Ensured all commands use strictly typed Annotated parameters for automatic help generation.

PR created automatically by Jules for task 17353565500630855185 started by @dcode

@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@dcode
dcode force-pushed the refactor-cli-cyclopts-17353565500630855185 branch from 5235679 to 5bf8cb1 Compare February 22, 2026 21:24
This PR refactors the Python Prusa Connect SDK client with several major improvements:

- Migrate CLI from argparse to Cyclopts for improved argument parsing and DX
- Use `app.meta` for global flags (token, host, verbose, output format)
- Refactor `auth` command group with `login`, `show`, `clear` subcommands using `rich.prompt`
- Use `Annotated` + `cyclopts.Parameter` throughout for rich help strings
- Add config file support via `cli/config.py`

- Split monolithic `models.py` into a `models/` package
- Separate modules: `cameras`, `common`, `config`, `files`, `jobs`, `printers`, `stats`, `teams`

- Add `services/` package with per-resource service classes
- Services encapsulate SDK calls: `cameras`, `files`, `jobs`, `printers`, `stats`, `teams`

- Add `stats` CLI command group with subcommands for printer/team stats

- Restructure docs into `docs/cli/` and `docs/sdk/` subdirectories
- Add `docs/installation.md` and `docs/authentication.md`
- Add CLI quickstart and SDK quickstart guides
- Update `mkdocs.yml` navigation

- Add comprehensive test coverage for all CLI commands and services
- Add `test_sdk_coverage.py` and `test_config.py`
- Fix CI lint errors and apply ruff formatting
- Disable mkdocs image optimization plugin to fix CI (missing `pngquant`)
- Remove `.python-version` pin; update pre-commit config
@dcode
dcode force-pushed the refactor-cli-cyclopts-17353565500630855185 branch from 5bf8cb1 to 6286b96 Compare February 22, 2026 23:54
The prerelease versions (v1.0.0a0, v1.0.0a2) introduced DeprecationWarning
wrappers on PrusaConnectClient as a transitional courtesy during the
refactor to a service-based API. Per semver, prereleases carry no
stability guarantee, so these shims are removed before the first stable
release rather than carrying dead weight.

Removed from sdk.py:
- get_printers()  → client.printers.list_printers()
- get_printer()   → client.printers.get()
- get_cameras()   → client.cameras.list()
- get_teams()     → client.teams.list_teams()
- get_team()      → client.teams.get()
- send_command()  → client.printers.send_command()

CLI commands and all tests updated to call the service layer directly.
Service attributes annotated at class level for correct type inference.
@dcode
dcode force-pushed the refactor-cli-cyclopts-17353565500630855185 branch from 6286b96 to 09c3808 Compare February 23, 2026 00:03

@dcode dcode left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

LGTM :shipit:

@dcode
dcode merged commit 5447cf8 into main Feb 23, 2026
26 checks passed
@dcode
dcode deleted the refactor-cli-cyclopts-17353565500630855185 branch February 23, 2026 00:07
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.

1 participant