Skip to content

Add context manager support to clients#5693

Merged
xShinnRyuu merged 5 commits into
valkey-io:mainfrom
Redoubts:redoubts/aclose
Apr 20, 2026
Merged

Add context manager support to clients#5693
xShinnRyuu merged 5 commits into
valkey-io:mainfrom
Redoubts:redoubts/aclose

Conversation

@Redoubts
Copy link
Copy Markdown
Contributor

@Redoubts Redoubts commented Apr 2, 2026

Summary

valkey-glide should allow for pythonic resource management, by supporting context managers. This adds that.

Issue link

Closes #5623

Features / Behaviour Changes

Adds enter/exit methods for sync + async clients

Limitations

Leaves the async close method, tho aclose is preferred for async resources. But this allows the change to be non-breaking

Testing

python dev.py test --args -k test_context_manager

Redoubts added 2 commits April 2, 2026 17:08
Signed-off-by: redoubts <Redoubts@users.noreply.github.com>
Signed-off-by: redoubts <Redoubts@users.noreply.github.com>
@Redoubts Redoubts requested a review from a team as a code owner April 2, 2026 21:48
@xShinnRyuu xShinnRyuu self-requested a review April 3, 2026 00:07
@xShinnRyuu xShinnRyuu requested a review from Aryex April 10, 2026 17:22
Signed-off-by: redoubts <Redoubts@users.noreply.github.com>
Comment thread python/glide-async/python/glide/glide_client.py Outdated
Comment thread python/glide-async/python/glide/glide_client.py
Signed-off-by: redoubts <Redoubts@users.noreply.github.com>
@xShinnRyuu xShinnRyuu merged commit 7252af4 into valkey-io:main Apr 20, 2026
25 checks passed
@Redoubts Redoubts deleted the redoubts/aclose branch April 21, 2026 00:03
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.

(python): Clients should be context managers + async client should have aclose

3 participants