Skip to content

Commit 5fca7d2

Browse files
authored
feat: uv (#3132)
* feat: uv * update workflows * [skip-ci] move test infra to uv * [skip-ci] update workflows * [skip ci] update workflows * [skip ci] update layer scripts * [skip ci] update uv.lock * [skip ci] update dockerfiles * update tox.ini * fixes * [skip ci] update node version
1 parent 8208ece commit 5fca7d2

16 files changed

+5902
-513
lines changed

.github/workflows/cfn-nag.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Use Node.js
2929
uses: actions/setup-node@v4
3030
with:
31-
node-version: 16
31+
node-version: 18
3232
- name: Cache Node.js modules
3333
uses: actions/cache@v4
3434
with:
@@ -46,15 +46,12 @@ jobs:
4646
uses: actions/setup-python@v5
4747
with:
4848
python-version: 3.11
49-
- name: Install Requirements
50-
run: |
51-
cd test_infra
52-
python -m pip install --upgrade pip
53-
python -m pip install poetry
54-
poetry env use python
55-
poetry env info
56-
source $(poetry env info --path)/bin/activate
57-
poetry install -vvv --no-root
49+
- name: Rust latest
50+
run: rustup update
51+
- name: Install uv
52+
uses: astral-sh/setup-uv@v5
53+
with:
54+
enable-cache: true
5855
- name: Set up cdk.json
5956
run: |
6057
cd test_infra
@@ -75,8 +72,9 @@ jobs:
7572
- name: CDK Synth
7673
run: |
7774
cd test_infra
78-
source $(poetry env info --path)/bin/activate
79-
cdk synth
75+
uv sync --frozen --no-install-project --verbose
76+
uv run cdk synth
77+
working-directory: ${{ github.workspace }}
8078
- uses: stelligent/cfn_nag@master
8179
with:
8280
input_path: test_infra/cdk.out

.github/workflows/minimal-tests.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,24 @@ jobs:
3434
uses: actions/setup-python@v5
3535
with:
3636
python-version: ${{ matrix.python-version }}
37-
- name: Upgrade Pip
38-
run: python -m pip install --upgrade pip
39-
- name: Install Poetry
40-
run: python -m pip install poetry
37+
- name: Rust latest
38+
run: rustup update
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v5
41+
with:
42+
enable-cache: true
4143
- name: Install Requirements
42-
run: |
43-
poetry config virtualenvs.in-project true
44-
poetry config virtualenvs.path .venv
45-
poetry install -vvv
44+
run: uv sync --frozen --dev --verbose
45+
working-directory: ${{ github.workspace }}
4646
- name: Test Metadata
47-
run: poetry run pytest tests/unit/test_metadata.py
47+
run: uv run pytest tests/unit/test_metadata.py
48+
working-directory: ${{ github.workspace }}
4849
- name: Test Session
49-
run: poetry run pytest tests/unit/test_session.py
50+
run: uv run pytest tests/unit/test_session.py
51+
working-directory: ${{ github.workspace }}
5052
- name: Test Utils
51-
run: poetry run pytest tests/unit/test_utils.py
53+
run: uv run pytest tests/unit/test_utils.py
54+
working-directory: ${{ github.workspace }}
5255
- name: Test Moto
53-
run: poetry run pytest -n 4 tests/unit/test_moto.py
56+
run: uv run pytest -n 4 tests/unit/test_moto.py
57+
working-directory: ${{ github.workspace }}

.github/workflows/static-checking.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,27 @@ jobs:
2626
uses: actions/setup-python@v5
2727
with:
2828
python-version: ${{ matrix.python-version }}
29+
- name: Rust latest
30+
run: rustup update
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v5
33+
with:
34+
enable-cache: true
2935
- name: Install Requirements
30-
run: |
31-
python -m pip install --upgrade pip
32-
python -m pip install poetry
33-
poetry config virtualenvs.create false --local
34-
poetry install --all-extras -vvv
35-
- name: ruff format check
36-
run: ruff format --check .
37-
- name: ruff check
38-
run: ruff check --output-format=github .
39-
- name: mypy check
40-
run: mypy --install-types --non-interactive awswrangler
41-
- name: Documentation check
42-
run: doc8 --max-line-length 120 docs/source
43-
- name: Check poetry.lock consistency with pyproject.toml
44-
run: poetry check --lock
36+
run: uv sync --frozen --all-extras --dev --verbose
37+
working-directory: ${{ github.workspace }}
38+
- name: Run ruff format
39+
run: uv run ruff format --check .
40+
working-directory: ${{ github.workspace }}
41+
- name: Run ruff check
42+
run: uv run ruff check --output-format=github .
43+
working-directory: ${{ github.workspace }}
44+
- name: Run mypy check
45+
run: uv run mypy --install-types --non-interactive awswrangler
46+
working-directory: ${{ github.workspace }}
47+
- name: Run documentation check
48+
run: uv run doc8 --max-line-length 120 docs/source
49+
working-directory: ${{ github.workspace }}
50+
- name: Run uv lock check
51+
run: uv lock --check
52+
working-directory: ${{ github.workspace }}

building/build-lambda-layers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -ex
33

4-
VERSION=$(poetry version --short)
4+
VERSION=$(uv version --short)
55
DIR_NAME=$(dirname "$PWD")
66

77
PYTHON_VERSION=${1:-ALL}

building/build-wheel.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ set -ex
33

44
pushd ..
55
rm -rf dist/*.whl
6-
poetry build -f wheel
6+
uv build --wheel

building/lambda/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN ln -s /usr/bin/gcc10-mpn /usr/bin/mpn
3232
RUN ln -s /usr/bin/gcc10-ld /usr/bin/ld
3333

3434
FROM ${python_version}
35-
COPY pyproject.toml poetry.lock ./
35+
COPY pyproject.toml uv.lock ./
3636

3737
# Setuptools is a build dependency of arrow and runtime dependency of some of our dependencies (mainly redshift-connector).
3838
# Remove when arrow version shipped with lambda layers and dependencies are updated.
@@ -41,10 +41,14 @@ RUN pip3 install --upgrade urllib3==1.26.16 # temporary to avoid https://github
4141
# In new CMake 4, compatibility with CMake < 3.5 has been removed.
4242
# Unpin CMake when arrow version shipped with lambda layers is updated.
4343
RUN pip3 install --upgrade cmake==3.31.6
44-
RUN pip3 install --upgrade six cython hypothesis poetry
44+
RUN pip3 install --upgrade six cython hypothesis uv
45+
4546
ENV PIP_NO_BINARY="numpy,pandas"
46-
RUN poetry config virtualenvs.create false --local && poetry install --no-root --only main
47+
ENV UV_PROJECT_ENVIRONMENT="/var/lang"
48+
RUN uv sync --frozen --inexact --no-dev --no-install-project \
49+
--no-binary-package numpy \
50+
--no-binary-package pandas
4751

48-
RUN rm -f pyproject.toml poetry.lock
52+
RUN rm -f pyproject.toml uv.lock
4953

5054
ENTRYPOINT ["/bin/sh"]

building/lambda/Dockerfile.al2023

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@ RUN dnf install -y \
2121
WORKDIR /root
2222

2323
FROM ${python_version}
24-
COPY pyproject.toml poetry.lock ./
24+
COPY pyproject.toml uv.lock ./
2525

2626
# Setuptools is a build dependency of arrow and runtime dependency of some of our dependencies (mainly redshift-connector).
2727
# Remove when arrow version shipped with lambda layers and dependencies are updated.
2828
RUN pip3 install --upgrade pip wheel setuptools>=78.1.1 setuptools_scm>=8
2929
# In new CMake 4, compatibility with CMake < 3.5 has been removed.
3030
# Unpin CMake when arrow version shipped with lambda layers is updated.
3131
RUN pip3 install --upgrade cmake==3.31.6
32-
RUN pip3 install --upgrade six cython hypothesis poetry
32+
RUN pip3 install --upgrade six cython hypothesis uv
3333

3434
ENV PIP_NO_BINARY="numpy,pandas"
35-
RUN poetry config virtualenvs.create false --local && poetry install --no-root --only main
35+
ENV UV_PROJECT_ENVIRONMENT="/var/lang"
36+
RUN uv sync --frozen --inexact --no-dev --no-install-project \
37+
--no-binary-package numpy \
38+
--no-binary-package pandas
3639

37-
RUN rm -f pyproject.toml poetry.lock
40+
RUN rm -f pyproject.toml uv.lock
3841

3942
ENTRYPOINT ["/bin/sh"]

building/lambda/build-docker-images.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -ex
33

44
cp ../../pyproject.toml .
5-
cp ../../poetry.lock .
5+
cp ../../uv.lock .
66

77
export DOCKER_BUILDKIT=1
88

@@ -60,4 +60,4 @@ then
6060
.
6161
fi
6262

63-
rm -rf pyproject.toml poetry.lock
63+
rm -rf pyproject.toml uv.lock

building/publish.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
set -ex
33

44
pushd ..
5-
rm -fr dist
6-
poetry publish --build
7-
rm -fr dist
5+
rm -rf dist/*.whl
6+
uv build --wheel
7+
uv publish dist/*.whl

0 commit comments

Comments
 (0)