Skip to content

Conversation

@LifeJiggy
Copy link


PR Title: Expose AsyncClient at package level for easier access

Description:

This PR makes the asynchronous DigitalOcean client more accessible by exposing AsyncClient at the main package level, improving the developer experience for users who want to use async operations.

Problem:

Previously, users had to import the async client using a longer import path:

from pydo.aio import Client  # Less intuitive

Solution:

Now users can import the async client directly from the main package:

from pydo import AsyncClient  # More intuitive and consistent

Changes Made:

1. Updated src/pydo/aio/__init__.py:

  • Added AsyncClient = Client alias for the async client class
  • Added "AsyncClient" to the __all__ list for proper exposure

2. Updated src/pydo/_patch.py:

  • Imported AsyncClient from the aio module
  • Added "AsyncClient" to the __all__ list to expose it at package level

Usage Examples:

Before (still works):

from pydo.aio import Client

async def main():
    client = Client(token="your-token")
    # ... async operations

After (new and improved):

from pydo import AsyncClient

async def main():
    client = AsyncClient(token="your-token")
    # ... async operations

Backward Compatibility:

  • ✅ All existing imports continue to work
  • ✅ No breaking changes
  • ✅ The pydo.aio.Client import still functions

Testing:

  • Import test passed: from pydo import AsyncClient works correctly
  • Existing functionality remains unaffected

Files Changed:

  • src/pydo/aio/__init__.py - Added AsyncClient alias and exposure
  • src/pydo/_patch.py - Imported and exposed AsyncClient at package level

Impact:

  • Improved DX: More intuitive import path for async operations
  • Consistency: Matches the pattern of from pydo import Client for sync operations
  • Zero Risk: Purely additive change with no breaking changes

This makes async usage much more discoverable and user-friendly! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant