Skip to content

Refactor client for improved DX and robustness - #2

Closed
dcode wants to merge 3 commits into
mainfrom
library-architect-improvements-9426692692789396242
Closed

Refactor client for improved DX and robustness#2
dcode wants to merge 3 commits into
mainfrom
library-architect-improvements-9426692692789396242

Conversation

@dcode

@dcode dcode commented Feb 1, 2026

Copy link
Copy Markdown
Owner

This PR implements several "Library Architect" improvements to the prusa-connect library:

  1. Robustness:

    • Introduced a default request timeout of 10 seconds to prevent hangs.
    • Improved error handling by attempting to parse JSON error responses from the API, providing more context in PrusaApiError.
  2. Developer Experience (DX):

    • Added "Usage Example" sections to docstrings for all public methods in PrusaConnectClient.
    • Explicitly defined the public API using __all__ in src/prusa_connect/__init__.py.
    • Removed the untyped api_request method to encourage the use of the structured, typed methods.
  3. Testing:

    • Added tests/test_client_improvements.py to verify timeout behavior and error parsing using responses.

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

- 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>
@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.

google-labs-jules Bot and others added 2 commits February 1, 2026 07:17
- 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>
@dcode dcode closed this Feb 1, 2026
@dcode

dcode commented Feb 1, 2026

Copy link
Copy Markdown
Owner Author

This work is a duplicate of #1

@google-labs-jules

Copy link
Copy Markdown
Contributor

This work is a duplicate of #1

Acknowledged. I understand this work overlaps with PR #1. Please let me know if you would like me to continue with this branch or close it in favor of the other one.

@dcode
dcode deleted the library-architect-improvements-9426692692789396242 branch February 12, 2026 19:43
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