Skip to content

Conversation

@shaunpatterson
Copy link
Contributor

Implements a native async/await client using Python's asyncio and grpc.aio, providing true asynchronous operations with better concurrency than the existing futures-based approach.

Features:

  • AsyncDgraphClient, AsyncDgraphClientStub, and AsyncTxn classes
  • Native async/await syntax throughout
  • Automatic JWT refresh handling
  • Async context manager support for client and transactions
  • Connection string support via async_open() function
  • Full test suite with pytest-asyncio
  • Comprehensive documentation with examples

The sync client remains unchanged, ensuring backward compatibility. Both sync and async clients can be used in the same application.

Resolves #112

🤖 Generated with Claude Code

Description

Please explain the changes you made here.

Checklist

  • Code compiles correctly and linting passes locally
  • For all code changes, an entry added to the CHANGELOG.md file describing and linking to
    this PR
  • Tests added for new functionality, or regression tests for bug fixes added as applicable
  • For public APIs, new features, etc., PR on
    docs repo staged and linked here

Instructions

  • The PR title should follow the Conventional Commits
    syntax, leading with fix:, feat:, chore:, ci:, etc.
  • The description should briefly explain what the PR is about. In the case of a bugfix, describe or
    link to the bug.
  • In the checklist section, check the boxes in that are applicable, using [x] syntax.
    • If not applicable, remove the entire line. Only leave the box unchecked if you intend to come
      back and check the box later.
  • Delete the Instructions line and everything below it, to indicate you have read and are
    following these instructions. 🙂

Thank you for your contribution to Dgraph!

@matthewmcneely matthewmcneely requested a review from a team as a code owner December 18, 2025 17:15
shaunpatterson and others added 4 commits December 27, 2025 22:36
Implements a native async/await client using Python's asyncio and grpc.aio,
providing true asynchronous operations with better concurrency than the
existing futures-based approach.

Features:
- AsyncDgraphClient, AsyncDgraphClientStub, and AsyncTxn classes
- Native async/await syntax throughout
- Automatic JWT refresh handling
- Async context manager support for client and transactions
- Connection string support via async_open() function
- Full test suite with pytest-asyncio
- Comprehensive documentation with examples

The sync client remains unchanged, ensuring backward compatibility.
Both sync and async clients can be used in the same application.

Resolves dgraph-io#112

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Apply black and isort formatting to Python files. Add __all__ to
pydgraph/__init__.py to export async client classes properly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@mlwelles
Copy link
Contributor

Thanks for the contribution! I've created PR #285 with your changes plus some fixes for some minor issues the CI required in order to merge. Closing this PR and will be merging the changes from it in that one.

@mlwelles mlwelles closed this Dec 31, 2025
mlwelles added a commit that referenced this pull request Dec 31, 2025
Implements a native async/await client using Python's asyncio and grpc.aio,
providing true asynchronous operations with better concurrency than the
existing futures-based approach.

Features:
- AsyncDgraphClient, AsyncDgraphClientStub, and AsyncTxn classes
- Native async/await syntax throughout
- Automatic JWT refresh handling
- Async context manager support for client and transactions
- Connection string support via async_open() function
- Full test suite with pytest-asyncio
- Comprehensive documentation with examples

Additional fixes:
- Configure trunk to ignore bandit warnings in test files
- Move pytest configuration to pyproject.toml
- Fix test mocking for client_stub module
- All 126 tests passing

Resolves #112

Co-authored-by: Shaun Patterson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add asynchronous request execution possibility

3 participants