Skip to content
Merged
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
37 changes: 22 additions & 15 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
ARG PYTHON_VERSION=3.10-bullseye
FROM python:$PYTHON_VERSION

# Allow the vscode user to pip install globally w/o sudo
# ENV PIP_TARGET=/usr/local/pip-global
# ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH}
# ENV PATH=${PIP_TARGET}/bin:${PATH}
# RUN if ! cat /etc/group | grep -e "^pip-global:" > /dev/null 2>&1; then groupadd -r pip-global; fi \
# && usermod -a -G pip-global vscode \
# && umask 0002 && mkdir -p ${PIP_TARGET} \
# && chown :pip-global ${PIP_TARGET} \
# && ( [ ! -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 )

RUN pip install poetry
RUN poetry config virtualenvs.create false
ARG PYTHON_VERSION=3.13-bookworm
FROM python:${PYTHON_VERSION}

# Install system dependencies
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
git \
curl \
docker.io \
postgresql-client \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install UV
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.cargo/bin:$PATH"

# Set working directory
WORKDIR /workspace

# Configure git to trust the workspace
RUN git config --global --add safe.directory /workspace
36 changes: 22 additions & 14 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
{
"name": "Python 3",
"name": "PGMob Development",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"PYTHON_VERSION": "3.10-bullseye"
"PYTHON_VERSION": "3.13-bookworm"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
}
},
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.languageServer": "Default",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.languageServer": "Pylance",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
},
"files.eol": "\n",
"python.testing.pytestArgs": [
"src/tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"charliermarsh.ruff"
]
}
},
Expand All @@ -38,10 +47,9 @@
"mounts": [
"source=//var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "poetry install -E psycopg2",
"postCreateCommand": "uv sync --all-extras",
"initializeCommand": "docker network create pgmob-network || docker network inspect pgmob-network",
"runArgs": [
"--network=pgmob-network"
]
}
}
2 changes: 1 addition & 1 deletion .github/actions/bump-version/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Poetry Publish
name: UV Bump Version
description: Publish package to PyPI
branding:
icon: package
Expand Down
36 changes: 12 additions & 24 deletions .github/actions/publish/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Poetry Publish
name: UV Publish
description: Publish package to PyPI
branding:
icon: package
Expand All @@ -8,22 +8,10 @@ inputs:
PYTHON_VERSION:
description: Python version
required: false
default: 3.9
POETRY_VERSION:
description: Poetry version
required: false
default: 1.3.2
PYPI_USERNAME:
description: PyPI username. '__token__' by default
required: false
default: "__token__"
default: "3.13"
PYPI_TOKEN:
description: PyPI API token.
required: true
PYPI_REGISTRY:
description: PYPI registry address
required: false
default: https://upload.pypi.org/legacy/

runs:
using: "composite"
Expand All @@ -33,23 +21,23 @@ runs:
with:
ref: main

- name: Install poetry
run: pip install poetry==${{ inputs.POETRY_VERSION }}
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
shell: bash

- name: Add UV to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.PYTHON_VERSION }}
cache: 'poetry'

- name: Install poetry dependencies
run: |
poetry install -n
- name: Build package
run: uv build
shell: bash

- name: Build and Publish
run: |
poetry config repositories.publish ${{ inputs.PYPI_REGISTRY }}
poetry publish -n -u "${{ inputs.PYPI_USERNAME }}" -p "${{ inputs.PYPI_TOKEN }}" -r publish --build
- name: Publish to PyPI
run: uv publish --token "${{ inputs.PYPI_TOKEN }}"
shell: bash
23 changes: 10 additions & 13 deletions .github/actions/test-docs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ inputs:
PYTHON_VERSION:
description: Python version
required: false
default: 3.9
POETRY_VERSION:
description: Poetry version
required: false
default: 1.3.2
default: "3.13"
POSTGRES_VERSION:
description: Postgres major version to use
required: false
Expand All @@ -28,24 +24,25 @@ runs:
- name: Checkout
uses: actions/checkout@v3

- name: Install poetry
run: pip install poetry==${{ inputs.POETRY_VERSION }}
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
shell: bash

- name: Add UV to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.PYTHON_VERSION }}
cache: 'poetry'

- name: Install poetry dependencies
run: |
poetry install -n
- name: Install dependencies
run: uv sync
shell: bash
working-directory: docs

- name: Testing docs
run: |
poetry run -n make -b html
run: uv run make html
shell: bash
working-directory: docs
22 changes: 9 additions & 13 deletions .github/actions/test/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Poetry Test
name: UV Test
description: Run tests
branding:
icon: play-circle
Expand All @@ -8,12 +8,8 @@ inputs:
PYTHON_VERSION:
description: Python version
required: false
default: 3.9
POETRY_VERSION:
description: Poetry version
required: false
default: 1.3.2
POETRY_EXTRAS:
default: "3.13"
UV_EXTRAS:
description: PyPI extras to install
required: false
default: psycopg2-binary
Expand Down Expand Up @@ -41,19 +37,19 @@ runs:
run: >
docker build . -t pgmobtest
--build-arg PYTHON_VERSION=${{ inputs.PYTHON_VERSION }}
--build-arg POETRY_VERSION=${{ inputs.POETRY_VERSION }}
--build-arg POETRY_EXTRAS=${{ inputs.POETRY_EXTRAS }}
--build-arg UV_EXTRAS=${{ inputs.UV_EXTRAS }}
shell: bash

- name: Run mypy tests
run: docker run --rm -i pgmobtest mypy src/pgmob
- name: Run ty type checks
run: docker run --rm -i pgmobtest uv run ty check src/pgmob
shell: bash

- name: Run poetry tests
- name: Run pytest tests
run: >
docker run --rm -i --network ${{ inputs.CONTAINER_NETWORK}}
-e PGMOB_IMAGE=postgres:${{ inputs.POSTGRES_VERSION }}
-e PGMOB_CONTAINER_NETWORK=${{ inputs.CONTAINER_NETWORK}}
-e PGMOB_HOST=pgmob-postgres
-v /var/run/docker.sock:/var/run/docker.sock
pgmobtest pytest -vv
pgmobtest uv run pytest -vv
shell: bash
1 change: 1 addition & 0 deletions .github/instructions/api-standards.md
1 change: 1 addition & 0 deletions .github/instructions/cicd-workflow.md
1 change: 1 addition & 0 deletions .github/instructions/code-conventions.md
1 change: 1 addition & 0 deletions .github/instructions/documentation-standards.md
1 change: 1 addition & 0 deletions .github/instructions/project-patterns.md
1 change: 1 addition & 0 deletions .github/instructions/security-guidelines.md
1 change: 1 addition & 0 deletions .github/instructions/testing-standards.md
1 change: 1 addition & 0 deletions .kiro/steering/api-standards.md
1 change: 1 addition & 0 deletions .kiro/steering/cicd-workflow.md
1 change: 1 addition & 0 deletions .kiro/steering/code-conventions.md
1 change: 1 addition & 0 deletions .kiro/steering/documentation-standards.md
1 change: 1 addition & 0 deletions .kiro/steering/project-patterns.md
1 change: 1 addition & 0 deletions .kiro/steering/security-guidelines.md
1 change: 1 addition & 0 deletions .kiro/steering/testing-standards.md
11 changes: 5 additions & 6 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.13"
jobs:
post_install:
- pip install uv
- cd docs && uv sync

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand All @@ -18,8 +22,3 @@ sphinx:
# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
31 changes: 25 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
{
"python.linting.pylintEnabled": false,
"python.linting.mypyEnabled": true,
"python.linting.enabled": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.languageServer": "Pylance",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
},
"files.eol": "\n",
"python.testing.pytestArgs": [
"src/tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"python.formatting.provider": "black",
}
"editor.rulers": [
110
],
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.exclude": {
"**/__pycache__": true,
"**/*.pyc": true,
"**/.pytest_cache": true,
"**/.ruff_cache": true,
"**/.mypy_cache": true,
"**/htmlcov": true,
"**/.coverage": true
}
}
Loading