ALWAYS refer to SPECIFICATION.md before implementing any features. This document contains the complete design specification for the Nutrient DWS Python Client library.
Building a Python client library for the Nutrient Document Web Services (DWS) API with two main interfaces:
- Direct API: Static methods on
NutrientClientfor single operations - Builder API: Fluent, chainable interface for multi-step workflows
- Main entry point:
NutrientClientclass - Builder pattern via
client.build()returnsBuildAPIWrapper - Only external dependency:
requestslibrary - Use
srclayout for package structure
- Direct API methods are snake_case versions of OpenAPI tool names
- All tool-specific parameters are keyword-only arguments
- File inputs accept: str (path), bytes, or file-like objects
- File outputs return bytes by default, or save to path if
output_pathprovided
Custom exceptions hierarchy:
NutrientError(base)AuthenticationError(401/403)APIError(other API errors with status_code and response_body)
- Run linting:
ruff check . - Run type checking:
mypy src/ - Run tests:
pytest - Format code:
ruff format .
Always run the quality checks above to ensure code meets standards.
- Refer to SPECIFICATION.md for requirements
- Implement features incrementally
- Write tests alongside implementation
- Update documentation/docstrings
- Run quality checks before marking tasks complete
- Use
ghcli tool