docs(python-sdk): add comprehensive async/sync architecture documenta…#565
Conversation
…tion - Add AsyncOAuth client for native async applications - Add SmartOAuth client for context-aware async/sync usage - Add standalone usage patterns for serverless/Lambda functions - Update all code examples with proper sync/async patterns - Add framework-specific implementation guides (Flask, FastAPI) - Restructure authentication flow documentation - Add migration recommendations and client selection guide - Update permissions, claims, and feature flags examples - Add Management API sync/async usage patterns - Improve error handling and best practices sections BREAKING: No breaking changes - maintains backward compatibility
| ## Configure your app | ||
|
|
||
| The OAuth client is now automatically configured based on the framework you're using. Simply import the OAuth class from the auth module and create an instance: | ||
| The Kinde Python SDK provides three different OAuth client types to support various application patterns: |
There was a problem hiding this comment.
Says three but 5 are listed. Could we replace 'three' with 'several'
There was a problem hiding this comment.
There three different libraries, 4 and 5 are examples of how to implement the 3 libraries.
There was a problem hiding this comment.
I am with @clairekinde11 here, it's not clear the distinction here.
4 and 5 should be updated to be examples, isn't the framework optional also?
| @@ -159,7 +212,7 @@ The Kinde client provides methods for easy sign in and sign up. You can add butt | |||
|
|
|||
| ### Automatic Route Registration | |||
There was a problem hiding this comment.
Can we make this a H2, so that the H4s that follow can be made into H3s. Please try to avoid H4
|
|
||
| Here's how to use permissions in your application: | ||
|
|
||
| #### Flask (Synchronous) |
There was a problem hiding this comment.
Change this heading to ### Example: Flask (Synchronous), and follow for following H4s.
Remove lines 483 and 485
|
|
||
| Here's how to use feature flags in your application: | ||
|
|
||
| #### Flask (Synchronous) |
There was a problem hiding this comment.
Can we do same as previous section - H3 ### Example: Flask (Synchronous)
etc.
|
|
||
| Here's how to use claims in your application: | ||
|
|
||
| #### Flask (Synchronous) |
There was a problem hiding this comment.
See previous, H3 ### Example: Flask (Synchronous)
Delete 771, 773
| To use the Management API, you'll need to initialize the client with your Kinde credentials: | ||
| To use the Management API, you can initialize the client directly or through your OAuth client: | ||
|
|
||
| #### Direct initialization |
There was a problem hiding this comment.
Make these H3s - the small H3 intros and pushing the heading levels too far
clairekinde11
left a comment
There was a problem hiding this comment.
Some comments about heading levels - would like to avoid H4s they are not as searchable, easy to scan, and do not show up in the context page menu.
…cture - Promote main section headings from ### to ## - Standardize subsection headings from #### to ### - Improve document hierarchy and navigation consistency - Enhance readability and accessibility of documentation structure
clairekinde11
left a comment
There was a problem hiding this comment.
Okay from copy and structure perspective - awaiting tech review
| ## Configure your app | ||
|
|
||
| The OAuth client is now automatically configured based on the framework you're using. Simply import the OAuth class from the auth module and create an instance: | ||
| The Kinde Python SDK provides three different OAuth client types to support various application patterns: |
There was a problem hiding this comment.
I am with @clairekinde11 here, it's not clear the distinction here.
4 and 5 should be updated to be examples, isn't the framework optional also?
| ## Important Notes | ||
|
|
||
| ### Async/Sync Consistency | ||
| The SDK now provides consistent async and sync APIs to address previous inconsistencies: | ||
| - **Auth modules** (permissions, claims, feature_flags) are async and work with all client types | ||
| - **OAuth methods** are now properly separated into sync and async versions | ||
| - **SmartOAuth** provides a unified interface that adapts to the execution context | ||
|
|
||
| ### Backward Compatibility | ||
| All existing code continues to work without changes: | ||
| - The original `OAuth` class remains unchanged | ||
| - Existing sync methods remain sync | ||
| - Existing async methods remain async | ||
| - No breaking changes to the public API | ||
|
|
||
| ### Migration Recommendations | ||
| - **New Flask projects**: Use `OAuth` for simplicity | ||
| - **New FastAPI projects**: Use `AsyncOAuth` for best performance | ||
| - **Mixed projects**: Use `SmartOAuth` for flexibility | ||
| - **Serverless/Lambda**: Use `AsyncOAuth` with `framework=None` | ||
| - **Existing projects**: No changes required, but consider migrating for better consistency | ||
|
|
There was a problem hiding this comment.
This looks like summary of changes should it be removed?
Description (required)
Related issues & labels (optional)