Skip to content

Commit

Permalink
Check in interval join.
Browse files Browse the repository at this point in the history
  • Loading branch information
whoahbot committed Jul 2, 2024
1 parent 7694677 commit b8bea39
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 128 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/pages.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.12'
- name: Install uv
run: pipx install uv
- name: Install build dependencies
run: python -m pip install -U setuptools wheel build
run: uv pip install build
- name: Build
run: python -m build .
- name: Publish
Expand Down
70 changes: 64 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,60 @@
name: Test

on: [push, pull_request]
on:
push:
branches:
- main
pull_request: {}
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
repo-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.12
- name: Install uv
run: pipx install uv
- uses: extractions/setup-just@v2
- name: Install cbfmt
run: |
mkdir /tmp/cbfmt && cd $_
curl -fsSL -o cbfmt.tar.gz "https://github.com/lukas-reineke/cbfmt/releases/download/v0.2.0/cbfmt_linux-x86_64_v0.2.0.tar.gz"
tar --strip-components 1 -xvf cbfmt.tar.gz
mv cbfmt /usr/local/bin/
- name: Prep venv
shell: bash
run: |
uv venv -p 3.12 venv
. venv/bin/activate
uv pip sync --strict requirements/dev.txt
- name: Check pre-commit hooks
shell: bash
run: |
. venv/bin/activate
just lint-pc
- name: Run lints
shell: bash
run: |
. venv/bin/activate
just lint
- name: Run documentation tests
shell: bash
run: |
. venv/bin/activate
just test-doc
test:
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11', '3.12']
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -16,7 +64,17 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install test dependencies
run: python -m pip install .[dev]
- name: Test
run: python -m tox -e py
- name: Install uv
run: pipx install uv
- uses: extractions/setup-just@v2
- name: Prep build venv
shell: bash
run: |
uv venv -p ${{ matrix.python-version }} venv/
. venv/bin/activate
uv pip sync --strict requirements/dev.txt
- name: Run Python tests
shell: bash
run: |
. venv/bin/activate
just test-py
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import re
from typing import Optional

import docutils.nodes as dn
Expand Down
6 changes: 0 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,8 @@ dependencies = [
requires = ["setuptools>=43.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
py-modules = ['bytewax.operators.interval']

[tool.pytest.ini_options]
addopts = "-v"
# pythonpath = [
# "src"
# ]

[tool.mypy]
check_untyped_defs = true
Expand Down
4 changes: 2 additions & 2 deletions pytests/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from datetime import datetime, timedelta, timezone
from typing import Iterable, List, Optional, Tuple

import bytewax.interval_join.operators.interval as iv
import bytewax.operators as op
import bytewax.operators.interval as iv
from bytewax.dataflow import Dataflow
from bytewax.operators.interval import IntervalLogic, LeftRight
from bytewax.interval_join.operators.interval import IntervalLogic, LeftRight
from bytewax.operators.windowing import EventClock
from bytewax.testing import TestingSink, TestingSource, run_main
from typing_extensions import override
Expand Down
2 changes: 1 addition & 1 deletion pytests/test_join_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from datetime import datetime, timedelta, timezone
from typing import List, Literal, Tuple

import bytewax.interval_join.operators.interval as iv
import bytewax.operators as op
import bytewax.operators.interval as iv
from bytewax.dataflow import Dataflow
from bytewax.operators.windowing import ZERO_TD, EventClock
from bytewax.testing import TestingSink, TestingSource, run_main
Expand Down
21 changes: 0 additions & 21 deletions pytests/test_simple.py

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class IntervalLogic(ABC, Generic[V, W, S]):
"""

@abstractmethod
def on_value(self, LeftRight, value: V) -> Iterable[W]:
def on_value(self, side: LeftRight, value: V) -> Iterable[W]:
"""Called on each new upstream item in within this interval.
Will be called only once with a left side item that created
Expand Down Expand Up @@ -711,7 +711,7 @@ def shim_getter(i_v: Tuple[str, V]) -> datetime:
wait_for_system_duration=clock.wait_for_system_duration,
)

names = [i for i in range(len(rights) + 1)]
names = [str(i) for i in range(len(rights) + 1)]

logic_class: Callable[
[_JoinState], IntervalLogic[Tuple[str, V], _JoinState, _JoinState]
Expand All @@ -731,7 +731,7 @@ def shim_getter(i_v: Tuple[str, V]) -> datetime:
def shim_builder(
resume_state: Optional[_JoinState],
) -> IntervalLogic[Tuple[str, V], _JoinState, _JoinState]:
state = _JoinState.for_side_count(len(names))
state = _JoinState.for_names(names)
return logic_class(state)

interval_out = interval(
Expand Down
33 changes: 0 additions & 33 deletions tox.ini

This file was deleted.

0 comments on commit b8bea39

Please sign in to comment.