.PHONY: build build-release build-all-features test test-rust check check-full check-crate fmt fmt-check clippy audit outdated deny \
lint-python \
clean clean-generated \
build-python test-python test-python-upstream test-python-upstream-full \
test-parity-phase-a test-parity-phase-b test-parity-phase-c test-parity-phase-d \
test-parity-phase-e test-parity-phase-f test-parity-phase-g test-parity-phases \
sparkless-parity all bench-window
export RUSTUP_TOOLCHAIN ?= stable
export CARGO_HOME := $(HOME)/.cargo
build:
cargo build
build-release:
cargo build --release
build-all-features:
cargo build --workspace --all-features
test-rust:
cargo test --workspace
test-rust-all-features:
cargo test --workspace --all-features
test: test-rust
check: clean
@$(MAKE) -j4 fmt-check audit deny clippy
$(MAKE) test-rust-all-features
@echo "All checks passed"
clean:
cargo clean
clean-generated:
rm -rf tmp spark-warehouse site docs/_build _build
check-crate:
@if [ -z "$(CRATE)" ]; then echo "Usage: make check-crate CRATE=<package-name>"; exit 1; fi
$(MAKE) fmt-check
$(MAKE) audit
$(MAKE) deny
cargo clippy -p $(CRATE) --all-features --all-targets -- -D warnings
cargo test -p $(CRATE) --all-features
@echo "check-crate ($(CRATE)): format, clippy, audit, deny, tests passed"
lint-python:
@RUFF=$$(test -f .venv/bin/ruff && echo .venv/bin/ruff || echo ruff); \
MYPY=$$(test -f .venv/bin/mypy && echo .venv/bin/mypy || echo mypy); \
$$RUFF format --check . && $$RUFF check . && $$MYPY .
check-full:
@if [ -n "$(CRATE)" ]; then \
$(MAKE) check-crate CRATE=$(CRATE); \
echo "check-full (crate $(CRATE)): format, clippy, audit, deny, tests"; \
else \
$(MAKE) check; \
$(MAKE) lint-python; \
echo "check-full: format, clippy, audit, deny, tests, ruff, mypy"; \
fi
fmt:
cargo fmt
@echo "Formatted"
fmt-check:
cargo fmt --check
clippy:
cargo clippy --workspace --all-features --all-targets -- -D warnings
audit:
cargo audit
outdated:
cargo outdated
deny:
cargo deny check advisories bans sources
test-parity-phase-a:
PARITY_PHASE=a cargo test pyspark_parity_fixtures
test-parity-phase-b:
PARITY_PHASE=b cargo test pyspark_parity_fixtures
test-parity-phase-c:
PARITY_PHASE=c cargo test pyspark_parity_fixtures
test-parity-phase-d:
PARITY_PHASE=d cargo test pyspark_parity_fixtures
test-parity-phase-e:
PARITY_PHASE=e cargo test pyspark_parity_fixtures
test-parity-phase-f:
PARITY_PHASE=f cargo test pyspark_parity_fixtures
test-parity-phase-g:
PARITY_PHASE=g cargo test pyspark_parity_fixtures
test-parity-phases:
cargo test --workspace --all-features pyspark_parity_fixtures
sparkless-parity:
@if [ -z "$$SPARKLESS_EXPECTED_OUTPUTS" ]; then \
echo "SPARKLESS_EXPECTED_OUTPUTS is not set; see docs/CONVERTER_STATUS.md"; \
exit 1; \
fi
python tests/convert_sparkless_fixtures.py --batch "$$SPARKLESS_EXPECTED_OUTPUTS" tests/fixtures --output-subdir converted --dedupe
python tests/regenerate_expected_from_pyspark.py tests/fixtures/converted
cargo test pyspark_parity_fixtures
build-python:
cd python && maturin build
test-python:
@PYTHON=$$(test -f .venv/bin/python && echo .venv/bin/python || echo python); \
$$PYTHON -c "from sparkless.sql import SparkSession; from sparkless.sql.functions import col, lit_i64; s = SparkSession.builder.app_name('test').get_or_create(); df = s.create_dataframe([(1, 2, 'a')], ['x', 'y', 'z']); assert df.count() == 1; print('sparkless OK')"
test-python-upstream:
@PYTHON=$$(test -f .venv/bin/python && echo .venv/bin/python || echo python); \
$$PYTHON -m pytest tests -m "not delta and not integration" -n 10 -v --tb=short
test-python-upstream-full:
@PYTHON=$$(test -f .venv/bin/python && echo .venv/bin/python || echo python); \
$$PYTHON -m pytest tests -n 10 -v --tb=short
bench-window:
@PYTHON=$$(test -f .venv/bin/python && echo .venv/bin/python || echo python); \
$$PYTHON scripts/run_window_benchmark.py --rows 100000 --groups 1000 --repetitions 5
all: check
@echo "All updates and checks complete"