This is an automated email from the ASF dual-hosted git repository.

maciej pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new 111ccefed fix(python): update python version to 3.10, clean up 
examples (#2532)
111ccefed is described below

commit 111ccefed6c8dec9846dab602ecf6c70a3254643
Author: Rimuksh Kansal <[email protected]>
AuthorDate: Mon Jan 5 19:11:04 2026 +0900

    fix(python): update python version to 3.10, clean up examples (#2532)
---
 .../actions/python-maturin/pre-merge/action.yml    |   7 +-
 foreign/python/Dockerfile.test                     |   3 +-
 foreign/python/README.md                           |  18 +---
 foreign/python/pyproject.toml                      |   8 +-
 foreign/python/python_examples/README.md           |  20 ----
 foreign/python/python_examples/consumer.py         |  83 ----------------
 .../python/python_examples/example_screenshot.png  | Bin 2373561 -> 0 bytes
 foreign/python/python_examples/producer.py         | 110 ---------------------
 foreign/python/scripts/test.sh                     |  17 ----
 9 files changed, 6 insertions(+), 260 deletions(-)

diff --git a/.github/actions/python-maturin/pre-merge/action.yml 
b/.github/actions/python-maturin/pre-merge/action.yml
index 878845cc0..7b5c0d611 100644
--- a/.github/actions/python-maturin/pre-merge/action.yml
+++ b/.github/actions/python-maturin/pre-merge/action.yml
@@ -51,7 +51,7 @@ runs:
 
         # Install testing dependencies from pyproject.toml
         cd foreign/python
-        pip install -e ".[testing,examples,dev]"
+        pip install -e ".[testing,dev]"
         cd ../..
 
         # Install additional CI dependencies for Docker testing if needed
@@ -97,11 +97,6 @@ runs:
           # Install the built wheel for testing
           echo "Installing built wheel..."
           pip install dist/*.whl --force-reinstall
-
-          # Create symlink for examples directory if needed
-          if [ -d "python_examples" ] && [ ! -e "examples" ]; then
-            ln -s python_examples examples
-          fi
         fi
 
         if [ "${{ inputs.task }}" = "build" ]; then
diff --git a/foreign/python/Dockerfile.test b/foreign/python/Dockerfile.test
index 9983f7ec9..2aa5d3eea 100644
--- a/foreign/python/Dockerfile.test
+++ b/foreign/python/Dockerfile.test
@@ -54,11 +54,10 @@ RUN maturin build
 RUN find target/wheels/ -name "*.whl" -exec pip install {} \;
 
 # Install test dependencies from pyproject.toml
-RUN pip install --no-cache-dir -e ".[testing,examples]"
+RUN pip install --no-cache-dir -e ".[testing]"
 
 # Copy test files
 COPY foreign/python/tests/ ./tests/
-COPY foreign/python/python_examples/ ./examples/
 
 # Create test script
 COPY foreign/python/scripts/test.sh ./scripts/test.sh
diff --git a/foreign/python/README.md b/foreign/python/README.md
index d5b5b81df..ed73477b7 100644
--- a/foreign/python/README.md
+++ b/foreign/python/README.md
@@ -23,24 +23,12 @@ pip install -e ".[testing]"
 For development with all tools:
 
 ```bash
-pip install -e ".[dev,testing,examples]"
+pip install -e ".[dev,testing]"
 ```
 
 ### Supported Python Versions
 
-- Python 3.7+
-
-## Usage and Examples
-
-All examples rely on a running iggy server. To start the server, execute:
-
-```bash
-# Using latest version
-docker run --rm -p 8080:8080 -p 3000:3000 -p 8090:8090 apache/iggy:latest
-
-# Or build from source (recommended for development)
-cd ../../ && cargo run --bin iggy-server
-```
+- Python 3.10+
 
 ## Testing
 
@@ -64,7 +52,7 @@ pytest tests/ -v
 
 ## Examples
 
-Refer to the 
[python_examples/](https://github.com/apache/iggy/tree/master/foreign/python/python_examples)
 directory for usage examples.
+Refer to the 
[examples/python/](https://github.com/apache/iggy/tree/master/examples/python) 
directory for usage examples.
 
 ## Contributing
 
diff --git a/foreign/python/pyproject.toml b/foreign/python/pyproject.toml
index 9bb86e3ad..3e5ecd1f0 100644
--- a/foreign/python/pyproject.toml
+++ b/foreign/python/pyproject.toml
@@ -21,7 +21,7 @@ build-backend = "maturin"
 
 [project]
 name = "apache-iggy"
-requires-python = ">=3.7"
+requires-python = ">=3.10"
 version = "0.6.1.dev1"
 description = "Apache Iggy is the persistent message streaming platform 
written in Rust, supporting QUIC, TCP and HTTP transport protocols, capable of 
processing millions of messages per second."
 readme = "README.md"
@@ -37,9 +37,6 @@ classifiers = [
     "License :: OSI Approved :: Apache Software License",
     "Operating System :: OS Independent",
     "Programming Language :: Python :: 3",
-    "Programming Language :: Python :: 3.7",
-    "Programming Language :: Python :: 3.8",
-    "Programming Language :: Python :: 3.9",
     "Programming Language :: Python :: 3.10",
     "Programming Language :: Python :: 3.11",
     "Programming Language :: Python :: 3.12",
@@ -83,9 +80,6 @@ testing = [
     "pytest-timeout>=2.0,<3.0",
 ]
 
-# For examples and demos
-examples = ["loguru>=0.7.0,<1.0"]
-
 # For containerized testing (CI/CD)
 testing-docker = ["testcontainers[docker]>=3.7.0,<5.0"]
 
diff --git a/foreign/python/python_examples/README.md 
b/foreign/python/python_examples/README.md
deleted file mode 100644
index 2fcdb59ad..000000000
--- a/foreign/python/python_examples/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# Python Examples
-
-## 1. Start the Producer
-
-Navigate to the `python_examples` directory and run:
-
-```bash
-python producer.py
-```
-
-## 2. Start the Consumer
-
-Still in the `python_examples` directory, run the consumer using a separate 
terminal:
-
-```bash
-python consumer.py
-```
-
-Here's how the output should look (show images of the output):
-![Output Sample](example_screenshot.png)
diff --git a/foreign/python/python_examples/consumer.py 
b/foreign/python/python_examples/consumer.py
deleted file mode 100644
index 1c20280eb..000000000
--- a/foreign/python/python_examples/consumer.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# 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 asyncio
-
-# Assuming there's a Python module for iggy with similar functionalities.
-from apache_iggy import IggyClient, PollingStrategy, ReceiveMessage
-from loguru import logger
-
-STREAM_NAME = "sample-stream"
-TOPIC_NAME = "sample-topic"
-PARTITION_ID = 0
-
-
-async def main():
-    client = IggyClient()  # Assuming default constructor has similar 
functionality.
-    try:
-        logger.info("Connecting to IggyClient...")
-        await client.connect()
-        logger.info("Connected. Logging in user...")
-        await client.login_user("iggy", "iggy")
-        logger.info("Logged in.")
-        await consume_messages(client)
-    except Exception as error:
-        logger.exception("Exception occurred in main function: {}", error)
-
-
-async def consume_messages(client: IggyClient):
-    interval = 0.5  # 500 milliseconds in seconds for asyncio.sleep
-    logger.info(
-        f"Messages will be consumed from stream: {STREAM_NAME}, topic: 
{TOPIC_NAME}, partition: {PARTITION_ID} with "
-        f"interval {interval * 1000} ms."
-    )
-    offset = 0
-    messages_per_batch = 10
-    while True:
-        try:
-            logger.debug("Polling for messages...")
-            polled_messages = await client.poll_messages(
-                stream=STREAM_NAME,
-                topic=TOPIC_NAME,
-                partition_id=PARTITION_ID,
-                polling_strategy=PollingStrategy.Next(),
-                count=messages_per_batch,
-                auto_commit=True,
-            )
-            if not polled_messages:
-                logger.warning("No messages found in current poll")
-                await asyncio.sleep(interval)
-                continue
-
-            offset += len(polled_messages)
-            for message in polled_messages:
-                handle_message(message)
-            await asyncio.sleep(interval)
-        except Exception as error:
-            logger.exception("Exception occurred while consuming messages: 
{}", error)
-            break
-
-
-def handle_message(message: ReceiveMessage):
-    payload = message.payload().decode("utf-8")
-    logger.info(
-        f"Handling message at offset: {message.offset()} with payload: 
{payload}..."
-    )
-
-
-if __name__ == "__main__":
-    asyncio.run(main())
diff --git a/foreign/python/python_examples/example_screenshot.png 
b/foreign/python/python_examples/example_screenshot.png
deleted file mode 100644
index 039a38798..000000000
Binary files a/foreign/python/python_examples/example_screenshot.png and 
/dev/null differ
diff --git a/foreign/python/python_examples/producer.py 
b/foreign/python/python_examples/producer.py
deleted file mode 100644
index acf578ed2..000000000
--- a/foreign/python/python_examples/producer.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# 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 asyncio
-
-# Assuming we have a Python module for iggy with similar functionality as the 
Rust one.
-from apache_iggy import IggyClient, StreamDetails, TopicDetails
-from apache_iggy import SendMessage as Message
-from loguru import logger
-
-STREAM_NAME = "sample-stream"
-TOPIC_NAME = "sample-topic"
-PARTITION_ID = 0
-
-
-async def main():
-    client = IggyClient()  # Assuming default constructor has similar 
functionality.
-    logger.info("Connecting to IggyClient")
-    await client.connect()
-    logger.info("Connected. Logging in user...")
-    await client.login_user("iggy", "iggy")
-    logger.info("Logged in.")
-    await init_system(client)
-    await produce_messages(client)
-
-
-async def init_system(client: IggyClient):
-    try:
-        logger.info(f"Creating stream with name {STREAM_NAME}...")
-        stream: StreamDetails | None = await client.get_stream(STREAM_NAME)
-        if stream is None:
-            await client.create_stream(name=STREAM_NAME)
-            logger.info("Stream was created successfully.")
-        else:
-            logger.info(f"Stream {stream.name} already exists with ID 
{stream.id}")
-
-    except Exception as error:
-        logger.error(f"Error creating stream: {error}")
-        logger.exception(error)
-
-    try:
-        logger.info(f"Creating topic {TOPIC_NAME} in stream {STREAM_NAME}")
-        topic: TopicDetails | None = await client.get_topic(STREAM_NAME, 
TOPIC_NAME)
-        if topic is None:
-            await client.create_topic(
-                stream=STREAM_NAME,  # Assuming a method exists to create a 
numeric Identifier.
-                partitions_count=1,
-                name=TOPIC_NAME,
-                replication_factor=1,
-            )
-            logger.info("Topic was created successfully.")
-        else:
-            logger.info("Topic {topic.name} already exists with ID {topic.id}")
-    except Exception as error:
-        logger.error(f"Error creating topic {error}")
-        logger.exception(error)
-
-
-async def produce_messages(client: IggyClient):
-    interval = 0.5  # 500 milliseconds in seconds for asyncio.sleep
-    logger.info(
-        f"Messages will be sent to stream: {STREAM_NAME}, topic: {TOPIC_NAME}, 
partition: {PARTITION_ID} with interval {interval * 1000} ms."
-    )
-    current_id = 0
-    messages_per_batch = 10
-    while True:
-        messages = []
-        for _ in range(messages_per_batch):
-            current_id += 1
-            payload = f"message-{current_id}"
-            message = Message(
-                payload
-            )  # Assuming a method exists to convert str to Message.
-            messages.append(message)
-        logger.info(
-            f"Attempting to send batch of {messages_per_batch} messages. Batch 
ID: {current_id // messages_per_batch}"
-        )
-        try:
-            await client.send_messages(
-                stream=STREAM_NAME,
-                topic=TOPIC_NAME,
-                partitioning=PARTITION_ID,
-                messages=messages,
-            )
-            logger.info(
-                f"Successfully sent batch of {messages_per_batch} messages. 
Batch ID: {current_id // messages_per_batch}"
-            )
-        except Exception as error:
-            logger.error(f"Exception type: {type(error).__name__}, message: 
{error}")
-            logger.exception(error)
-
-        await asyncio.sleep(interval)
-
-
-if __name__ == "__main__":
-    asyncio.run(main())
diff --git a/foreign/python/scripts/test.sh b/foreign/python/scripts/test.sh
index 0967b792e..a8837c1d5 100755
--- a/foreign/python/scripts/test.sh
+++ b/foreign/python/scripts/test.sh
@@ -84,22 +84,5 @@ else
     echo "❌ Some tests failed (exit code: $TEST_EXIT_CODE)"
 fi
 
-# Run examples if tests pass
-if [ $TEST_EXIT_CODE -eq 0 ] && [ "${RUN_EXAMPLES:-false}" = "true" ]; then
-    echo "🚀 Running example scripts..."
-
-    # Note: Examples might run indefinitely, so we'll just test they start 
correctly
-    timeout 10 python3 examples/producer.py &
-    PRODUCER_PID=$!
-    sleep 5
-
-    if kill -0 $PRODUCER_PID 2>/dev/null; then
-        echo "✅ Producer example started successfully"
-        kill $PRODUCER_PID
-    else
-        echo "❌ Producer example failed to start"
-    fi
-fi
-
 echo "📊 Test results saved to test-results/"
 exit $TEST_EXIT_CODE

Reply via email to