Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
8f4353e
adjust toml
TonyXiang8787 Dec 4, 2025
e02652f
use dependency group
TonyXiang8787 Dec 4, 2025
8b31067
cibuildwheel
TonyXiang8787 Dec 4, 2025
246d942
build sdist
TonyXiang8787 Dec 4, 2025
9aa3d34
remove not needed setup python
TonyXiang8787 Dec 4, 2025
68da4f5
update sonar
TonyXiang8787 Dec 4, 2025
9aee66f
adjust linter
TonyXiang8787 Dec 4, 2025
db074f2
uv run
TonyXiang8787 Dec 4, 2025
e3cdbb3
update to latest version
TonyXiang8787 Dec 4, 2025
5291925
check-in lock
TonyXiang8787 Dec 4, 2025
00d5c2e
license header
TonyXiang8787 Dec 4, 2025
aa4e3b7
license for python version
TonyXiang8787 Dec 4, 2025
efa63a6
mypy use full install
TonyXiang8787 Dec 4, 2025
b68bfe7
fix readthedocs
TonyXiang8787 Dec 4, 2025
c142f1f
ignore some mypy error for now
TonyXiang8787 Dec 4, 2025
8f4f5b0
uv run
TonyXiang8787 Dec 4, 2025
92ec254
install all for docs
TonyXiang8787 Dec 4, 2025
cff982d
go back to pip
TonyXiang8787 Dec 4, 2025
027f0c9
remove uv
TonyXiang8787 Dec 4, 2025
7d4eae3
try uv in readthedocs
TonyXiang8787 Dec 4, 2025
128a8a4
add tools back
TonyXiang8787 Dec 4, 2025
b267024
Merge remote-tracking branch 'origin/main' into feature/enable-uv
TonyXiang8787 Dec 5, 2025
9ee5381
pin manually the same version
TonyXiang8787 Dec 5, 2025
661a473
try render
TonyXiang8787 Dec 5, 2025
9814283
try render
TonyXiang8787 Dec 5, 2025
db7ffc2
show diff
TonyXiang8787 Dec 5, 2025
6b9a907
fix naming
TonyXiang8787 Dec 5, 2025
d1ece89
fix naming
TonyXiang8787 Dec 5, 2025
244734d
try create pr
TonyXiang8787 Dec 5, 2025
a732116
try head ref
TonyXiang8787 Dec 5, 2025
5fb5d69
try main
TonyXiang8787 Dec 5, 2025
a99ba79
[skip ci] revert, the problem is not target
TonyXiang8787 Dec 5, 2025
cd2b4f8
change to v7
TonyXiang8787 Dec 5, 2025
326206c
retry
TonyXiang8787 Dec 5, 2025
0ba56a9
test good, revert
TonyXiang8787 Dec 5, 2025
3a52611
add pre-commit check install
TonyXiang8787 Dec 5, 2025
00b1e88
add source
TonyXiang8787 Dec 5, 2025
8304203
[skip ci] remove dockerfile
TonyXiang8787 Dec 7, 2025
945b6c8
[skip ci] modify container
TonyXiang8787 Dec 7, 2025
23fb4e9
[skip ci] part documentation
TonyXiang8787 Dec 7, 2025
40940b3
Merge remote-tracking branch 'origin/main' into feature/enable-uv
TonyXiang8787 Dec 8, 2025
5bacc15
documentation clear
TonyXiang8787 Dec 8, 2025
0ed9cf2
add uv run
TonyXiang8787 Dec 8, 2025
060a49e
add true back
TonyXiang8787 Dec 8, 2025
683ba9c
fix mypy issue
TonyXiang8787 Dec 8, 2025
0e6dc44
remove refresh lock in pr build
TonyXiang8787 Dec 8, 2025
3156ac5
fix issue
TonyXiang8787 Dec 8, 2025
f5da0c7
Merge branch 'main' into feature/enable-uv
TonyXiang8787 Dec 8, 2025
0e08c15
Update pyproject.toml
TonyXiang8787 Dec 9, 2025
2aa5b05
Update .github/workflows/refresh-lock-and-linter-dependencies.yml
TonyXiang8787 Dec 9, 2025
1c4bbba
update uv lock
TonyXiang8787 Dec 9, 2025
6cf8c0d
Merge branch 'main' into feature/enable-uv
TonyXiang8787 Dec 9, 2025
bfed4fc
remove environment limitations
TonyXiang8787 Dec 10, 2025
8b3564a
pytest failed assign to object instead of directly import as
mgovers Dec 10, 2025
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
26 changes: 0 additions & 26 deletions .devcontainer/Dockerfile

This file was deleted.

12 changes: 4 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"name": "power-grid-model",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},

"image": "ghcr.io/astral-sh/uv:debian",
"workspaceFolder": "/power-grid-model",
"workspaceMount": "source=${localWorkspaceFolder},target=/power-grid-model,type=bind",

Expand All @@ -13,10 +9,10 @@

// cache pip installs
"mounts": [
"type=volume,source=dev-pip-cache,target=/root/.cache/pip"
"type=volume,source=dev-pip-cache,target=/root/.cache/uv"
],

"postCreateCommand": "mkdir -p src/power_grid_model/_core/power_grid_model_c/lib && ln -sf /usr/local/lib/python3.13/site-packages/power_grid_model/_core/power_grid_model_c/lib/libpower_grid_model_c.so src/power_grid_model/_core/power_grid_model_c/lib/ && pre-commit install || true",
"postCreateCommand": "uv sync && uv run pre-commit install || true",

"customizations": {
"vscode": {
Expand All @@ -37,7 +33,7 @@
"davidanson.vscode-markdownlint"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.defaultInterpreterPath": ".venv/bin/python",
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"editor.formatOnSave": true,
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ jobs:
steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Set PyPI Version
uses: PowerGridModel/pgm-version-bump@main
Expand All @@ -46,8 +45,7 @@ jobs:
run: |
cp PYPI_VERSION VERSION
cat VERSION
pip install build
python -m build --sdist --outdir wheelhouse .
uv build --sdist --no-create-gitignore --out-dir wheelhouse .

- name: Keep version file
uses: actions/upload-artifact@v5
Expand Down Expand Up @@ -221,6 +219,8 @@ jobs:
# pass GitHub runner info into Linux container
CIBW_ENVIRONMENT_PASS_LINUX: GITHUB_SHA GITHUB_REF GITHUB_RUN_NUMBER
CIBW_BUILD: ${{ matrix.cibw_build }}
with:
extras: "uv"

- name: Keep wheel files
uses: actions/upload-artifact@v5
Expand Down Expand Up @@ -310,12 +310,6 @@ jobs:

- uses: actions/checkout@v6

- name: Setup python
uses: actions/setup-python@v6
with:
python-version: '3.12'
architecture: x64

- uses: actions/download-artifact@v6

- uses: actions/download-artifact@v6
Expand Down
39 changes: 17 additions & 22 deletions .github/workflows/check-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,34 @@ jobs:
- name: Checkout
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Upgrade pip
run: pip install --upgrade pip
- name: Install most linters from uv
run: |
CC=gcc-14 CXX=g++-14 uv sync --group lint

- name: Install and run mypy
- name: Run mypy
run: |
pip install mypy numpy
mypy .
uv run mypy .

- name: Install and run ruff
- name: Run ruff
run: |
pip install ruff
ruff check .
ruff format .
uv run ruff check .
uv run ruff format .
git restore README.md

- name: Install and run clang-format
- name: Run clang-format
run: |
sudo apt-get install -y clang-format-18
find . -regex '.*\.\(h\|c\|cpp\|hpp\|cc\|cxx\)' -exec clang-format-18 -style=file -i {} \;
find . -regex '.*\.\(h\|c\|cpp\|hpp\|cc\|cxx\)' -exec uv run clang-format -style=file -i {} \;

- name: Install and run cmake-linter
- name: Run cmake-linter
run: |
pip install gersemi
gersemi -i --warnings-as-errors src/ tests/ cmake/
uv run gersemi -i --warnings-as-errors src/ tests/ cmake/

- name: Install and run markdownlint
run: |
npm install -g markdownlint-cli
npm install -g markdownlint-cli@0.46.0
echo "Running markdownlint"
markdownlint --fix .

Expand All @@ -74,8 +69,8 @@ jobs:
- name: Check generated code
if: success()
run: |
pip install -r code_generation/requirements.txt
python code_generation/code_gen.py
uv pip install -r code_generation/requirements.txt
uv run code_generation/code_gen.py
if [ -n "$(git status --porcelain)" ]; then
echo
echo "The following files are outdated or were manually updated:"
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/refresh-lock-and-linter-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
#
# SPDX-License-Identifier: MPL-2.0

name: Refresh lock and linter Dependencies

on:
workflow_call:
inputs:
create-pr:
type: boolean
description: "Whether to create a pull request with the changes"
required: false
default: false
workflow_dispatch:
inputs:
create-pr:
type: boolean
description: "Whether to create a pull request with the changes"
required: false
default: false
schedule:
- cron: "0 2 * * 0" # Every Sunday at 2:00 UTC


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-linter-dependencies
cancel-in-progress: true


jobs:
refresh-lock-and-linter-dependencies:
name: Refresh lock and linter Dependencies
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v6

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

- name: upgrade uv lock
run: uv lock --upgrade

- name: Install linters from uv
run: |
uv sync --only-group lint

- name: retrieve versions
id: versions
run: |
grab_installed_version() {
local pkg="$1"
local version
version=$(uv pip freeze | grep -i "^$pkg==" | head -n1 | cut -d= -f3)
echo "${pkg}=$version" >> "$GITHUB_OUTPUT"
}
grab_installed_version "ruff"
grab_installed_version "clang-format"
grab_installed_version "mypy"
grab_installed_version "gersemi"

- name: Update .pre-commit-config.yaml
uses: cuchi/jinja2-action@v1.3.0
with:
template: .pre-commit-config.yaml.jinja
output_file: .pre-commit-config.yaml
variables: |
ruff=${{ steps.versions.outputs.ruff }}
clang_format=${{ steps.versions.outputs.clang-format }}
mypy=${{ steps.versions.outputs.mypy }}
gersemi=${{ steps.versions.outputs.gersemi }}

- name: show changed files
run: |
git status
git diff .pre-commit-config.yaml

- name: try to install pre-commit
run: |
source .venv/bin/activate
pre-commit install
pre-commit install-hooks

- name: create pull request
if: ${{ inputs.create-pr || github.event_name == 'schedule' }}
uses: peter-evans/create-pull-request@v7
with:
commit-message: "Refresh lock and linter dependencies"
branch: "dependencies/refresh-lock-and-linter"
title: "Refresh lock and linter dependencies"
body: "This PR refreshes the lock file and updates linter dependencies to their latest versions."
labels: "dependencies"
signoff: true
delete-branch: true
base: ${{ github.head_ref }}
10 changes: 4 additions & 6 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,15 @@ jobs:
run: |
brew update
brew install boost eigen nlohmann-json msgpack-cxx doctest
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install build-wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6

- name: Python test and coverage
run: |
CC=clang CXX=clang++ pip install -e .[dev]
pytest
CC=clang CXX=clang++ uv sync --no-default-groups --group test
uv run pytest

- name: Run build-wrapper for C++
run: |
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,6 @@ target/
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand Down Expand Up @@ -520,4 +517,6 @@ docs/jupyter_execute/
# if you want to changes the JSON file in .vscode folder
# please type
# git add .vscode/ --force
.vscode/
.vscode/

wheelhouse/
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# SPDX-License-Identifier: MPL-2.0

repos:
- repo: https://github.com/fsfe/reuse-tool
- repo: https://github.com/fsfe/reuse-tool # outside pypi
rev: v4.0.3
hooks:
- id: reuse
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.12.7
rev: v0.14.7
hooks:
# Run the linter.
- id: ruff-check
Expand All @@ -19,7 +19,7 @@ repos:
- id: ruff-format
name: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.0
rev: v1.19.0
hooks:
- id: mypy
additional_dependencies:
Expand All @@ -28,23 +28,23 @@ repos:
hooks:
- id: pytest
name: pytest
entry: pytest
entry: uv run pytest
language: system
pass_filenames: false
always_run: true
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.3
rev: v18.1.8
hooks:
- id: clang-format
types_or: [ c++, c ]
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.23.1
rev: 0.23.2
hooks:
- id: gersemi
name: cmake-linter
alias: cmake-linter
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.45.0
- repo: https://github.com/igorshubovych/markdownlint-cli # outside pypi
rev: v0.46.0
hooks:
- id: markdownlint
args: ["--fix"]
Loading
Loading