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
9 changes: 2 additions & 7 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,8 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install poetry
run: |
pip install poetry
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,18 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install --with dev --no-root
run: uv sync --group dev

- name: Run Coverage
run: |
poetry run pytest --cov-report=xml --cov=pynumaflow --cov-config .coveragerc tests/ -sq
uv run pytest --cov-report=xml --cov=pynumaflow --cov-config .coveragerc tests/ -sq

- name: Upload Coverage
uses: codecov/codecov-action@v4
Expand Down
34 changes: 16 additions & 18 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,26 @@ on:
branches: [ "main", "release/*" ]

jobs:
black:
name: Black format
lint:
name: Black & Ruff
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/pynumaflow/
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
src: packages/pynumaflow/
options: "--check --verbose --exclude=pynumaflow/proto/"
version: "~= 23.3"

ruff:
name: Ruff lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/pynumaflow/
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
with:
src: packages/pynumaflow/
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python
run: uv python install 3.10

- name: Install dependencies
run: uv sync --group dev

- name: Black format check
run: uv run black --check --verbose --exclude=pynumaflow/proto/ pynumaflow/ tests/ examples/

- name: Ruff lint check
run: uv run ruff check .
17 changes: 6 additions & 11 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,17 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install --no-root
run: uv sync --no-dev

- name: Build dist
run: poetry build
run: uv build

- name: Publish
run: poetry publish -u __token__ -p ${{ secrets.PYPI_PASSWORD }}
run: uv publish --token ${{ secrets.PYPI_PASSWORD }}
13 changes: 4 additions & 9 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install --with dev --no-root
run: uv sync --group dev

- name: Run tests
run: make test
45 changes: 19 additions & 26 deletions packages/pynumaflow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,29 @@ clean:
@find . -type f -name "*.py[co]" -exec rm -rf {} +

format: clean
poetry run black --exclude=pynumaflow/proto/ pynumaflow/ tests/ examples/
uv run black --exclude=pynumaflow/proto/ pynumaflow/ tests/ examples/


lint: format
poetry run ruff check --fix .
uv run ruff check --fix .


test:
poetry run pytest tests/ -rA


requirements:
poetry export -f requirements.txt --output requirements.txt --without-hashes
uv run pytest tests/ -rA


setup:
poetry install --with dev --no-root
uv sync --all-groups

proto:
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/common/*.proto
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sinker=pynumaflow/proto/sinker -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sinker/*.proto
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/mapper=pynumaflow/proto/mapper -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/mapper/*.proto
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/reducer=pynumaflow/proto/reducer -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/reducer/*.proto
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sourcetransformer=pynumaflow/proto/sourcetransformer -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sourcetransformer/*.proto
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sideinput=pynumaflow/proto/sideinput -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sideinput/*.proto
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sourcer=pynumaflow/proto/sourcer -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sourcer/*.proto
poetry run python3 -m grpc_tools.protoc -Ipynumaflow/proto/accumulator=pynumaflow/proto/accumulator -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/accumulator/*.proto
uv run python3 -m grpc_tools.protoc -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/common/*.proto
uv run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sinker=pynumaflow/proto/sinker -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sinker/*.proto
uv run python3 -m grpc_tools.protoc -Ipynumaflow/proto/mapper=pynumaflow/proto/mapper -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/mapper/*.proto
uv run python3 -m grpc_tools.protoc -Ipynumaflow/proto/reducer=pynumaflow/proto/reducer -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/reducer/*.proto
uv run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sourcetransformer=pynumaflow/proto/sourcetransformer -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sourcetransformer/*.proto
uv run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sideinput=pynumaflow/proto/sideinput -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sideinput/*.proto
uv run python3 -m grpc_tools.protoc -Ipynumaflow/proto/sourcer=pynumaflow/proto/sourcer -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/sourcer/*.proto
uv run python3 -m grpc_tools.protoc -Ipynumaflow/proto/accumulator=pynumaflow/proto/accumulator -Ipynumaflow/proto/common=pynumaflow/proto/common --pyi_out=. --python_out=. --grpc_python_out=. pynumaflow/proto/accumulator/*.proto


# ============================================================================
Expand All @@ -45,31 +41,28 @@ proto:
docs: docs-serve ## Alias for docs-serve

docs-serve: ## Serve documentation locally with hot-reload (http://localhost:8000)
poetry run mkdocs serve
uv run mkdocs serve

docs-build: ## Build documentation locally
poetry run mkdocs build
uv run mkdocs build

docs-deploy-dev: ## Deploy dev docs to docs-site branch
poetry run mike deploy -b docs-site dev --push
uv run mike deploy -b docs-site dev --push

docs-deploy-version: ## Deploy versioned docs (usage: make docs-deploy-version VERSION=0.11)
ifndef VERSION
$(error VERSION is required. Usage: make docs-deploy-version VERSION=0.11)
endif
poetry run mike deploy -b docs-site $(VERSION) latest --update-aliases --push
uv run mike deploy -b docs-site $(VERSION) latest --update-aliases --push

docs-list: ## List all deployed documentation versions
poetry run mike list -b docs-site
uv run mike list -b docs-site

docs-set-default: ## Set the default documentation version to 'latest'
poetry run mike set-default -b docs-site latest --push
uv run mike set-default -b docs-site latest --push

docs-delete: ## Delete a documentation version (usage: make docs-delete VERSION=0.10)
ifndef VERSION
$(error VERSION is required. Usage: make docs-delete VERSION=0.10)
endif
poetry run mike delete -b docs-site $(VERSION) --push

docs-setup: ## Install documentation dependencies
poetry install --with docs --no-root
uv run mike delete -b docs-site $(VERSION) --push
2 changes: 1 addition & 1 deletion packages/pynumaflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pip install pynumaflow

### Build locally

This project uses [Poetry](https://python-poetry.org/) for dependency management and packaging.
This project uses [uv](https://docs.astral.sh/uv/) for dependency management and packaging.
To build the package locally, run the following command from the root of the project.

```bash
Expand Down
10 changes: 5 additions & 5 deletions packages/pynumaflow/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Thank you for your interest in contributing to pynumaflow! This guide will help
### Prerequisites

- Python 3.10 or higher
- [Poetry](https://python-poetry.org/) for dependency management
- [uv](https://docs.astral.sh/uv/) for dependency management
- Git

### Clone and Install
Expand Down Expand Up @@ -68,13 +68,13 @@ make test
### Run Specific Tests

```bash
poetry run pytest tests/test_mapper.py -v
uv run pytest tests/test_mapper.py -v
```

### Test Coverage

```bash
poetry run pytest tests/ --cov=pynumaflow --cov-report=html
uv run pytest tests/ --cov=pynumaflow --cov-report=html
```

## Project Structure
Expand Down Expand Up @@ -156,8 +156,8 @@ make proto
### Local Preview

```bash
# Install docs dependencies
poetry install --with docs
# Install all dependencies (including docs)
make setup

# Serve locally
make docs-serve
Expand Down
48 changes: 13 additions & 35 deletions packages/pynumaflow/examples/accumulator/streamsorter/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,55 +1,33 @@
####################################################################################################
# Stage 1: Base Builder - installs core dependencies using poetry
# Stage 1: Builder - installs all dependencies using uv
####################################################################################################
FROM python:3.10-slim-bullseye AS base-builder
FROM ghcr.io/astral-sh/uv:python3.13-trixie AS builder

ENV PYSETUP_PATH="/opt/pysetup"
WORKDIR $PYSETUP_PATH

# Copy only core dependency files first for better caching
COPY pyproject.toml poetry.lock README.md ./
COPY pyproject.toml uv.lock README.md ./
COPY pynumaflow/ ./pynumaflow/
RUN apt-get update && apt-get install --no-install-recommends -y \
curl wget build-essential git \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& pip install poetry \
&& poetry install --no-root --no-interaction

####################################################################################################
# Stage 2: UDF Builder - adds UDF code and installs UDF-specific deps
####################################################################################################
FROM base-builder AS udf-builder

ENV EXAMPLE_PATH="/opt/pysetup/examples/accumulator/streamsorter"
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV EXAMPLE_PATH="$PYSETUP_PATH/examples/accumulator/streamsorter"
COPY examples/accumulator/streamsorter/ $EXAMPLE_PATH/

WORKDIR $EXAMPLE_PATH
COPY examples/accumulator/streamsorter/ ./
RUN poetry install --no-root --no-interaction
RUN uv sync --no-dev --no-install-project --frozen

####################################################################################################
# Stage 3: UDF Runtime - clean container with only needed stuff
# Stage 2: Runtime - clean image with only installed packages
####################################################################################################
FROM python:3.10-slim-bullseye AS udf
FROM ghcr.io/astral-sh/uv:python3.13-trixie AS udf

ENV PYSETUP_PATH="/opt/pysetup"
ENV EXAMPLE_PATH="$PYSETUP_PATH/examples/accumulator/streamsorter"
ENV VENV_PATH="$EXAMPLE_PATH/.venv"
ENV PATH="$VENV_PATH/bin:$PATH"

RUN apt-get update && apt-get install --no-install-recommends -y wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& wget -O /dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 \
&& chmod +x /dumb-init

WORKDIR $PYSETUP_PATH
COPY --from=udf-builder $VENV_PATH $VENV_PATH
COPY --from=udf-builder $EXAMPLE_PATH $EXAMPLE_PATH

WORKDIR $EXAMPLE_PATH
RUN chmod +x entry.sh
COPY --from=builder $EXAMPLE_PATH/.venv $EXAMPLE_PATH/.venv
COPY --from=builder $EXAMPLE_PATH/ $EXAMPLE_PATH/

ENTRYPOINT ["/dumb-init", "--"]
CMD ["sh", "-c", "$EXAMPLE_PATH/entry.sh"]
ENTRYPOINT []
CMD ["uv", "run", "python", "example.py"]

EXPOSE 5000
EXPOSE 5000
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCKER_FILE_PATH = examples/accumulator/streamsorter/Dockerfile

.PHONY: update
update:
poetry update -vv
uv lock --check || uv lock

.PHONY: image-push
image-push: update
Expand Down
Loading
Loading