Skip to content

feat(python): add user management methods to IggyClient#3695

Merged
spetz merged 13 commits into
apache:masterfrom
ethanlin01x:feat/python-sdk-user-management
Jul 20, 2026
Merged

feat(python): add user management methods to IggyClient#3695
spetz merged 13 commits into
apache:masterfrom
ethanlin01x:feat/python-sdk-user-management

Conversation

@ethanlin01x

@ethanlin01x ethanlin01x commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #3682

Rationale

Adds the missing user management operations to the Python SDK, which previously had no binding beyond login_user and forced callers to the CLI or another SDK to provision users.

What changed?

The Python SDK exposed no part of the Rust UserClient surface besides login_user, so users could not be listed, inspected, created, updated, or deleted from Python.

get_user, get_users, create_user, update_user, and delete_user now bind through to the Rust UserClient, and UserInfo, UserInfoDetails, and UserStatus are exposed as Python classes. As scoped in the issue, create_user always passes None for permissions; the Permissions mapping is left to a follow-up together with update_permissions, change_password, and logout_user.

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

Claude was used to help generate and review this PR and all the changes are checked by the human.

@ethanlin01x
ethanlin01x force-pushed the feat/python-sdk-user-management branch from 321886e to 6fec2bc Compare July 17, 2026 15:44
The Python bindings need these types to expose user management, but
only UserStatus was re-exported so far.
These types are needed by the upcoming user management methods on
IggyClient. Permissions stay unexposed for now, so UserInfoDetails
carries the same fields as UserInfo until the follow-up that maps
the Permissions structure.
Expose get_user, get_users, create_user, update_user and delete_user,
wrapping the Rust SDK UserClient functions like the existing topic and
consumer group bindings. create_user always passes no permissions; the
Permissions type mapping is left to a follow-up together with
update_permissions, change_password and logout_user.
Cover create, get, list, update and delete against a live server,
including default status, inactive users, login with created
credentials, numeric and name identifiers, repeated listing stability,
and pre-connection and pre-authentication failures.
@ethanlin01x
ethanlin01x force-pushed the feat/python-sdk-user-management branch from 6fec2bc to 7e57428 Compare July 17, 2026 15:51
@ethanlin01x
ethanlin01x marked this pull request as ready for review July 17, 2026 15:53
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Jul 17, 2026
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.03540% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.33%. Comparing base (1789610) to head (9e52848).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
foreign/python/src/user.rs 79.06% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3695      +/-   ##
============================================
- Coverage     74.29%   65.33%   -8.97%     
  Complexity      937      937              
============================================
  Files          1302     1302              
  Lines        148487   132979   -15508     
  Branches     124042   108494   -15548     
============================================
- Hits         110323    86883   -23440     
- Misses        34696    42579    +7883     
- Partials       3468     3517      +49     
Components Coverage Δ
Rust Core 63.57% <ø> (-11.00%) ⬇️
Java SDK 62.44% <ø> (ø)
C# SDK 71.04% <ø> (-1.16%) ⬇️
Python SDK 92.15% <92.03%> (-0.02%) ⬇️
PHP SDK 84.29% <ø> (ø)
Node SDK 92.37% <ø> (-0.13%) ⬇️
Go SDK 42.87% <ø> (ø)
Files with missing lines Coverage Δ
foreign/python/src/client.rs 99.11% <100.00%> (+0.11%) ⬆️
foreign/python/src/lib.rs 100.00% <100.00%> (ø)
foreign/python/src/user.rs 79.06% <79.06%> (ø)

... and 278 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.

@ethanlin01x

Copy link
Copy Markdown
Contributor Author

The 3 lines Codecov flags as uncovered in foreign/python/src/user.rs are the #[pyclass(...)] and #[pymethods] attribute lines. They are not missing tests. All hand-written logic in the file is fully exercised by tests/test_user.py.

Should these attribute lines be brought to 100% as well, or is it fine to leave them as is?

@slbotbm

slbotbm commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

The 3 lines Codecov flags as uncovered in foreign/python/src/user.rs are the #[pyclass(...)] and #[pymethods] attribute lines. They are not missing tests. All hand-written logic in the file is fully exercised by tests/test_user.py.
Should these attribute lines be brought to 100% as well, or is it fine to leave them as is?

Fine as it is

Comment thread foreign/python/tests/test_user.py Outdated
Comment thread foreign/python/tests/test_user.py
Comment thread foreign/python/tests/test_user.py Outdated
Comment thread foreign/python/tests/test_user.py Outdated
Comment thread foreign/python/tests/test_user.py Outdated
Comment thread foreign/python/tests/test_user.py Outdated
@slbotbm

slbotbm commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Also, please do commit the new changes as new commits. This will help me in understanding what changed after my review.

@slbotbm

slbotbm commented Jul 19, 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 19, 2026
Server error messages are not a stable contract and created_at is
server generated, so assert neither.
Replace the hardcoded nonexistent id with a freshly vacated one, drop
the repeated get_users snapshot comparison that other clients can
invalidate, and assert the strictly ascending id order instead.
The server validates username and password length in bytes (3-50 and
3-100 respectively), not characters. Exercise both bounds for
create_user and update_user, including multibyte credentials that fit
the byte limits and ones that exceed them while staying within the
character count.
Inactive and deleted users cannot log in, invalid identifiers fail
client-side without a server round trip, an update with no fields is
accepted as a noop, and deletion covers root protection, double
deletion, removal from listings, live session behavior, and username
reuse with fresh credentials.
@ethanlin01x

Copy link
Copy Markdown
Contributor Author

/ready

@ethanlin01x
ethanlin01x requested a review from slbotbm July 19, 2026 10:53
@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 19, 2026
Comment thread foreign/python/tests/test_user.py Outdated
Comment thread foreign/python/tests/test_user.py Outdated
Comment thread foreign/python/tests/test_user.py
@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 20, 2026
@ethanlin01x
ethanlin01x force-pushed the feat/python-sdk-user-management branch from cabfe1e to 198274a Compare July 20, 2026 17:19
Without permission management in the Python SDK, this test passes even
if the deleted session stays authenticated, so it cannot prove its
claim. Reduce it to a no-op with a TODO to restore later.
@ethanlin01x
ethanlin01x force-pushed the feat/python-sdk-user-management branch from 881270f to a9bb97b Compare July 20, 2026 17:28
@ethanlin01x
ethanlin01x requested a review from slbotbm July 20, 2026 17:33
@ethanlin01x

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 20, 2026
@spetz
spetz merged commit 4a6f173 into apache:master Jul 20, 2026
90 checks passed
@github-actions github-actions Bot removed the S-waiting-on-review PR is waiting on a reviewer label Jul 20, 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 user management

3 participants