Skip to content

feat: uv #3132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
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
20 changes: 9 additions & 11 deletions .github/workflows/cfn-nag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install Requirements
run: |
cd test_infra
python -m pip install --upgrade pip
python -m pip install poetry
poetry env use python
poetry env info
source $(poetry env info --path)/bin/activate
poetry install -vvv --no-root
- name: Rust latest
run: rustup update
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up cdk.json
run: |
cd test_infra
Expand All @@ -75,8 +72,9 @@ jobs:
- name: CDK Synth
run: |
cd test_infra
source $(poetry env info --path)/bin/activate
cdk synth
uv sync --frozen --no-install-project --verbose
uv run cdk synth
working-directory: ${{ github.workspace }}
- uses: stelligent/cfn_nag@master
with:
input_path: test_infra/cdk.out
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/minimal-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,24 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade Pip
run: python -m pip install --upgrade pip
- name: Install Poetry
run: python -m pip install poetry
- name: Rust latest
run: rustup update
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Requirements
run: |
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv
poetry install -vvv
run: uv sync --frozen --dev --verbose
working-directory: ${{ github.workspace }}
- name: Test Metadata
run: poetry run pytest tests/unit/test_metadata.py
run: uv run pytest tests/unit/test_metadata.py
working-directory: ${{ github.workspace }}
- name: Test Session
run: poetry run pytest tests/unit/test_session.py
run: uv run pytest tests/unit/test_session.py
working-directory: ${{ github.workspace }}
- name: Test Utils
run: poetry run pytest tests/unit/test_utils.py
run: uv run pytest tests/unit/test_utils.py
working-directory: ${{ github.workspace }}
- name: Test Moto
run: poetry run pytest -n 4 tests/unit/test_moto.py
run: uv run pytest -n 4 tests/unit/test_moto.py
working-directory: ${{ github.workspace }}
38 changes: 23 additions & 15 deletions .github/workflows/static-checking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,27 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Rust latest
run: rustup update
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Requirements
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry config virtualenvs.create false --local
poetry install --all-extras -vvv
- name: ruff format check
run: ruff format --check .
- name: ruff check
run: ruff check --output-format=github .
- name: mypy check
run: mypy --install-types --non-interactive awswrangler
- name: Documentation check
run: doc8 --max-line-length 120 docs/source
- name: Check poetry.lock consistency with pyproject.toml
run: poetry check --lock
run: uv sync --frozen --all-extras --dev --verbose
working-directory: ${{ github.workspace }}
- name: Run ruff format
run: uv run ruff format --check .
working-directory: ${{ github.workspace }}
- name: Run ruff check
run: uv run ruff check --output-format=github .
working-directory: ${{ github.workspace }}
- name: Run mypy check
run: uv run mypy --install-types --non-interactive awswrangler
working-directory: ${{ github.workspace }}
- name: Run documentation check
run: uv run doc8 --max-line-length 120 docs/source
working-directory: ${{ github.workspace }}
- name: Run uv lock check
run: uv lock --check
working-directory: ${{ github.workspace }}
2 changes: 1 addition & 1 deletion building/build-lambda-layers.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -ex

VERSION=$(poetry version --short)
VERSION=$(uv version --short)
DIR_NAME=$(dirname "$PWD")

PYTHON_VERSION=${1:-ALL}
Expand Down
2 changes: 1 addition & 1 deletion building/build-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -ex

pushd ..
rm -rf dist/*.whl
poetry build -f wheel
uv build --wheel
15 changes: 9 additions & 6 deletions building/lambda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ RUN ln -s /usr/bin/gcc10-mpn /usr/bin/mpn
RUN ln -s /usr/bin/gcc10-ld /usr/bin/ld

FROM ${python_version}
COPY pyproject.toml poetry.lock ./
COPY pyproject.toml uv.lock ./

RUN pip3 install --upgrade pip wheel setuptools>=64 setuptools_scm>=8
RUN pip3 install --upgrade urllib3==1.26.16 # temporary to avoid https://github.com/urllib3/urllib3/issues/2168 (TODO remove when the AL2 image updates to support OpenSSL 1.1.1+)
RUN pip3 install --upgrade six cython cmake hypothesis poetry
ENV PIP_NO_BINARY="numpy,pandas"
RUN poetry config virtualenvs.create false --local && poetry install --no-root --only main

RUN rm -f pyproject.toml poetry.lock
RUN pip3 install --upgrade six cython cmake==3.31.6 hypothesis uv
# ENV PIP_NO_BINARY="numpy,pandas"
# RUN poetry config virtualenvs.create false --local && poetry install --no-root --only main
RUN uv sync --frozen --no-dev --no-install-project \
--no-binary-package numpy \
--no-binary-package pandas

RUN rm -f pyproject.toml uv.lock

ENTRYPOINT ["/bin/sh"]
11 changes: 7 additions & 4 deletions building/lambda/Dockerfile.al2023
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ RUN dnf install -y \
WORKDIR /root

FROM ${python_version}
COPY pyproject.toml poetry.lock ./
COPY pyproject.toml uv.lock ./

RUN pip3 install --upgrade pip wheel setuptools>=64 setuptools_scm>=8
RUN pip3 install --upgrade six cython cmake hypothesis poetry
ENV PIP_NO_BINARY="numpy,pandas"
RUN poetry config virtualenvs.create false --local && poetry install --no-root --only main
# ENV PIP_NO_BINARY="numpy,pandas"
# RUN poetry config virtualenvs.create false --local && poetry install --no-root --only main
RUN uv sync --frozen --no-dev --no-install-project \
--no-binary-package numpy \
--no-binary-package pandas

RUN rm -f pyproject.toml poetry.lock
RUN rm -f pyproject.toml uv.lock

ENTRYPOINT ["/bin/sh"]
4 changes: 2 additions & 2 deletions building/lambda/build-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -ex

cp ../../pyproject.toml .
cp ../../poetry.lock .
cp ../../uv.lock .

export DOCKER_BUILDKIT=1

Expand Down Expand Up @@ -60,4 +60,4 @@ then
.
fi

rm -rf pyproject.toml poetry.lock
rm -rf pyproject.toml uv.lock
6 changes: 3 additions & 3 deletions building/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -ex

pushd ..
rm -fr dist
poetry publish --build
rm -fr dist
rm -rf dist/*.whl
uv build --wheel
uv publish dist/*.whl
Loading