You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "changhc (via GitHub)" <gi...@apache.org> on 2025/08/19 07:34:30 UTC
[PR] feat(example): basic example for python sdk [iggy]
changhc opened a new pull request, #2118:
URL: https://github.com/apache/iggy/pull/2118
### Description
Created a basic example for the python SDK that sort of matches `examples/rust/basic`. It demonstrates how to configure clients using connection strings. Overall it's pretty similar to the `getting-started` example.
This example is a bit different from `examples/rust/basic` because the rust client builder struct and config types are not exposed through the python SDK as explained in #2110.
### Testing
* Ran the examples locally
* `ruff check --select I .`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(example): basic example for python sdk [iggy]
Posted by "changhc (via GitHub)" <gi...@apache.org>.
changhc commented on PR #2118:
URL: https://github.com/apache/iggy/pull/2118#issuecomment-3202559699
I'm okay with that. The rust basic example actually allows users to run either a regular consumer or a consumer group. Because of all the shared functions in the rust examples, it's kind of difficult to completely align with those examples, and thus I think it's okay if we want to add options to the python examples (this basic example specifically) to allow users to chose which kind of consumer to use. For now demonstrating how to create a consumer group with the SDK should be sufficient. What would help more in my opinion is to explain these two types of consumers clearly in the documentation.
I'll add the consumer group as an option and we see how it goes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(example): basic example for python sdk [iggy]
Posted by "changhc (via GitHub)" <gi...@apache.org>.
changhc commented on PR #2118:
URL: https://github.com/apache/iggy/pull/2118#issuecomment-3218438906
I've decided to keep the current polling consumer for now. I tried out the consumer group and I don't think the python API is actually ready to be used. Apart from some obvious issues, usability is horrible and we definitely need to redesign this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(example): basic example for python sdk [iggy]
Posted by "spetz (via GitHub)" <gi...@apache.org>.
spetz merged PR #2118:
URL: https://github.com/apache/iggy/pull/2118
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(example): basic example for python sdk [iggy]
Posted by "changhc (via GitHub)" <gi...@apache.org>.
changhc commented on code in PR #2118:
URL: https://github.com/apache/iggy/pull/2118#discussion_r2289249364
##########
examples/python/basic/consumer.py:
##########
@@ -0,0 +1,102 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import argparse
+import asyncio
+from collections import namedtuple
+
+from apache_iggy import IggyClient, PollingStrategy, ReceiveMessage
+from loguru import logger
+
+STREAM_NAME = "sample-stream"
+TOPIC_NAME = "sample-topic"
+STREAM_ID = 1
+TOPIC_ID = 1
+PARTITION_ID = 1
+BATCHES_LIMIT = 5
+
+ArgNamespace = namedtuple("ArgNamespace", ["connection_string"])
+
+
Review Comment:
This is what `black` applies. It will be part of the formatting script.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(example): basic example for python sdk [iggy]
Posted by "cstruct (via GitHub)" <gi...@apache.org>.
cstruct commented on PR #2118:
URL: https://github.com/apache/iggy/pull/2118#issuecomment-3202220179
I'm wondering if for most use cases we should encourage the use of consumer groups? My gut feeling is that the consumer group API is the right fit for most use cases. It would not be aligned with the Rust examples though so maybe that is a broader discussion of what abstraction level is right to introduce most users to? What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(example): basic example for python sdk [iggy]
Posted by "changhc (via GitHub)" <gi...@apache.org>.
changhc commented on PR #2118:
URL: https://github.com/apache/iggy/pull/2118#issuecomment-3208038662
Yes. My plan is to reuse [foreign/python/scripts/test.sh](https://github.com/apache/iggy/blob/197af7bf1e1ed237d0b5ac265a5bb4d08ff6c310/foreign/python/scripts/test.sh) and I do have a local implementation. I'll set up the test properly after #2101 is merged to avoid conflicts.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(example): basic example for python sdk [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on code in PR #2118:
URL: https://github.com/apache/iggy/pull/2118#discussion_r2288791829
##########
examples/python/basic/consumer.py:
##########
@@ -0,0 +1,102 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import argparse
+import asyncio
+from collections import namedtuple
+
+from apache_iggy import IggyClient, PollingStrategy, ReceiveMessage
+from loguru import logger
+
+STREAM_NAME = "sample-stream"
+TOPIC_NAME = "sample-topic"
+STREAM_ID = 1
+TOPIC_ID = 1
+PARTITION_ID = 1
+BATCHES_LIMIT = 5
+
+ArgNamespace = namedtuple("ArgNamespace", ["connection_string"])
+
+
Review Comment:
any reason for 2 blank lines?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org