Skip to content

Commit eb3c2b9

Browse files
committed
Add support for UV dependency management
1 parent a9cb58b commit eb3c2b9

16 files changed

+5417
-7155
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
version: 2
2121
updates:
22-
- package-ecosystem: "pip"
22+
- package-ecosystem: "uv"
2323
directory: "/"
2424
schedule:
2525
interval: "weekly"

.github/workflows/nightly-pypi-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ jobs:
3939
with:
4040
python-version: 3.12
4141

42-
- name: Install Poetry
43-
run: make install-poetry
42+
- name: Install UV
43+
uses: astral-sh/setup-uv@v6
4444

4545
- name: Set version
4646
id: set-version
4747
run: |
48-
CURRENT_VERSION=$(poetry version --short)
48+
CURRENT_VERSION=$(uv version --short)
4949
TIMESTAMP=$(date +%Y%m%d%H%M%S)
5050
echo "VERSION=${CURRENT_VERSION}.dev${TIMESTAMP}" >> "$GITHUB_OUTPUT"
5151

.github/workflows/pypi-build-artifacts.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ jobs:
4646
3.11
4747
3.12
4848
49-
- name: Install poetry
50-
run: make install-poetry
49+
- name: Install UV
50+
uses: astral-sh/setup-uv@v6
5151

5252
- name: Set version with RC
5353
env:
5454
VERSION: ${{ inputs.VERSION }}
55-
run: python -m poetry version "${{ env.VERSION }}"
55+
run: uv version "${{ env.VERSION }}"
5656

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

6363
- name: Build wheels
@@ -70,13 +70,15 @@ jobs:
7070
CIBW_ARCHS: "auto64"
7171
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"
7272
CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==5.0.1"
73-
CIBW_TEST_COMMAND: "pytest {project}/tests/avro/test_decoder.py"
73+
CIBW_TEST_COMMAND: "PYTHON_GIL=1 pytest {project}/tests/avro/test_decoder.py"
74+
CIBW_BUILD_VERBOSITY: 1
7475
# Ignore tests for pypy since not all dependencies are compiled for it
7576
# and would require a local rust build chain
7677
CIBW_TEST_SKIP: "pp*"
7778
# Skip free-threaded (PEP 703) builds until we evaluate decoder_fast support
7879
CIBW_SKIP: "cp3*t-*"
7980

81+
8082
- name: Add source distribution
8183
if: startsWith(matrix.os, 'ubuntu')
8284
run: ls -lah dist/* && cp dist/* wheelhouse/

.github/workflows/python-ci-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
- uses: actions/setup-python@v6
4040
with:
4141
python-version: 3.12
42-
- name: Install poetry
43-
run: make install-poetry
42+
- name: Install UV
43+
uses: astral-sh/setup-uv@v6
4444
- name: Install
4545
run: make docs-install
4646
- name: Build docs

.github/workflows/python-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ jobs:
5454
- uses: actions/setup-python@v6
5555
with:
5656
python-version: ${{ matrix.python }}
57-
- name: Install poetry
58-
run: make install-poetry
57+
- name: Install UV
58+
uses: astral-sh/setup-uv@v6
5959
- name: Install system dependencies
6060
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
6161
- name: Install

.github/workflows/python-release-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
- uses: actions/setup-python@v6
3535
with:
3636
python-version: ${{ matrix.python }}
37-
- name: Install poetry
38-
run: make install-poetry
37+
- name: Install UV
38+
uses: astral-sh/setup-uv@v6
3939
- name: Install docs
4040
run: make docs-install
4141
- name: Build docs

.github/workflows/python-release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,20 @@ jobs:
9797
with:
9898
python-version: 3.12
9999

100-
- name: Install Poetry
101-
run: make install-poetry
100+
- name: Install UV
101+
uses: astral-sh/setup-uv@v6
102102

103103
- name: Validate current pyiceberg version
104104
env:
105105
VERSION: ${{ needs.validate-inputs.outputs.VERSION }}
106106
run: |
107-
# Extract the current version from Poetry
108-
current_pyiceberg_version=$(poetry version --short)
109-
echo "Detected Poetry version: $current_pyiceberg_version"
107+
# Extract the current version from UV
108+
current_pyiceberg_version=$(uv version --short)
109+
echo "Detected UV version: $current_pyiceberg_version"
110110
111-
# Compare the input version with the Poetry version
111+
# Compare the input version with the UV version
112112
if [[ "$VERSION" != "$current_pyiceberg_version" ]]; then
113-
echo "Error: Input version ($VERSION) does not match the Poetry version ($current_pyiceberg_version)"
113+
echo "Error: Input version ($VERSION) does not match the UV version ($current_pyiceberg_version)"
114114
exit 1
115115
fi
116116

.github/workflows/svn-build-artifacts.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ jobs:
4646
3.11
4747
3.12
4848
49-
- name: Install poetry
50-
run: make install-poetry
49+
- name: Install UV
50+
uses: astral-sh/setup-uv@v6
5151

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

5858
- name: Build wheels

MANIFEST.in

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,37 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
graft src
18+
# Include important project files
19+
include README.md
20+
include LICENSE
21+
include NOTICE
22+
include Makefile
23+
include pyproject.toml
24+
include setup.py
25+
include uv.lock
26+
27+
# Cython source files
28+
recursive-include pyiceberg *.pyx *.pyi
29+
30+
# vendor packages
31+
recursive-include vendor *
32+
33+
# type stubs
34+
include pyiceberg/py.typed
35+
36+
# Include test files in sdist
37+
recursive-include tests *.py
38+
39+
# Include dev tools in sdist
40+
recursive-include dev *
41+
42+
# Exclude build artifacts
43+
global-exclude *.pyc
44+
global-exclude *.pyo
45+
global-exclude *.so
46+
global-exclude *.pyd
47+
global-exclude __pycache__
48+
prune .venv
49+
prune build
50+
prune dist
51+
prune *.egg-info

Makefile

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,23 @@
1818
# Configuration Variables
1919
# ========================
2020

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

26-
PIP = python -m pip
27-
28-
POETRY_VERSION = 2.2.1
29-
POETRY = python -m poetry
27+
# Set Python argument for uv commands if PYTHON is specified
28+
ifneq ($(PYTHON),)
29+
PYTHON_ARG = --python $(PYTHON)
30+
else
31+
PYTHON_ARG =
32+
endif
3033

3134
ifeq ($(COVERAGE),1)
32-
TEST_RUNNER = $(POETRY) run coverage run --parallel-mode --source=pyiceberg -m
35+
TEST_RUNNER = uv run coverage run --parallel-mode --source=pyiceberg -m
3336
else
34-
TEST_RUNNER = $(POETRY) run
37+
TEST_RUNNER = uv run
3538
endif
3639

3740
ifeq ($(KEEP_COMPOSE),1)
@@ -55,24 +58,26 @@ help: ## Display this help message
5558

5659
##@ Setup
5760

58-
install-poetry: ## Ensure Poetry is installed at the specified version
59-
@if ! command -v ${POETRY} &> /dev/null; then \
60-
echo "Poetry not found. Installing..."; \
61-
${PIP} install poetry==$(POETRY_VERSION); \
61+
install-uv: ## Ensure uv is installed
62+
@if ! command -v uv &> /dev/null; then \
63+
echo "uv not found. Installing..."; \
64+
curl -LsSf https://astral.sh/uv/install.sh | sh; \
65+
else \
66+
echo "uv is already installed."; \
67+
fi
68+
69+
setup-venv: ## Create virtual environment
70+
@if [ ! -d .venv ]; then \
71+
echo "Creating virtual environment."; \
72+
uv venv $(PYTHON_ARG); \
6273
else \
63-
INSTALLED_VERSION=$$(${PIP} show poetry | grep Version | awk '{print $$2}'); \
64-
if [ "$$INSTALLED_VERSION" != "$(POETRY_VERSION)" ]; then \
65-
echo "Updating Poetry to version $(POETRY_VERSION)..."; \
66-
${PIP} install --upgrade poetry==$(POETRY_VERSION); \
67-
else \
68-
echo "Poetry version $(POETRY_VERSION) already installed."; \
69-
fi; \
74+
echo "Virtual environment already exists."; \
7075
fi
7176

72-
install-dependencies: ## Install all dependencies including extras
73-
$(POETRY) install --all-extras
77+
install-dependencies: setup-venv ## Install all dependencies including extras
78+
uv sync --all-extras
7479

75-
install: install-poetry install-dependencies ## Install Poetry and dependencies
80+
install: install-uv install-dependencies ## Install uv and dependencies
7681

7782
# ===============
7883
# Code Validation
@@ -84,7 +89,7 @@ check-license: ## Check license headers
8489
./dev/check-license
8590

8691
lint: ## Run code linters via prek (pre-commit hooks)
87-
$(POETRY) run prek run -a
92+
uv run prek run -a
8893

8994
# ===============
9095
# Testing Section
@@ -101,7 +106,7 @@ test-integration-setup: ## Start Docker services for integration tests
101106
docker compose -f dev/docker-compose-integration.yml kill
102107
docker compose -f dev/docker-compose-integration.yml rm -f
103108
docker compose -f dev/docker-compose-integration.yml up -d --wait
104-
$(POETRY) run python dev/provision.py
109+
uv run python dev/provision.py
105110

106111
test-integration-exec: ## Run integration tests (excluding provision)
107112
$(TEST_RUNNER) pytest tests/ -m integration $(PYTEST_ARGS)
@@ -133,25 +138,25 @@ test-coverage: COVERAGE=1
133138
test-coverage: test test-integration test-s3 test-adls test-gcs coverage-report ## Run all tests with coverage and report
134139

135140
coverage-report: ## Combine and report coverage
136-
${POETRY} run coverage combine
137-
${POETRY} run coverage report -m --fail-under=$(COVERAGE_FAIL_UNDER)
138-
${POETRY} run coverage html
139-
${POETRY} run coverage xml
141+
uv run coverage combine
142+
uv run coverage report -m --fail-under=$(COVERAGE_FAIL_UNDER)
143+
uv run coverage html
144+
uv run coverage xml
140145

141146
# ================
142147
# Documentation
143148
# ================
144149

145150
##@ Documentation
146151

147-
docs-install: ## Install docs dependencies
148-
${POETRY} install --with docs
152+
docs-install: ## Install docs dependencies (included in default groups)
153+
uv sync --group docs
149154

150155
docs-serve: ## Serve local docs preview (hot reload)
151-
${POETRY} run mkdocs serve -f mkdocs/mkdocs.yml
156+
uv run mkdocs serve -f mkdocs/mkdocs.yml
152157

153158
docs-build: ## Build the static documentation site
154-
${POETRY} run mkdocs build -f mkdocs/mkdocs.yml --strict
159+
uv run mkdocs build -f mkdocs/mkdocs.yml --strict
155160

156161
# ===================
157162
# Project Maintenance
@@ -161,7 +166,7 @@ docs-build: ## Build the static documentation site
161166

162167
clean: ## Remove build artifacts and caches
163168
@echo "Cleaning up Cython and Python cached files..."
164-
@rm -rf build dist *.egg-info
169+
@rm -rf build dist *.egg-info .venv
165170
@find . -name "*.so" -exec echo Deleting {} \; -delete
166171
@find . -name "*.pyc" -exec echo Deleting {} \; -delete
167172
@find . -name "__pycache__" -exec echo Deleting {} \; -exec rm -rf {} +

0 commit comments

Comments
 (0)