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
20 changes: 15 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,31 @@
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
"ghcr.io/va-h/devcontainers-features/uv:1": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "poetry config virtualenvs.in-project true && poetry install --with dev --no-interaction && . .venv/bin/activate && pre-commit install && pre-commit install-hooks",
"postCreateCommand": "uv sync --all-groups && uv run prek install -f",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"yzhang.markdown-all-in-one"
"yzhang.markdown-all-in-one",
"charliermarsh.ruff"
],
"settings": {
"python.defaultInterpreterPath": "./.venv/bin/python"
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports.ruff": "explicit"
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: 2
updates:
- package-ecosystem: pip
- package-ecosystem: uv
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
time: "08:00"
open-pull-requests-limit: 10

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
time: "08:00"
open-pull-requests-limit: 10
26 changes: 14 additions & 12 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v6
Expand All @@ -25,30 +25,32 @@ jobs:
with:
python-version: "${{ matrix.python-version }}"

- name: Set up Poetry
uses: Gr1N/setup-poetry@v9
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Cache venv
uses: actions/cache@v5
with:
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}
key: venv-${{ hashFiles('**/uv.lock') }}

- name: Cache pre-commit
- name: Cache prek
uses: actions/cache@v5
with:
path: ~/.cache/pre-commit/
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/.pre-commit-config.yaml') }} # yamllint disable-line
path: ~/.cache/prek/
key: ${{ runner.os }}-prek-${{ hashFiles('**/uv.lock') }}-${{ hashFiles('**/.pre-commit-config.yaml') }} # yamllint disable-line

- name: Install dependencies
run: poetry install
run: uv sync --all-groups

- name: Register problems matchers
run: |
echo "::add-matcher::.github/workflows/matchers/pylint.json"
echo "::add-matcher::.github/workflows/matchers/flake8.json"
echo "::add-matcher::.github/workflows/matchers/mypy.json"
echo "::add-matcher::.github/workflows/matchers/python.json"

- name: Apply all pre-commit
run: poetry run pre-commit run -a
- name: Run prek (pre-commit checks)
env:
SKIP: ${{ github.ref == 'refs/heads/main' && 'no-commit-to-branch' || '' }}
run: uv run prek run --show-diff-on-failure --color=always --all-files
30 changes: 0 additions & 30 deletions .github/workflows/matchers/flake8.json

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/matchers/pylint.json

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: PR Labeler
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened]
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/publish-pypi-test.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ on:
jobs:
update_release_draft:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- name: Update release draft
uses: release-drafter/release-drafter@v6
uses: release-drafter/release-drafter@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 changes: 37 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This workflow will upload a Python Package using
# Poetry when a release is published
# This workflow will upload the package to PyPi when a release is published

name: Publish Python Package (PyPi)

Expand All @@ -13,32 +12,48 @@ jobs:
environment: release

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
# IMPORTANT: this permission is mandatory for trusted publishing via PyPi
id-token: write
contents: write

steps:
- uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Set up Poetry
uses: Gr1N/setup-poetry@v9
- name: Bump Poetry version
python-version: "3.x"

- name: Retrieve version from tag name
id: retrieve-version
run: |
tag=${{ github.event.release.tag_name }}
version_number=${tag#?}
poetry version $version_number
- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
message: "Bump version to ${{ github.event.release.tag_name }}"
add: "pyproject.toml"
ref: "main"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build package distribution
tag="${{ github.event.release.tag_name }}"
version_number="${tag#?}"
echo "version: $version_number"
echo "version=$version_number" >> "$GITHUB_OUTPUT"

- name: Bump project version in pyproject.toml and commit changes to current branch and tag
run: |
VERSION=${{ steps.retrieve-version.outputs.version }}
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION

git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

git add pyproject.toml
git commit -m "Bump package version to ${{ steps.retrieve-version.outputs.version }}."

git tag -f -a ${{ github.event.release.tag_name }} -m "Release ${{ steps.retrieve-version.outputs.version }}."
git push origin HEAD:main
git push origin -f ${{ github.event.release.tag_name }}
Comment thread
iMicknl marked this conversation as resolved.

- name: Build package
run: |
uv build

- name: Publish package to PyPI
run: |
poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uv publish
Comment thread
iMicknl marked this conversation as resolved.
62 changes: 31 additions & 31 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.14.10
hooks:
# Run the linter.
- id: ruff-check
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-json
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
exclude: .devcontainer
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: local
- id: check-yaml
- id: check-added-large-files
- id: no-commit-to-branch
stages: [pre-commit]
args: [--branch, main]
- repo: https://github.com/rhysd/actionlint
rev: v1.7.7
hooks:
- id: actionlint
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
types: [ python ]
- id: flake8
name: flake8
entry: flake8
language: system
types: [ python ]
- id: isort
name: isort
entry: isort
language: system
types: [ python ]
- id: pyupgrade
name: pyupgrade
entry: pyupgrade
args: ["--py37-plus"]
language: system
types: [ python ]
- id: mypy
name: mypy
entry: mypy
language: system
types: [ python ]
- id: pylint
name: pylint
entry: pylint
exclude: tests
- id: ty
name: ty check
entry: uv run ty check .
language: system
types: [ python ]
exclude: tests
Loading