Skip to content

Commit c4f756f

Browse files
committed
Initial commit: Project structure and configuration
- Set up src layout Python package structure - Add pyproject.toml with modern packaging configuration - Configure development tools (ruff, mypy, pytest) - Add pre-commit hooks for code quality - Create base module structure with placeholders - Add MIT license and initial README
0 parents  commit c4f756f

File tree

20 files changed

+856
-0
lines changed

20 files changed

+856
-0
lines changed

.claude/project.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "nutrient-dws-client-python",
3+
"description": "Python client for Nutrient DWS",
4+
"workspace": "/Users/admin/Projects/nutrient-dws-client-python",
5+
"mcpServers": {
6+
"claude-code-mcp": {
7+
"enabled": true,
8+
"workspace": "/Users/admin/Projects/nutrient-dws-client-python"
9+
},
10+
"claude-code-github": {
11+
"enabled": true,
12+
"repository": "nutrient-dws-client-python"
13+
}
14+
}
15+
}

.gitignore

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.nox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
*.py,cover
48+
.hypothesis/
49+
.pytest_cache/
50+
cover/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
db.sqlite3
60+
db.sqlite3-journal
61+
62+
# Flask stuff:
63+
instance/
64+
.webassets-cache
65+
66+
# Scrapy stuff:
67+
.scrapy
68+
69+
# Sphinx documentation
70+
docs/_build/
71+
docs/_generated/
72+
73+
# PyBuilder
74+
.pybuilder/
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
Pipfile.lock
89+
90+
# poetry
91+
poetry.lock
92+
93+
# pdm
94+
.pdm.toml
95+
96+
# PEP 582
97+
__pypackages__/
98+
99+
# Celery stuff
100+
celerybeat-schedule
101+
celerybeat.pid
102+
103+
# SageMath parsed files
104+
*.sage.py
105+
106+
# Environments
107+
.env
108+
.venv
109+
env/
110+
venv/
111+
ENV/
112+
env.bak/
113+
venv.bak/
114+
115+
# Spyder project settings
116+
.spyderproject
117+
.spyproject
118+
119+
# Rope project settings
120+
.ropeproject
121+
122+
# mkdocs documentation
123+
/site
124+
125+
# mypy
126+
.mypy_cache/
127+
.dmypy.json
128+
dmypy.json
129+
130+
# Pyre type checker
131+
.pyre/
132+
133+
# pytype static type analyzer
134+
.pytype/
135+
136+
# Cython debug symbols
137+
cython_debug/
138+
139+
# IDEs
140+
.idea/
141+
.vscode/
142+
*.swp
143+
*.swo
144+
*~
145+
146+
# OS
147+
.DS_Store
148+
Thumbs.db
149+
150+
# Project specific
151+
openapi_spec.yml
152+
.ruff_cache/

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- id: check-json
10+
- id: check-toml
11+
- id: check-merge-conflict
12+
- id: debug-statements
13+
- id: mixed-line-ending
14+
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: v0.1.11
17+
hooks:
18+
- id: ruff
19+
args: [--fix]
20+
- id: ruff-format
21+
22+
- repo: https://github.com/pre-commit/mirrors-mypy
23+
rev: v1.8.0
24+
hooks:
25+
- id: mypy
26+
additional_dependencies: [types-requests]
27+
args: [--strict, --no-implicit-reexport]
28+
files: ^src/

CLAUDE.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Nutrient
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Nutrient DWS Python Client
2+
3+
A Python client library for the Nutrient Document Web Services (DWS) API.
4+
5+
## Installation
6+
7+
```bash
8+
pip install nutrient
9+
```
10+
11+
## Quick Start
12+
13+
```python
14+
from nutrient import NutrientClient
15+
16+
# Initialize the client
17+
client = NutrientClient(api_key="YOUR_API_KEY")
18+
19+
# Convert a document to PDF
20+
pdf_bytes = client.convert_to_pdf(input_file="document.docx")
21+
22+
# Use the Builder API for complex workflows
23+
client.build(input_file="document.docx") \
24+
.add_step(tool="convert-to-pdf") \
25+
.add_step(tool="rotate-pages", options={"degrees": 90}) \
26+
.execute(output_path="output.pdf")
27+
```
28+
29+
## Documentation
30+
31+
Full documentation is available at [https://nutrient-dws-client-python.readthedocs.io](https://nutrient-dws-client-python.readthedocs.io)
32+
33+
## License
34+
35+
MIT License - see LICENSE file for details.

0 commit comments

Comments
 (0)