Refactor client for improved DX and robustness - #2
Conversation
- Add `DEFAULT_TIMEOUT` to `PrusaConnectClient` and enforce it in requests. - Parse JSON error bodies in `PrusaApiError` for better error messages. - Remove loose `api_request` method to enforce typed API usage. - Export public API explicitly via `__all__` in `__init__.py`. - Add Usage Examples to all public method docstrings. - Add tests for timeouts and error parsing. Co-authored-by: dcode <171574+dcode@users.noreply.github.com>
|
👋 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. |
- Use `$HOME/.local/bin/uv` instead of `~/.cargo/bin/uv` as the installer script now uses the local bin. - Use Python 3.12 in `uv venv` to match the `actions/setup-python` version. Co-authored-by: dcode <171574+dcode@users.noreply.github.com>
- Sync `requires-python` in `uv.lock` to `>=3.12` to match `pyproject.toml` and CI environment. Co-authored-by: dcode <171574+dcode@users.noreply.github.com>
|
This work is a duplicate of #1 |
This PR implements several "Library Architect" improvements to the
prusa-connectlibrary:Robustness:
PrusaApiError.Developer Experience (DX):
PrusaConnectClient.__all__insrc/prusa_connect/__init__.py.api_requestmethod to encourage the use of the structured, typed methods.Testing:
tests/test_client_improvements.pyto verify timeout behavior and error parsing usingresponses.These changes aim to make the library safer, easier to use, and more "standard library quality".
PR created automatically by Jules for task 9426692692789396242 started by @dcode