|
| 1 | +# Claude Development Guide for Nutrient DWS Python Client |
| 2 | + |
| 3 | +## Critical Reference |
| 4 | +**ALWAYS** refer to `SPECIFICATION.md` before implementing any features. This document contains the complete design specification for the Nutrient DWS Python Client library. |
| 5 | + |
| 6 | +## Project Overview |
| 7 | +Building a Python client library for the Nutrient Document Web Services (DWS) API with two main interfaces: |
| 8 | +1. **Direct API**: Static methods on `NutrientClient` for single operations |
| 9 | +2. **Builder API**: Fluent, chainable interface for multi-step workflows |
| 10 | + |
| 11 | +## Key Implementation Guidelines |
| 12 | + |
| 13 | +### Architecture |
| 14 | +- Main entry point: `NutrientClient` class |
| 15 | +- Builder pattern via `client.build()` returns `BuildAPIWrapper` |
| 16 | +- Only external dependency: `requests` library |
| 17 | +- Use `src` layout for package structure |
| 18 | + |
| 19 | +### API Design Principles |
| 20 | +- Direct API methods are snake_case versions of OpenAPI tool names |
| 21 | +- All tool-specific parameters are keyword-only arguments |
| 22 | +- File inputs accept: str (path), bytes, or file-like objects |
| 23 | +- File outputs return bytes by default, or save to path if `output_path` provided |
| 24 | + |
| 25 | +### Error Handling |
| 26 | +Custom exceptions hierarchy: |
| 27 | +- `NutrientError` (base) |
| 28 | +- `AuthenticationError` (401/403) |
| 29 | +- `APIError` (other API errors with status_code and response_body) |
| 30 | + |
| 31 | +### Testing & Quality |
| 32 | +- Run linting: `ruff check .` |
| 33 | +- Run type checking: `mypy src/` |
| 34 | +- Run tests: `pytest` |
| 35 | +- Format code: `ruff format .` |
| 36 | + |
| 37 | +### Before Committing |
| 38 | +Always run the quality checks above to ensure code meets standards. |
| 39 | + |
| 40 | +## Development Workflow |
| 41 | +1. Refer to SPECIFICATION.md for requirements |
| 42 | +2. Implement features incrementally |
| 43 | +3. Write tests alongside implementation |
| 44 | +4. Update documentation/docstrings |
| 45 | +5. Run quality checks before marking tasks complete |
0 commit comments