Skip to content
Draft
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: 5 additions & 4 deletions .github/workflows/nightly-pypi-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:

jobs:
set-version:
if: github.repository == 'apache/iceberg-python' # Only run for apache repo
# if: github.repository == 'apache/iceberg-python' # Only run for apache repo
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.set-version.outputs.VERSION }}
Expand All @@ -39,13 +39,14 @@ jobs:
with:
python-version: 3.12

- name: Install Poetry
run: make install-poetry
- name: Install UV
run: make install-uv

- name: Set version
id: set-version
run: |
CURRENT_VERSION=$(poetry version --short)
uv tool install 'pyproject-parser[cli]'
CURRENT_VERSION=$(pyproject-info project.version)
TIMESTAMP=$(date +%Y%m%d%H%M%S)
echo "VERSION=${CURRENT_VERSION}.dev${TIMESTAMP}" >> "$GITHUB_OUTPUT"

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/pypi-build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ jobs:
3.11
3.12

- name: Install poetry
run: make install-poetry
- name: Install uv
run: make install-uv

- name: Set version with RC
env:
VERSION: ${{ inputs.VERSION }}
run: python -m poetry version "${{ env.VERSION }}"
run: |
# Update version in pyproject.toml
sed -i 's/version = ".*"/version = "'$VERSION'"/' pyproject.toml

# Publish the source distribution with the version that's in
# the repository, otherwise the tests will fail
- name: Compile source distribution
run: python3 -m poetry build --format=sdist
run: uv build --sdist
if: startsWith(matrix.os, 'ubuntu')

- name: Build wheels
Expand All @@ -70,6 +72,7 @@ jobs:
# Ignore 32 bit architectures
CIBW_ARCHS: "auto64"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.13"
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==5.0.1"
CIBW_TEST_COMMAND: "pytest {project}/tests/avro/test_decoder.py"
# Ignore tests for pypy since not all dependencies are compiled for it
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-ci-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: make install-poetry
- name: Install uv
run: make install-uv
- uses: actions/setup-python@v5
with:
python-version: 3.12
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: make install-poetry
- name: Install uv
run: make install-uv
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: poetry
cache-dependency-path: ./poetry.lock
cache: pip
cache-dependency-path: ./uv.lock
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
- name: Install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-release-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: make install-poetry
- name: Install uv
run: make install-uv
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,23 @@ jobs:
with:
python-version: 3.12

- name: Install Poetry
run: make install-poetry
- name: Install uv
run: make install-uv

- name: Install pyproject-parser
run: uv tool install 'pyproject-parser[cli]'

- name: Validate current pyiceberg version
env:
VERSION: ${{ needs.validate-inputs.outputs.VERSION }}
run: |
# Extract the current version from Poetry
current_pyiceberg_version=$(poetry version --short)
echo "Detected Poetry version: $current_pyiceberg_version"
# Extract the current version from pyproject.toml
current_pyiceberg_version=$(pyproject-info project.version)
echo "Detected project version: $current_pyiceberg_version"

# Compare the input version with the Poetry version
# Compare the input version with the project version
if [[ "$VERSION" != "$current_pyiceberg_version" ]]; then
echo "Error: Input version ($VERSION) does not match the Poetry version ($current_pyiceberg_version)"
echo "Error: Input version ($VERSION) does not match the project version ($current_pyiceberg_version)"
exit 1
fi

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/svn-build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ jobs:
3.11
3.12

- name: Install poetry
run: make install-poetry
- name: Install uv
run: make install-uv

# Publish the source distribution with the version that's in
# the repository, otherwise the tests will fail
- name: Compile source distribution
run: python3 -m poetry build --format=sdist
run: uv build --sdist
if: startsWith(matrix.os, 'ubuntu')

- name: Build wheels
Expand Down
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
54 changes: 27 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

POETRY_VERSION = 2.1.1
install-poetry: ## Ensure Poetry is installed and the correct version is being used.
@if ! command -v poetry &> /dev/null; then \
echo "Poetry could not be found. Installing..."; \
pip install --user poetry==$(POETRY_VERSION); \
UV_VERSION = 0.6.16
install-uv: ## Ensure uv is installed and the correct version is being used.
@if ! command -v uv &> /dev/null; then \
echo "uv could not be found. Installing..."; \
pip install --user uv==$(UV_VERSION); \
else \
INSTALLED_VERSION=$$(pip show poetry | grep Version | awk '{print $$2}'); \
if [ "$$INSTALLED_VERSION" != "$(POETRY_VERSION)" ]; then \
echo "Poetry version $$INSTALLED_VERSION does not match required version $(POETRY_VERSION). Updating..."; \
pip install --user --upgrade poetry==$(POETRY_VERSION); \
INSTALLED_VERSION=$$(uv --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'); \
if [ "$$INSTALLED_VERSION" != "$(UV_VERSION)" ]; then \
echo "uv version $$INSTALLED_VERSION does not match required version $(UV_VERSION). Updating..."; \
pip install --user --upgrade uv==$(UV_VERSION); \
else \
echo "Poetry version $$INSTALLED_VERSION is already installed."; \
echo "uv version $$INSTALLED_VERSION is already installed."; \
fi \
fi

install-dependencies: ## Install dependencies including dev, docs, and all extras
poetry install --all-extras
uv sync --all-extras --dev

install: | install-poetry install-dependencies
install: | install-uv install-dependencies

check-license: ## Check license headers
./dev/check-license

lint: ## lint
poetry run pre-commit run --all-files
uv run pre-commit run --all-files

test: ## Run all unit tests, can add arguments with PYTEST_ARGS="-vv"
poetry run pytest tests/ -m "(unmarked or parametrize) and not integration" ${PYTEST_ARGS}
uv run pytest tests/ -m "(unmarked or parametrize) and not integration" ${PYTEST_ARGS}

test-s3: # Run tests marked with s3, can add arguments with PYTEST_ARGS="-vv"
sh ./dev/run-minio.sh
poetry run pytest tests/ -m s3 ${PYTEST_ARGS}
uv run pytest tests/ -m s3 ${PYTEST_ARGS}

test-integration: | test-integration-setup test-integration-exec ## Run all integration tests, can add arguments with PYTEST_ARGS="-vv"

Expand All @@ -63,7 +63,7 @@ test-integration-setup: # Prepare the environment for integration
docker compose -f dev/docker-compose-integration.yml exec -T spark-iceberg ipython ./provision.py

test-integration-exec: # Execute integration tests, can add arguments with PYTEST_ARGS="-vv"
poetry run pytest tests/ -v -m integration ${PYTEST_ARGS}
uv run pytest tests/ -v -m integration ${PYTEST_ARGS}

test-integration-rebuild:
docker compose -f dev/docker-compose-integration.yml kill
Expand All @@ -72,14 +72,14 @@ test-integration-rebuild:

test-adls: ## Run tests marked with adls, can add arguments with PYTEST_ARGS="-vv"
sh ./dev/run-azurite.sh
poetry run pytest tests/ -m adls ${PYTEST_ARGS}
uv run pytest tests/ -m adls ${PYTEST_ARGS}

test-gcs: ## Run tests marked with gcs, can add arguments with PYTEST_ARGS="-vv"
sh ./dev/run-gcs-server.sh
poetry run pytest tests/ -m gcs ${PYTEST_ARGS}
uv run pytest tests/ -m gcs ${PYTEST_ARGS}

test-coverage-unit: # Run test with coverage for unit tests, can add arguments with PYTEST_ARGS="-vv"
poetry run coverage run --source=pyiceberg/ --data-file=.coverage.unit -m pytest tests/ -v -m "(unmarked or parametrize) and not integration" ${PYTEST_ARGS}
uv run coverage run --source=pyiceberg/ --data-file=.coverage.unit -m pytest tests/ -v -m "(unmarked or parametrize) and not integration" ${PYTEST_ARGS}

test-coverage-integration: # Run test with coverage for integration tests, can add arguments with PYTEST_ARGS="-vv"
docker compose -f dev/docker-compose-integration.yml kill
Expand All @@ -90,13 +90,13 @@ test-coverage-integration: # Run test with coverage for integration tests, can a
sleep 10
docker compose -f dev/docker-compose-integration.yml cp ./dev/provision.py spark-iceberg:/opt/spark/provision.py
docker compose -f dev/docker-compose-integration.yml exec -T spark-iceberg ipython ./provision.py
poetry run coverage run --source=pyiceberg/ --data-file=.coverage.integration -m pytest tests/ -v -m integration ${PYTEST_ARGS}
uv run coverage run --source=pyiceberg/ --data-file=.coverage.integration -m pytest tests/ -v -m integration ${PYTEST_ARGS}

test-coverage: | test-coverage-unit test-coverage-integration ## Run all tests with coverage including unit and integration tests
poetry run coverage combine .coverage.unit .coverage.integration
poetry run coverage report -m --fail-under=90
poetry run coverage html
poetry run coverage xml
uv run coverage combine .coverage.unit .coverage.integration
uv run coverage report -m --fail-under=90
uv run coverage html
uv run coverage xml


clean: ## Clean up the project Python working environment
Expand All @@ -110,10 +110,10 @@ clean: ## Clean up the project Python working environment
@echo "Cleanup complete"

docs-install:
poetry install --with docs
uv sync --group docs

docs-serve:
poetry run mkdocs serve -f mkdocs/mkdocs.yml
uv run mkdocs serve -f mkdocs/mkdocs.yml

docs-build:
poetry run mkdocs build -f mkdocs/mkdocs.yml --strict
uv run mkdocs build -f mkdocs/mkdocs.yml --strict
2 changes: 1 addition & 1 deletion dev/.rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
build
.git
.gitignore
poetry.lock
uv.lock
22 changes: 10 additions & 12 deletions mkdocs/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,31 @@ For first-time contributors, feel free to check out our [good first issues](http

The PyIceberg Project is hosted on GitHub at <https://github.com/apache/iceberg-python>.

For the development, Poetry is used for packing and dependency management. You can install this using:
For the development, uv is used for packing and dependency management. You can install this using:

```bash
make install-poetry
make install-uv
```

To get started, you can run `make install`, which installs all the dependencies of the Iceberg library. This also installs the development dependencies. If you don't want to install the development dependencies, you need to install using `poetry install --without dev` instead of `make install`.
To get started, you can run `make install`, which installs all the dependencies of the Iceberg library. This also installs the development dependencies. If you don't want to install the development dependencies, you need to install using `uv sync --no-dev` instead of `make install`.

If you want to install the library on the host, you can simply run `pip3 install -e .`. If you wish to use a virtual environment, you can run `poetry shell`. Poetry will open up a virtual environment with all the dependencies set.
If you want to install the library on the host, you can simply run `pip3 install -e .`. If you wish to use a virtual environment, you can run `uv venv` to create one and then activate it.

> **Note:** If you want to use `poetry shell`, you need to install it using `pip install poetry-plugin-shell`. Alternatively, you can run commands directly with `poetry run`.
> **Note:** You can run commands directly with `uv run` to execute them in the project environment.

To set up IDEA with Poetry:
To set up IDEA with uv:

- Open up the Python project in IntelliJ
- Make sure that you're on latest main (that includes Poetry)
- Make sure that you're on latest main (that includes uv)
- Go to File -> Project Structure (⌘;)
- Go to Platform Settings -> SDKs
- Click the + sign -> Add Python SDK
- Select Poetry Environment from the left hand side bar and hit OK
- Select the uv virtual environment from the project directory and hit OK
- It can take some time to download all the dependencies based on your internet
- Go to Project Settings -> Project
- Select the Poetry SDK from the SDK dropdown, and click OK
- Select the uv SDK from the SDK dropdown, and click OK

For IDEA ≤2021 you need to install the [Poetry integration as a plugin](https://plugins.jetbrains.com/plugin/14307-poetry/).

Now you're set using Poetry, and all the tests will run in Poetry, and you'll have syntax highlighting in the pyproject.toml to indicate stale dependencies.
Now you're set using uv, and all the tests will run in uv, and you'll have dependency management through the pyproject.toml file.

## Installation from source

Expand Down
Loading
Loading