Refactor CLI for better DX and Documentation - #9
Conversation
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
5235679 to
5bf8cb1
Compare
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
5bf8cb1 to
6286b96
Compare
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.
6286b96 to
09c3808
Compare
This PR refactors the CLI to leverage
cycloptsfeatures more effectively, providing a better developer experience (DX). Key changes include:--verboseand--debugusingcycloptsmeta app, removing the need for mixedargparseusage.authinto a proper subcommand group withlogin,show,clearcommands, usingrichfor interactive prompts.Annotatedparameters for automatic help generation.PR created automatically by Jules for task 17353565500630855185 started by @dcode