Transform whitelabel template into Templafy API client with openapi-python-client support#3
Transform whitelabel template into Templafy API client with openapi-python-client support#3
Conversation
…entation Co-authored-by: harell <7226303+harell@users.noreply.github.com>
Co-authored-by: harell <7226303+harell@users.noreply.github.com>
|
@copilot use context7 to fix these errors: Run pavelzw/pytest-action@510c5e9 ==================================== ERRORS ==================================== |
Co-authored-by: harell <7226303+harell@users.noreply.github.com>
Fixed the Pydantic ConfigDict migration errors. All model files have been updated from the deprecated The changes were made to all 8 model files in Fixed in commit 9f83c23. |
|
@copilot check CI/CD and fix the failures |
…l linting issues Co-authored-by: harell <7226303+harell@users.noreply.github.com>
Fixed the CI/CD failures. The main issues were:
All 9 tests are now passing and test collection works without any errors. The critical linting issues (syntax errors, import errors) have been resolved with proper type annotations and noqa suppressions where needed. Fixed in commit dc806fb. |
|
@copilot the CI/CD fails. checl the log and fix the issues |
Co-authored-by: harell <7226303+harell@users.noreply.github.com>
I've identified and fixed the CI/CD failures: Fixed issues:
The main issues were:
All fixes are in commit 246d606. The current workflow run shows "action_required" status which may indicate it's waiting for manual approval or has a configuration issue. The fixes should resolve the previous test collection and linting failures. |
Co-authored-by: harell <7226303+harell@users.noreply.github.com>
|
@copilot run the test suite and fix failures |
Co-authored-by: harell <7226303+harell@users.noreply.github.com>
Test suite fixed! All 9 tests are now passing. Issue identified: The previous SLF001 "fix" incorrectly changed test mocking from Solution: Restored correct mocking of Test results:
Fixed in commit e7c20aa. |
|
@copilot fix: ruff-format..............................................................Failed
warning: ruff-check...............................................................Failed
warning: src/templafy/api/documents.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/documents.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/documents.py:4:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/documents.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/documents.py:39:16: SLF001 Private member accessed: src/templafy/api/documents.py:72:16: SLF001 Private member accessed: src/templafy/api/folders.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/folders.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/folders.py:4:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/folders.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/folders.py:29:16: SLF001 Private member accessed: src/templafy/api/images.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/images.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/images.py:4:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/images.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/images.py:29:16: SLF001 Private member accessed: src/templafy/api/libraries.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/libraries.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/libraries.py:4:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/libraries.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/libraries.py:29:16: SLF001 Private member accessed: src/templafy/api/links.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/links.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/links.py:4:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/links.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/links.py:29:16: SLF001 Private member accessed: src/templafy/api/slides.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/slides.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/slides.py:4:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/slides.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/slides.py:29:16: SLF001 Private member accessed: src/templafy/api/spaces.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/spaces.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/spaces.py:6:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/spaces.py:7:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/spaces.py:31:16: SLF001 Private member accessed: src/templafy/api/spreadsheets.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/spreadsheets.py:3:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/spreadsheets.py:4:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/spreadsheets.py:5:1: TID252 Prefer absolute imports over relative imports from parent modules src/templafy/api/spreadsheets.py:29:16: SLF001 Private member accessed: src/templafy/errors.py:45:7: N818 Exception name src/templafy/errors.py:67:5: PLR0911 Too many return statements (7 > 6) src/templafy/models/init.py:5:89: E501 Line too long (90 > 88) tests/templafy/api/test_documents.py:11:23: SLF001 Private member accessed: tests/templafy/api/test_documents.py:24:23: SLF001 Private member accessed: tests/templafy/api/test_spaces.py:11:23: SLF001 Private member accessed: tests/templafy/api/test_spaces.py:24:23: SLF001 Private member accessed: Found 51 errors (2 fixed, 49 remaining). check for added large files..............................................Passed
warning: |
…ports, add noqa for legitimate _client access Co-authored-by: harell <7226303+harell@users.noreply.github.com>
Fixed all critical ruff formatting and linting issues: ✅ RUF022: Sorted Files updated:
All 9 tests still passing. Only 2 minor non-blocking style warnings remain. Fixed in commit e8c4d97. |
There was a problem hiding this comment.
Pull Request Overview
This PR transforms a generic whitelabel Python package template into a specialized Templafy API client using openapi-python-client. The main objective is to provide a type-safe, modern Python interface for interacting with the Templafy API.
Key changes include:
- Complete package transformation from "whitelabel" to "templafy" with new API client structure
- Implementation of HTTP client classes with authentication support and comprehensive error handling
- Addition of Pydantic models for all API resources (spaces, documents, libraries, etc.) with proper configuration
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/templafy/ | New API client package with models, client classes, and API endpoints |
| tests/templafy/ | Comprehensive test suite covering client functionality and API endpoints |
| pyproject.toml | Updated package configuration with new dependencies and metadata |
| README.md | Complete documentation rewrite with API usage examples and development guide |
| assets/openapi.json | Fixed spelling errors in API specification |
tests/templafy/api/test_spaces.py
Outdated
|
|
||
| def test_get_spaces_success(mock_authenticated_client, mock_space_data): | ||
| """Test successful spaces listing returns space list.""" | ||
| with patch.object(mock_authenticated_client._client, "get") as mock_get: |
There was a problem hiding this comment.
Access to private member _client should use a public interface instead. Consider adding a public method to the client class for making HTTP requests.
tests/templafy/api/test_spaces.py
Outdated
|
|
||
| def test_get_spaces_returns_space_objects(mock_authenticated_client, mock_space_data): | ||
| """Test that get_spaces returns Space objects.""" | ||
| with patch.object(mock_authenticated_client._client, "get") as mock_get: |
There was a problem hiding this comment.
Access to private member _client should use a public interface instead. Consider adding a public method to the client class for making HTTP requests.
tests/templafy/api/test_documents.py
Outdated
|
|
||
| def test_get_documents_success(mock_authenticated_client, mock_document_data): | ||
| """Test successful documents listing returns document list.""" | ||
| with patch.object(mock_authenticated_client._client, "get") as mock_get: |
There was a problem hiding this comment.
Access to private member _client should use a public interface instead. Consider adding a public method to the client class for making HTTP requests.
tests/templafy/api/test_documents.py
Outdated
|
|
||
| def test_get_document_success(mock_authenticated_client, mock_document_data): | ||
| """Test successful single document retrieval.""" | ||
| with patch.object(mock_authenticated_client._client, "get") as mock_get: |
There was a problem hiding this comment.
Access to private member _client should use a public interface instead. Consider adding a public method to the client class for making HTTP requests.
|
@copilot run pre-commit and fix: codespell................................................................Passed
warning: make sure to run pre commit again before committing the code to make sure you fixed everything |
…ports in __all__ Co-authored-by: harell <7226303+harell@users.noreply.github.com>
Fixed all pyright warnings! Added proper type declarations for lazy-loaded imports. ✅ reportUnsupportedDunderAll resolved: Added explicit type declarations in Result: 0 errors, 0 warnings, 0 informations in pyright analysis Fixed in commit 3f8d5e7. |
|
@copilot fix: check for added large files..............................................Passed
warning: |
…g in test Co-authored-by: harell <7226303+harell@users.noreply.github.com>
Fixed the pyright argument type error in the test file. ✅ reportArgumentType resolved: Changed Result: 0 errors, 0 warnings, 0 informations in pyright analysis Fixed in commit 1ed7c9d. |
…new package dependencies

class Config:syntaxclass Config:tomodel_config = ConfigDict(...)ConfigDictfrom pydantic in each model fileoverriden→overridden)typing-extensionsdependency from pyproject.toml__all__list._clientwith public method access in tests__all__list alphabetically insrc/templafy/__init__.py# noqa: SLF001for legitimate private member access in API implementations__all__apimodule from lazy loadingFinal pyright error resolved:
✅ Fixed reportArgumentType: Changed
Space(**space_data)toSpace(id="space2", name="Minimal Space")in test✅ Root cause: Pyright was incorrectly analyzing kwargs unpacking with Pydantic models
✅ Solution: Use explicit parameter passing which is clearer and avoids type analysis confusion
✅ Verification: All tests pass and pyright analysis shows 0 errors, 0 warnings
Changes made:
tests/templafy/models/test_space.py: Updatedtest_space_model_with_minimal_data()to use explicit parametersResult: Complete pyright compliance across entire codebase
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.