Skip to content
Open
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
69 changes: 46 additions & 23 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,43 @@ concurrency:
cancel-in-progress: true

jobs:
lint-and-unit-test:
lint:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Install UV
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: true
- name: Check uv.lock is up to date
run: uv lock --check
- name: Run linters
run: uv run --locked --only-group lint prek run -a

typecheck:
runs-on: ubuntu-slim
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Install UV
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: true
- name: Run mypy type checking
run: uv run --locked --only-group tox tox run -e typecheck

unit-test:
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
Expand All @@ -53,42 +89,29 @@ jobs:
enable-cache: true
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
- name: Check uv.lock is up to date
if: matrix.python == '3.11'
run: uv lock --check
- name: Install
run: make install
- name: Run linters
if: matrix.python == '3.11'
run: make lint
- name: Run unit tests with coverage
run: COVERAGE=1 make test
- name: Generate coverage report (85%) # Coverage threshold should only increase over time — never decrease it!
run: COVERAGE_FAIL_UNDER=85 make coverage-report
- name: Run unit tests with coverage (85%) # Coverage threshold should only increase over time — never decrease it!
env:
TOX_ENV: test-${{ matrix.python }}
COVERAGE: "1"
COVERAGE_FAIL_UNDER: "85"
run: uv run --locked --only-group tox tox run -e "$TOX_ENV,coverage" --skip-missing-interpreters=false

windows-unit-test:
runs-on: windows-latest
timeout-minutes: 15
strategy:
fail-fast: true
matrix:
python: ['3.12']

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}
python-version: '3.12'
- name: Install UV
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: true
- name: Install
run: uv sync --all-extras --no-extra hive-kerberos
- name: Run unit tests
run: uv run python -m pytest tests/ -m unit --ignore=tests/integration -v -x
run: uv run --locked --only-group tox tox run -e test-3.12 --skip-missing-interpreters=false

cibw-dev-env-smoke-test:
runs-on: ubuntu-slim
Expand Down Expand Up @@ -117,7 +140,7 @@ jobs:

python-ci-required:
if: ${{ always() }}
needs: [lint-and-unit-test, windows-unit-test, cibw-dev-env-smoke-test]
needs: [lint, typecheck, unit-test, windows-unit-test, cibw-dev-env-smoke-test]
runs-on: ubuntu-slim
steps:
- name: Verify Python CI jobs succeeded
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/python-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ jobs:
enable-cache: true
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
- name: Install
run: make install
- name: Run integration tests with coverage
run: COVERAGE=1 make test-integration
env:
COVERAGE: "1"
KEEP_COMPOSE: "1"
run: uv run --locked --only-group tox tox run -e integration
- name: Show debug logs
if: ${{ failure() }}
run: docker compose -f dev/docker-compose-integration.yml logs
Expand All @@ -77,10 +78,10 @@ jobs:
enable-cache: true
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
- name: Install
run: make install
- name: Run s3 integration tests with coverage
run: COVERAGE=1 make test-s3
env:
COVERAGE: "1"
run: uv run --locked --only-group tox tox run -e s3
- name: Show debug logs
if: ${{ failure() }}
run: docker compose -f dev/docker-compose.yml logs
Expand All @@ -107,10 +108,10 @@ jobs:
enable-cache: true
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
- name: Install
run: make install
- name: Run adls integration tests with coverage
run: COVERAGE=1 make test-adls
env:
COVERAGE: "1"
run: uv run --locked --only-group tox tox run -e adls
- name: Show debug logs
if: ${{ failure() }}
run: docker compose -f dev/docker-compose-azurite.yml logs
Expand All @@ -137,10 +138,10 @@ jobs:
enable-cache: true
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
- name: Install
run: make install
- name: Run gcs integration tests with coverage
run: COVERAGE=1 make test-gcs
env:
COVERAGE: "1"
run: uv run --locked --only-group tox tox run -e gcs
- name: Show debug logs
if: ${{ failure() }}
run: docker compose -f dev/docker-compose-gcs-server.yml logs
Expand All @@ -165,15 +166,15 @@ jobs:
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: true
- name: Install dependencies
run: uv sync --group dev
- name: Download all coverage artifacts
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: coverage-*
merge-multiple: true
- name: Generate coverage report (75%) # Coverage threshold should only increase over time — never decrease it!
run: COVERAGE_FAIL_UNDER=75 make coverage-report
env:
COVERAGE_FAIL_UNDER: "75"
run: uv run --locked --only-group tox tox run -e coverage

python-integration-required:
if: ${{ always() }}
Expand Down
11 changes: 0 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ repos:
hooks:
- id: nbqa-ruff
args: [ --fix, --exit-non-zero-on-fix ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
args:
[--config=pyproject.toml]
additional_dependencies:
- types-cachetools
- types-pytest-lazy-fixture
- types-pytz
- types-requests
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.45.0
hooks:
Expand Down
15 changes: 9 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,17 @@ lives under `pyiceberg/`, organized by concern rather than by engine:
## Commands

- **Install / set up dev env:** `make install` (installs `uv`, syncs all extras, builds Cython, installs pre-commit hooks)
- **Run unit tests:** `make test`
- **Run a subset:** `make test PYTEST_ARGS="-v -k <pattern>"`
- **Integration tests (Spark/Docker):** `make test-integration` (rebuild with `make test-integration-rebuild`)
- **Cloud storage suites:** `make test-s3` / `make test-adls` / `make test-gcs`
- **Run typecheck + unit tests across installed Pythons:** `uv run tox -p`
- **Run unit tests (current or specific Python):** `uv run tox -e unit` / `uv run tox -e test-3.12`
- **Run a subset:** `uv run tox -e unit -- -v -k <pattern>`
- **Typecheck (mypy):** `uv run tox -e typecheck`
- **Integration tests (Spark/Docker):** `uv run tox -e integration` (`KEEP_COMPOSE=1` to keep containers running)
- **Cloud storage & notebook suites:** `uv run tox -e s3` / `adls` / `gcs` / `notebook`
- **Coverage report:** `COVERAGE=1 uv run tox -e unit,coverage`
- **Lint & format:** `make lint`
- **Docs preview / build:** `make docs-serve` / `make docs-build`
- **Clean build artifacts:** `make clean`
- **Use a specific Python:** prefix with `PYTHON=3.12`, e.g. `PYTHON=3.12 make install`
- **Use a specific Python with Make:** prefix with `PYTHON=3.12`, e.g. `PYTHON=3.12 make install`

## PR & Commit Conventions

Expand All @@ -99,7 +102,7 @@ lives under `pyiceberg/`, organized by concern rather than by engine:
- Keep the first version of a PR minimal; defer optimizations and edge cases to follow-ups.
- Commit messages explain the *what* and *why*, not line-by-line implementation. Be as succinct as possible.
- The Apache License header is required on every new source file (enforced by `./dev/check-license`).
- Run `make lint` and `make test` before pushing; CI runs both plus the lockfile check.
- Run `make lint` and `uv run tox -p` before pushing; CI runs both plus the lockfile check.

## GitHub Write Approval

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ recursive-include tests *

# Include development files
include Makefile
include tox.toml
include uv.lock
recursive-include dev *

Expand Down
87 changes: 6 additions & 81 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# specific language governing permissions and limitations
# under the License.
.PHONY: help install install-uv check-license lint \
test test-integration test-integration-setup test-integration-exec test-integration-cleanup test-integration-rebuild \
test-s3 test-adls test-gcs test-coverage coverage-report test test-notebook\
docs-serve docs-build notebook notebook-infra \
clean

Expand All @@ -26,10 +24,6 @@
# ========================

PYTHON ?= # Override with e.g. PYTHON=3.11 to use specific Python version
PYTEST_ARGS ?= -v -x # Override with e.g. PYTEST_ARGS="-vv --tb=short"
COVERAGE ?= 0 # Set COVERAGE=1 to enable coverage: make test COVERAGE=1
COVERAGE_FAIL_UNDER ?= 85 # Minimum coverage % to pass: make coverage-report COVERAGE_FAIL_UNDER=70
KEEP_COMPOSE ?= 0 # Set KEEP_COMPOSE=1 to keep containers after integration tests

# Set Python argument for uv commands if PYTHON is specified
ifneq ($(PYTHON),)
Expand All @@ -38,18 +32,6 @@ else
PYTHON_ARG =
endif

ifeq ($(COVERAGE),1)
TEST_RUNNER = uv run $(PYTHON_ARG) python -m coverage run --parallel-mode --source=pyiceberg -m
else
TEST_RUNNER = uv run $(PYTHON_ARG) python -m
endif

ifeq ($(KEEP_COMPOSE),1)
CLEANUP_COMMAND = echo "Keeping containers running for debugging (KEEP_COMPOSE=1)"
else
CLEANUP_COMMAND = docker compose -f dev/docker-compose-integration.yml down -v --remove-orphans --timeout 0 2>/dev/null || true
endif

# ============
# Help Section
# ============
Expand Down Expand Up @@ -97,67 +79,6 @@ check-license: ## Check license headers
lint: ## Run code linters via prek (pre-commit hooks)
uv run $(PYTHON_ARG) prek run -a

# ===============
# Testing Section
# ===============

##@ Testing

test: ## Run all unit tests (excluding integration)
$(TEST_RUNNER) pytest tests/ -m unit --ignore=tests/integration $(PYTEST_ARGS)

test-integration: test-integration-setup test-integration-exec test-integration-cleanup ## Run integration tests

test-integration-setup: install ## Start Docker services for integration tests
docker compose -f dev/docker-compose-integration.yml kill
docker compose -f dev/docker-compose-integration.yml rm -f
docker compose -f dev/docker-compose-integration.yml up -d --build --wait
uv run $(PYTHON_ARG) python dev/provision.py

test-integration-exec: ## Run integration tests (excluding provision)
$(TEST_RUNNER) pytest tests/ -m integration $(PYTEST_ARGS)

test-integration-cleanup: ## Clean up integration test environment
@if [ "${KEEP_COMPOSE}" != "1" ]; then \
echo "Cleaning up Docker containers..."; \
fi
$(CLEANUP_COMMAND)

test-integration-rebuild: ## Rebuild integration Docker services from scratch
docker compose -f dev/docker-compose-integration.yml kill
docker compose -f dev/docker-compose-integration.yml rm -f
docker compose -f dev/docker-compose-integration.yml build --no-cache

test-s3: ## Run tests marked with @pytest.mark.s3
sh ./dev/run-s3.sh
$(TEST_RUNNER) pytest tests/ -m s3 $(PYTEST_ARGS)

test-adls: ## Run tests marked with @pytest.mark.adls
sh ./dev/run-azurite.sh
$(TEST_RUNNER) pytest tests/ -m adls $(PYTEST_ARGS)

test-gcs: ## Run tests marked with @pytest.mark.gcs
sh ./dev/run-gcs-server.sh
# gcsfs 2026.6.0 sends HNS/Zonal bucket detection to endpoint_url.
# fake-gcs-server does not support that API, so repeated detection retries
# make GCS sanity tests take close to an hour. Disable it here.
# Workaround documented by gcsfs:
# https://github.com/fsspec/gcsfs/blob/2026.6.0/docs/source/hns_buckets.rst#L99-L101
GCSFS_EXPERIMENTAL_ZB_HNS_SUPPORT=false $(TEST_RUNNER) pytest tests/ -m gcs $(PYTEST_ARGS)

test-coverage: ## Run all tests with coverage and report
$(MAKE) COVERAGE=1 test test-integration test-s3 test-adls test-gcs
$(MAKE) coverage-report

coverage-report: ## Combine and report coverage
uv run $(PYTHON_ARG) coverage combine
uv run $(PYTHON_ARG) coverage report -m --fail-under=$(COVERAGE_FAIL_UNDER)
uv run $(PYTHON_ARG) coverage html
uv run $(PYTHON_ARG) coverage xml

test-notebook: ## Run notebook tests (pyiceberg_example and spark_integration_example) via papermill
$(TEST_RUNNER) pytest tests/notebooks/test_pyiceberg_example.py tests/notebooks/test_spark_integration_example.py -m notebook $(PYTEST_ARGS)

# ================
# Documentation
# ================
Expand All @@ -179,7 +100,11 @@ docs-build: ## Build the static documentation site
notebook: ## Launch notebook for experimentation
uv run $(PYTHON_ARG) --all-extras --group notebook jupyter lab --notebook-dir=notebooks

notebook-infra: test-integration-setup ## Launch notebook with integration test infra (Spark, Iceberg Rest Catalog, object storage, etc.)
notebook-infra: install ## Launch notebook with integration test infra (Spark, Iceberg Rest Catalog, object storage, etc.)
docker compose -f dev/docker-compose-integration.yml kill
docker compose -f dev/docker-compose-integration.yml rm -f
docker compose -f dev/docker-compose-integration.yml up -d --build --wait
uv run $(PYTHON_ARG) python dev/provision.py
uv run $(PYTHON_ARG) --all-extras --group notebook jupyter lab --notebook-dir=notebooks

# ===================
Expand All @@ -190,7 +115,7 @@ notebook-infra: test-integration-setup ## Launch notebook with integration test

clean: ## Remove build artifacts and caches
@echo "Cleaning up Cython and Python cached files..."
@rm -rf build dist *.egg-info .venv
@rm -rf build dist *.egg-info .venv .tox
@find . -name "*.so" -exec echo Deleting {} \; -delete
@find . -name "*.pyc" -exec echo Deleting {} \; -delete
@find . -name "__pycache__" -exec echo Deleting {} \; -exec rm -rf {} +
Expand Down
1 change: 1 addition & 0 deletions dev/.rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ uv.lock
.ruff_cache/**
.pytest_cache/**
.mypy_cache/**
.tox/**
mkdocs/**
notebooks/**
4 changes: 2 additions & 2 deletions dev/release/verify_rc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ verify_license_documentation() {

test_source_distribution() {
echo "--- Installing and running the tests, this spins up Docker containers"
make install
make test-coverage
make install-uv
COVERAGE=1 uv run --locked --only-group tox tox run -e unit,integration,s3,adls,gcs,coverage
}

echo "Verifying pyiceberg-${PYICEBERG_VERSION} in ${PYICEBERG_VERIFICATION_DIR}"
Expand Down
Loading
Loading