apache / apache/iggy

Python SDK: expose update_user options

Closed
#4,164 0 comments 0 reactions 0 assignees View on GitHub
good first issue python
Dominant language
Rust
Stars
4.9k
Forks
432
Avg merge
2d 10h
Merged PRs (30d)
173

Description

### Description

The Rust `update_user()` API accepts `UserUpdateOptions`, but the Python wrapper always passes `UserUpdateOptions::default()`:

```rust
async fn update_user(
&self,
user_id: &Identifier,
username: Option<&str>,
status: Option,
options: &UserUpdateOptions,
) -> Result<(), IggyError>;
```

The current server has no updatable user option keys, so every non-empty map is presently rejected. The raw options field nevertheless exists to allow future server-side keys without another wire or SDK signature change.

The Python stream and topic update APIs already expose equivalent raw option maps.

This covers B32 of the Python SDK parity work tracked in #3893.

### Affected area / component

Python SDK

### Proposed solution

- Add an optional keyword argument `options: dict[str, str] | None = None` to `IggyClient.update_user()`.
- Build `UserUpdateOptions { raw: options.unwrap_or_default() }`, following the existing `update_stream()` pattern.
- Preserve the current behavior when `options` is omitted or `None`.
- Regenerate `foreign/python/apache_iggy.pyi` and update the method documentation.
- Extend `foreign/python/tests/test_user.py` to verify:
- Existing username and status updates still work when `options` is omitted.
- An empty options map succeeds.
- An unknown non-empty option is forwarded and rejected by the current server.

Introducing typed user options is outside this issue.

### Alternatives considered

Keep the options hardcoded until the server defines its first user option. That would require another Python API change when such an option is introduced.

### Contribution

- [ ] I'm willing to submit a pull request to implement this feature

### Good first issue

- [x] I think this could be a good first issue for a new contributor

Contributor guide

Open the contributing guide

Research direction

Start with IggyClient.update_user() and compare its handling with the existing update_stream() pattern. Update foreign/python/apache_iggy.pyi and the method documentation, then extend foreign/python/tests/test_user.py to cover omitted options, an empty map, and rejection of an unknown non-empty option by the current server.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.