Skip to content

feat(python): add topic listing, update, delete and purge#3572

Merged
mmodzelewski merged 11 commits into
apache:masterfrom
mattp5657:feat/python-sdk-topic-mgmt
Jul 3, 2026
Merged

feat(python): add topic listing, update, delete and purge#3572
mmodzelewski merged 11 commits into
apache:masterfrom
mattp5657:feat/python-sdk-topic-mgmt

Conversation

@mattp5657

@mattp5657 mattp5657 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #3521

Rationale

Completes the Python SDK's topic management by adding the missing list, update, delete, and purge operations, which previously had no Python binding and forced callers to another SDK.

What changed?

The Python SDK exposed only create_topic and get_topic, so listing, updating, deleting, or purging topics required falling back to another SDK. TopicDetails also hid compression_algorithm and replication_factor, leaving the result of an update impossible to assert from Python.

get_topics, update_topic, delete_topic, and purge_topic now bind through to the Rust TopicClient, a new Topic type backs the list view, and TopicDetails exposes the two previously hidden fields. The new methods take stream_id to stay consistent with the Rust trait and the existing get_topic.

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

Claude was used to help generate and review this PR.

@mattp5657 mattp5657 force-pushed the feat/python-sdk-topic-mgmt branch from 2db95ac to 02a1008 Compare June 26, 2026 22:58
@mattp5657 mattp5657 force-pushed the feat/python-sdk-topic-mgmt branch from 02a1008 to ce94a0d Compare June 26, 2026 23:29
@mattp5657 mattp5657 marked this pull request as ready for review June 27, 2026 00:17
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Jun 27, 2026

@slbotbm slbotbm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good at a first glance.

As an aside, please do not force push new code. Instead, address the review in well-formed commits. This helps me understand what changed since my last review.

You can write /ready on a new line in a comment to indicate that your PR is ready for review.

Comment thread foreign/python/src/client.rs Outdated
Comment thread foreign/python/src/client.rs Outdated
Comment thread foreign/python/src/client.rs Outdated
Comment thread foreign/python/src/client.rs Outdated
Comment thread foreign/python/src/topic.rs Outdated
Comment thread foreign/python/src/topic.rs
Comment thread foreign/python/src/topic.rs
Comment thread foreign/python/tests/test_topic.py
@slbotbm

slbotbm commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

/author

@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Jun 27, 2026
@mattp5657

Copy link
Copy Markdown
Contributor Author

Appreciate the comments and have addressed most of them. The remaining Topic/TopicDetails getters are tracked in #3577 as a follow-up I'll take on after this merges.

@mattp5657

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Jun 28, 2026

@slbotbm slbotbm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than a few comments, the PR looks good

Comment thread foreign/python/tests/test_topic.py
Comment thread foreign/python/tests/test_topic.py
Comment thread foreign/python/src/lib.rs
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.13043% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.29%. Comparing base (546b212) to head (7f0a8fb).

Files with missing lines Patch % Lines
foreign/python/src/topic.rs 95.45% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3572      +/-   ##
============================================
+ Coverage     74.16%   74.29%   +0.13%     
  Complexity      937      937              
============================================
  Files          1261     1249      -12     
  Lines        131930   127753    -4177     
  Branches     107800   103506    -4294     
============================================
- Hits          97849    94918    -2931     
+ Misses        30982    29802    -1180     
+ Partials       3099     3033      -66     
Components Coverage Δ
Rust Core 74.97% <ø> (+0.15%) ⬆️
Java SDK 62.44% <ø> (ø)
C# SDK 72.06% <ø> (-0.05%) ⬇️
Python SDK 90.87% <99.13%> (+1.98%) ⬆️
PHP SDK 84.29% <ø> (ø)
Node SDK 91.35% <ø> (+0.12%) ⬆️
Go SDK 40.14% <ø> (ø)
Files with missing lines Coverage Δ
foreign/python/src/client.rs 98.19% <100.00%> (+0.56%) ⬆️
foreign/python/src/lib.rs 100.00% <100.00%> (ø)
foreign/python/src/topic.rs 95.00% <95.45%> (+17.22%) ⬆️

... and 70 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@slbotbm

slbotbm commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

/author

@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Jul 1, 2026
@mattp5657

Copy link
Copy Markdown
Contributor Author

Addressed all comments. Considered adding a Rust-side test for the deterministic ordering of get_topics, but there's no existing test coverage for it to extend. Would mean a new, isolated test module rather than folding into something existing, so I left it out for now. Let me know if you have any other feedback.

@mattp5657

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-author PR is waiting on author response labels Jul 2, 2026
@slbotbm

slbotbm commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

lgtm

@mmodzelewski mmodzelewski merged commit 9ddae16 into apache:master Jul 3, 2026
50 checks passed
@github-actions github-actions Bot removed the S-waiting-on-review PR is waiting on a reviewer label Jul 3, 2026
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 sdk] Add functions related to topic management

4 participants