Skip to content

Commit 18b8198

Browse files
committed
Merge branch 'feature/uv-ruff-ty' into develop
2 parents d53dbc4 + fde5cef commit 18b8198

File tree

92 files changed

+5473
-1766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+5473
-1766
lines changed

.devcontainer/Dockerfile

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
ARG PYTHON_VERSION=3.10-bullseye
2-
FROM python:$PYTHON_VERSION
3-
4-
# Allow the vscode user to pip install globally w/o sudo
5-
# ENV PIP_TARGET=/usr/local/pip-global
6-
# ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH}
7-
# ENV PATH=${PIP_TARGET}/bin:${PATH}
8-
# RUN if ! cat /etc/group | grep -e "^pip-global:" > /dev/null 2>&1; then groupadd -r pip-global; fi \
9-
# && usermod -a -G pip-global vscode \
10-
# && umask 0002 && mkdir -p ${PIP_TARGET} \
11-
# && chown :pip-global ${PIP_TARGET} \
12-
# && ( [ ! -f "/etc/profile.d/00-restore-env.sh" ] || sed -i -e "s/export PATH=/export PATH=\/usr\/local\/pip-global:/" /etc/profile.d/00-restore-env.sh )
13-
14-
RUN pip install poetry
15-
RUN poetry config virtualenvs.create false
1+
ARG PYTHON_VERSION=3.11-bullseye
2+
FROM python:${PYTHON_VERSION}
3+
4+
# Install system dependencies
5+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6+
&& apt-get -y install --no-install-recommends \
7+
git \
8+
curl \
9+
docker.io \
10+
postgresql-client \
11+
&& apt-get clean \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
# Install UV
15+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
16+
ENV PATH="/root/.cargo/bin:$PATH"
17+
18+
# Set working directory
19+
WORKDIR /workspace
20+
21+
# Configure git to trust the workspace
22+
RUN git config --global --add safe.directory /workspace

.devcontainer/devcontainer.json

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
11
{
2-
"name": "Python 3",
2+
"name": "PGMob Development",
33
"build": {
44
"dockerfile": "Dockerfile",
55
"context": "..",
66
"args": {
7-
"PYTHON_VERSION": "3.10-bullseye"
7+
"PYTHON_VERSION": "3.11-bullseye"
88
}
99
},
10-
// Configure tool-specific properties.
1110
"customizations": {
12-
// Configure properties specific to VS Code.
1311
"vscode": {
14-
// Set *default* container specific settings.json values on container create.
1512
"settings": {
1613
"terminal.integrated.profiles.linux": {
1714
"bash": {
1815
"path": "/bin/bash"
1916
}
2017
},
21-
"python.defaultInterpreterPath": "/usr/local/bin/python",
22-
"python.languageServer": "Default",
23-
"python.linting.enabled": true,
24-
"python.linting.pylintEnabled": true
18+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
19+
"python.languageServer": "Pylance",
20+
"[python]": {
21+
"editor.defaultFormatter": "charliermarsh.ruff",
22+
"editor.formatOnSave": true,
23+
"editor.codeActionsOnSave": {
24+
"source.fixAll.ruff": "explicit",
25+
"source.organizeImports.ruff": "explicit"
26+
}
27+
},
28+
"files.eol": "\n",
29+
"python.testing.pytestArgs": [
30+
"src/tests"
31+
],
32+
"python.testing.unittestEnabled": false,
33+
"python.testing.pytestEnabled": true
2534
},
26-
// Add the IDs of extensions you want installed when the container is created.
2735
"extensions": [
2836
"ms-python.python",
29-
"ms-python.vscode-pylance"
37+
"ms-python.vscode-pylance",
38+
"charliermarsh.ruff"
3039
]
3140
}
3241
},
@@ -38,10 +47,9 @@
3847
"mounts": [
3948
"source=//var/run/docker.sock,target=/var/run/docker.sock,type=bind"
4049
],
41-
// Use 'postCreateCommand' to run commands after the container is created.
42-
"postCreateCommand": "poetry install -E psycopg2",
50+
"postCreateCommand": "uv sync --all-extras",
4351
"initializeCommand": "docker network create pgmob-network || docker network inspect pgmob-network",
4452
"runArgs": [
4553
"--network=pgmob-network"
4654
]
47-
}
55+
}

.github/actions/bump-version/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Poetry Publish
1+
name: UV Bump Version
22
description: Publish package to PyPI
33
branding:
44
icon: package
Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Poetry Publish
1+
name: UV Publish
22
description: Publish package to PyPI
33
branding:
44
icon: package
@@ -9,21 +9,9 @@ inputs:
99
description: Python version
1010
required: false
1111
default: 3.9
12-
POETRY_VERSION:
13-
description: Poetry version
14-
required: false
15-
default: 1.3.2
16-
PYPI_USERNAME:
17-
description: PyPI username. '__token__' by default
18-
required: false
19-
default: "__token__"
2012
PYPI_TOKEN:
2113
description: PyPI API token.
2214
required: true
23-
PYPI_REGISTRY:
24-
description: PYPI registry address
25-
required: false
26-
default: https://upload.pypi.org/legacy/
2715

2816
runs:
2917
using: "composite"
@@ -33,23 +21,23 @@ runs:
3321
with:
3422
ref: main
3523

36-
- name: Install poetry
37-
run: pip install poetry==${{ inputs.POETRY_VERSION }}
24+
- name: Install UV
25+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
26+
shell: bash
27+
28+
- name: Add UV to PATH
29+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
3830
shell: bash
3931

4032
- name: Setup python
4133
uses: actions/setup-python@v4
4234
with:
4335
python-version: ${{ inputs.PYTHON_VERSION }}
44-
cache: 'poetry'
4536

46-
- name: Install poetry dependencies
47-
run: |
48-
poetry install -n
37+
- name: Build package
38+
run: uv build
4939
shell: bash
5040

51-
- name: Build and Publish
52-
run: |
53-
poetry config repositories.publish ${{ inputs.PYPI_REGISTRY }}
54-
poetry publish -n -u "${{ inputs.PYPI_USERNAME }}" -p "${{ inputs.PYPI_TOKEN }}" -r publish --build
41+
- name: Publish to PyPI
42+
run: uv publish --token "${{ inputs.PYPI_TOKEN }}"
5543
shell: bash

.github/actions/test-docs/action.yaml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ inputs:
99
description: Python version
1010
required: false
1111
default: 3.9
12-
POETRY_VERSION:
13-
description: Poetry version
14-
required: false
15-
default: 1.3.2
1612
POSTGRES_VERSION:
1713
description: Postgres major version to use
1814
required: false
@@ -28,24 +24,25 @@ runs:
2824
- name: Checkout
2925
uses: actions/checkout@v3
3026

31-
- name: Install poetry
32-
run: pip install poetry==${{ inputs.POETRY_VERSION }}
27+
- name: Install UV
28+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
29+
shell: bash
30+
31+
- name: Add UV to PATH
32+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
3333
shell: bash
3434

3535
- name: Setup python
3636
uses: actions/setup-python@v4
3737
with:
3838
python-version: ${{ inputs.PYTHON_VERSION }}
39-
cache: 'poetry'
4039

41-
- name: Install poetry dependencies
42-
run: |
43-
poetry install -n
40+
- name: Install dependencies
41+
run: uv sync
4442
shell: bash
4543
working-directory: docs
4644

4745
- name: Testing docs
48-
run: |
49-
poetry run -n make -b html
46+
run: uv run make html
5047
shell: bash
5148
working-directory: docs

.github/actions/test/action.yaml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Poetry Test
1+
name: UV Test
22
description: Run tests
33
branding:
44
icon: play-circle
@@ -9,11 +9,7 @@ inputs:
99
description: Python version
1010
required: false
1111
default: 3.9
12-
POETRY_VERSION:
13-
description: Poetry version
14-
required: false
15-
default: 1.3.2
16-
POETRY_EXTRAS:
12+
UV_EXTRAS:
1713
description: PyPI extras to install
1814
required: false
1915
default: psycopg2-binary
@@ -41,19 +37,18 @@ runs:
4137
run: >
4238
docker build . -t pgmobtest
4339
--build-arg PYTHON_VERSION=${{ inputs.PYTHON_VERSION }}
44-
--build-arg POETRY_VERSION=${{ inputs.POETRY_VERSION }}
45-
--build-arg POETRY_EXTRAS=${{ inputs.POETRY_EXTRAS }}
40+
--build-arg UV_EXTRAS=${{ inputs.UV_EXTRAS }}
4641
shell: bash
4742

48-
- name: Run mypy tests
49-
run: docker run --rm -i pgmobtest mypy src/pgmob
43+
- name: Run ty type checks
44+
run: docker run --rm -i pgmobtest uv run ty check src/pgmob
5045
shell: bash
5146

52-
- name: Run poetry tests
47+
- name: Run pytest tests
5348
run: >
5449
docker run --rm -i --network ${{ inputs.CONTAINER_NETWORK}}
5550
-e PGMOB_IMAGE=postgres:${{ inputs.POSTGRES_VERSION }}
5651
-e PGMOB_CONTAINER_NETWORK=${{ inputs.CONTAINER_NETWORK}}
5752
-v /var/run/docker.sock:/var/run/docker.sock
58-
pgmobtest pytest -vv
53+
pgmobtest uv run pytest -vv
5954
shell: bash
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.windsurf/rules/api-standards.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.windsurf/rules/cicd-workflow.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.windsurf/rules/code-conventions.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.windsurf/rules/documentation-standards.md

0 commit comments

Comments
 (0)