Skip to content

Commit b093efe

Browse files
Copilotjason810496
andcommitted
Replace poetry with uv across the project
Co-authored-by: jason810496 <[email protected]>
1 parent 7df481e commit b093efe

8 files changed

Lines changed: 2073 additions & 1683 deletions

File tree

.github/workflows/codecov.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,20 @@ jobs:
2323
uses: actions/setup-python@v5
2424
with:
2525
python-version: ${{ matrix.python-version }}
26-
# Install dependencies
27-
- name: Install dependencies
28-
run: |
29-
pip install poetry
30-
- name: Set poetry python version
26+
# Install uv
27+
- name: Install uv
3128
run: |
32-
poetry env use python${{ matrix.python-version }}
29+
curl -LsSf https://astral.sh/uv/install.sh | sh
30+
echo "$HOME/.local/bin" >> $GITHUB_PATH
3331
- name: Install dependencies
34-
run: poetry install --with dev
32+
run: uv sync --extra dev
3533
- name: Start PostgreSQL
3634
run: |
3735
cp pgmq_postgres.template.env pgmq_postgres.env
3836
cp pgmq_tests.template.env pgmq_tests.env
3937
make start-db
4038
- name: Run tests and collect coverage
41-
run: poetry run pytest tests --cov=pgmq_sqlalchemy.queue --cov-report=xml -n auto tests
39+
run: uv run pytest tests --cov=pgmq_sqlalchemy.queue --cov-report=xml -n auto tests
4240
continue-on-error: true
4341
- name: Upload coverage reports to Codecov with GitHub Action
4442
uses: codecov/[email protected]

.github/workflows/publish.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,16 @@ jobs:
2626
with:
2727
python-version: "3.10"
2828

29-
- name: Install Poetry
29+
- name: Install uv
3030
run: |
31-
curl -sSL https://install.python-poetry.org | python - -y
32-
33-
- name: Update PATH
34-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
35-
36-
- name: Update Poetry configuration
37-
run: poetry config virtualenvs.create false
31+
curl -LsSf https://astral.sh/uv/install.sh | sh
32+
echo "$HOME/.local/bin" >> $GITHUB_PATH
3833
3934
- name: Install dependencies
40-
run: poetry install --sync --no-interaction --without=dev
35+
run: uv sync --no-dev
4136

4237
- name: Package project
43-
run: poetry build
38+
run: uv build
4439

4540
- name: Publish package distributions to PyPI
4641
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,8 @@ ipython_config.py
9494
# install all needed dependencies.
9595
#Pipfile.lock
9696

97-
# poetry
98-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
97+
# poetry - replaced by uv
98+
poetry.lock
10399

104100
# pdm
105101
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.

Dockerfile

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,42 @@ ENV PYTHONUNBUFFERED=1 \
88
PIP_DISABLE_PIP_VERSION_CHECK=on \
99
PIP_DEFAULT_TIMEOUT=100 \
1010
\
11-
# poetry
12-
# https://python-poetry.org/docs/configuration/#using-environment-variables
13-
POETRY_VERSION=1.3.2 \
14-
# make poetry install to this location
15-
POETRY_HOME="/opt/poetry" \
16-
# make poetry create the virtual environment in the project's root
17-
# it gets named `.venv`
18-
POETRY_VIRTUALENVS_IN_PROJECT=true \
19-
# do not ask any interactive question
20-
POETRY_NO_INTERACTION=1 \
21-
\
2211
# paths
2312
# this is where our requirements + virtual environment will live
2413
PYSETUP_PATH="/opt/pysetup" \
2514
VENV_PATH="/opt/pysetup/.venv"
2615

2716

28-
# prepend poetry and venv to path
29-
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
17+
# prepend venv to path
18+
ENV PATH="$VENV_PATH/bin:$PATH"
3019

3120
FROM python-base as builder-base
3221
RUN apt-get update \
3322
&& apt-get install --no-install-recommends -y \
34-
# deps for installing poetry
23+
# deps for installing uv
3524
curl \
3625
# deps for building python deps
3726
build-essential
3827

39-
# install poetry - respects $POETRY_VERSION & $POETRY_HOME
40-
# The --mount will mount the buildx cache directory to where
41-
# Poetry and Pip store their cache so that they can re-use it
28+
# install uv
4229
RUN --mount=type=cache,target=/root/.cache \
43-
curl -sSL https://install.python-poetry.org | python3 -
30+
curl -LsSf https://astral.sh/uv/install.sh | sh
31+
32+
ENV PATH="/root/.local/bin:$PATH"
4433

4534
# copy project requirement files here to ensure they will be cached.
4635
WORKDIR $PYSETUP_PATH
47-
COPY poetry.lock pyproject.toml ./
36+
COPY pyproject.toml ./
4837

49-
# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
38+
# install runtime deps
5039
RUN --mount=type=cache,target=/root/.cache \
51-
poetry install --with=dev
40+
uv venv $VENV_PATH && \
41+
uv pip install --python=$VENV_PATH -e .[dev]
5242

5343
FROM python:3.12-slim-bookworm as runtime
5444

55-
ENV POETRY_HOME="/opt/poetry" \
56-
VENV_PATH="/opt/pysetup/.venv"
57-
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
45+
ENV VENV_PATH="/opt/pysetup/.venv"
46+
ENV PATH="$VENV_PATH/bin:$PATH"
5847

5948
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
6049
COPY ./pgmq_sqlalchemy /pgmq_sqlalchemy_test/pgmq_sqlalchemy

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
install: ## Install dependencies and `ruff` pre-commit hooks
44
pre-commit install
5-
poetry install --with dev
5+
uv sync --extra dev
66

77
build: ## Build the package
8-
poetry build
8+
uv build
99

1010
test-local: ## Run tests locally
11-
poetry run pytest tests --cov=pgmq_sqlalchemy.queue
11+
uv run pytest tests --cov=pgmq_sqlalchemy.queue
1212

1313

1414
test-docker-rebuild: ## Rebuild the docker image
@@ -38,10 +38,10 @@ exec-db: ## Enter the database container
3838
docker compose exec pgmq_postgres psql -U postgres -d postgres
3939

4040
doc-build: ## Build the documentation
41-
cd doc && poetry run sphinx-build -nW . _build
41+
cd doc && uv run sphinx-build -nW . _build
4242

4343
doc-serve: doc-clean ## Serve the documentation
44-
cd doc && poetry run sphinx-autobuild -nW . _build
44+
cd doc && uv run sphinx-autobuild -nW . _build
4545

4646
doc-clean: ## Clean the documentation
4747
cd doc && rm -r _build

0 commit comments

Comments
 (0)