Skip to content

Commit bcdc4c3

Browse files
authored
chore: Update examples for poetry to uv migration (#336)
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
1 parent febbe7a commit bcdc4c3

21 files changed

Lines changed: 135 additions & 62 deletions

File tree

packages/pynumaflow/examples/accumulator/streamsorter/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/batchmap/flatmap/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/map/even_odd/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/map/flatmap/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/map/forward_message/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/map/multiproc_map/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/mapstream/flatmap_stream/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/reduce/asyncio_reduce/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/reduce/counter/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

packages/pynumaflow/examples/reducestream/counter/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ WORKDIR $EXAMPLE_PATH
2727
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
2828
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/
2929

30-
ENTRYPOINT []
31-
CMD ["uv", "run", "python", "example.py"]
30+
# NOTE: We cannot use "uv run python example.py" here because uv run reads the
31+
# example's pyproject.toml, finds the pynumaflow path source (path = "../../../"),
32+
# and tries to resolve it. In the runtime stage, the parent pynumaflow source tree
33+
# is not present (by design, to keep the image small), so uv run fails.
34+
# Instead, we activate the pre-built .venv via PATH and run python directly.
35+
ENV PATH="$EXAMPLE_PATH/.venv/bin:$PATH"
36+
CMD ["python", "example.py"]
3237

3338
EXPOSE 5000

0 commit comments

Comments
 (0)