Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,22 @@ install-python-deps:
FROM +install-deps
RUN pip install wheel
COPY demo/demo_notebooks/requirements.txt requirements.txt
COPY --dir python ./
RUN pip install --upgrade pip
RUN pip wheel -r requirements.txt --wheel-dir=wheels
RUN pip wheel -r python/tests/requirements.txt --wheel-dir=wheels
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.

I might be reading this wrong, but aren't we installing the same requirements again in the next action below?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We install it to the wheel directory here, and then next, install it via the wheel directory.
Just followed the pattern we use for requirements in demo_notebooks.

RUN pip wheel python/ --wheel-dir=wheels
SAVE ARTIFACT wheels /wheels

install-python:
FROM +install-deps
COPY +install-python-deps/wheels wheels
COPY demo/demo_notebooks/requirements.txt requirements.txt
COPY --dir python ./
RUN pip install --upgrade pip # remove after upgrading to ubuntu 24
RUN pip install --user -v --no-index --find-links=wheels -r requirements.txt
RUN pip install --user -v --no-index --find-links=wheels -r python/tests/requirements.txt
RUN pip install --user -v --no-index --find-links=wheels feldera
SAVE ARTIFACT /root/.local/lib/python3.10
SAVE ARTIFACT /root/.local/bin

Expand Down Expand Up @@ -258,6 +266,7 @@ test-python:

COPY demo/demo_notebooks demo/demo_notebooks
COPY demo/simple-join demo/simple-join
COPY python/tests tests

# Reuse `Cargo.lock` to ensure consistent crate versions.
RUN mkdir -p /working-dir/cargo_workspace
Expand All @@ -270,11 +279,13 @@ test-python:
ENV RUST_LOG=error
ENV WITH_POSTGRES=1
ENV IN_CI=1
ENV KAFKA_URL="localhost:9092"
WITH DOCKER --pull postgres
RUN docker run --shm-size=512MB -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -e PGDATA=/dev/shm -d postgres && \
sleep 10 && \
(./pipeline-manager --bind-address=0.0.0.0 --api-server-working-directory=/working-dir --compiler-working-directory=/working-dir --runner-working-directory=/working-dir --sql-compiler-home=/dbsp/sql-to-dbsp-compiler --dbsp-override-path=/dbsp --db-connection-string=postgresql://postgres:postgres@localhost:5432 --compilation-profile=unoptimized &) && \
sleep 5 && \
cd tests && python3 -m pytest . && cd .. && \
python3 demo/simple-join/run.py --api-url http://localhost:8080 && \
cd demo/demo_notebooks && jupyter execute fraud_detection.ipynb --JupyterApp.log_level='DEBUG'
END
Expand Down
1 change: 1 addition & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies = [
"requests",
"pandas",
"typing-extensions",
"numpy<2",
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.

Curiosity: which features of NumPy 2+ are non-compatible? As I see it has been recently released.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

]
[project.urls]
Homepage = "https://www.feldera.com"
Expand Down
2 changes: 2 additions & 0 deletions python/tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kafka-python==2.0.2
pytest
19 changes: 16 additions & 3 deletions python/tests/test_wireframes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest
import pandas as pd
from kafka import KafkaProducer, KafkaConsumer
Expand Down Expand Up @@ -184,6 +185,13 @@ def test_kafka(self):
import json

KAFKA_SERVER = "localhost:19092"
PIPELINE_TO_KAFKA_SERVER = "redpanda:9092"

in_ci = os.environ.get("IN_CI")

if in_ci == "1":
# if running in CI, skip the test
return

print("(Re-)creating topics...")
admin_client = KafkaAdminClient(
Expand Down Expand Up @@ -224,7 +232,6 @@ def test_kafka(self):
sql.register_table(TABLE_NAME, SQLSchema({"id": "INT NOT NULL PRIMARY KEY"}))
sql.register_view(VIEW_NAME, f"SELECT COUNT(*) as num_rows FROM {TABLE_NAME}")

PIPELINE_TO_KAFKA_SERVER = "redpanda:9092"

source_config = {
"topics": [INPUT_TOPIC],
Expand Down Expand Up @@ -281,10 +288,16 @@ def test_http_get(self):
def test_avro_format(self):
from feldera.formats import AvroFormat

KAFKA_URL_FROM_PIPELINE = "redpanda:9092"
PIPELINE_TO_KAFKA_SERVER = "redpanda:9092"
KAFKA_SERVER = "localhost:19092"
TOPIC = "test_avro_format"

in_ci = os.environ.get("IN_CI")

if in_ci == "1":
# if running in CI, skip the test
return

admin_client = KafkaAdminClient(
bootstrap_servers=KAFKA_SERVER,
client_id="test_client"
Expand All @@ -305,7 +318,7 @@ def test_avro_format(self):

sink_config = {
"topic": TOPIC,
"bootstrap.servers": KAFKA_URL_FROM_PIPELINE,
"bootstrap.servers": PIPELINE_TO_KAFKA_SERVER,
"auto.offset.reset": "earliest",
}

Expand Down