Skip to content

Commit 02e9237

Browse files
authored
Merge pull request #3 from dnv-opensource/2-restructure-the-repo-and-change-to-uv-as-package-manager
2 restructure the repo and change to uv as package manager
2 parents 0b62db5 + e8133fa commit 02e9237

Some content is hidden

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

76 files changed

+4140
-1496
lines changed

.coveragerc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[paths]
2+
source =
3+
src/sim_explorer
4+
*/site-packages/sim_explorer
5+
6+
[run]
7+
source = sim_explorer
8+
branch = True
9+
10+
[report]
11+
# fail_under = 10.0
12+
show_missing = True
13+
skip_covered = True

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.{yml,yaml}]
14+
indent_style = space
15+
indent_size = 2

.gitattributes

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.py text
7+
*.cpp text
8+
*.hpp text
9+
*.c text
10+
*.h text
11+
*.json text
12+
*.xml text
13+
*.txt text
14+
*.yml text
15+
*.yaml text
16+
*.toml text
17+
*.rst text
18+
*.ini text
19+
20+
# Declare files that will always have CRLF line endings on checkout.
21+
*.vcproj text eol=crlf
22+
*.sln text eol=crlf
23+
*.md text eol=crlf
24+
25+
# Declare files that will always have LF line endings on checkout.
26+
*.sh text eol=lf
27+
28+
# Declare files that will not be normalized regardless of their content.
29+
*.jpg -text
30+
*.png -text
31+
*.gif -text
32+
*.ico -text
33+
34+
# Denote all files that are truly binary and should not be modified.
35+
*.onnx binary
36+
*.fmu binary

.github/workflows/_build_and_publish_documentation.yml

+14-13
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ jobs:
1515
- name: Checkout active branch
1616
uses: actions/checkout@v4
1717
with:
18-
fetch-depth: 1
1918
lfs: true
20-
- name: Install Python
21-
uses: actions/setup-python@v4
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v2
2221
with:
23-
python-version: '3.11'
24-
cache: 'pip' # cache pip dependencies
25-
- name: Install dependencies
26-
run: |
27-
pip install -r requirements-dev.txt
22+
enable-cache: true
23+
cache-dependency-glob: "uv.lock"
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version-file: "pyproject.toml"
28+
- name: Install the project
29+
run: uv sync --upgrade
2830
- name: Print debugging information
2931
run: |
3032
echo "github.ref:" ${{github.ref}}
@@ -36,16 +38,15 @@ jobs:
3638
git branch
3739
git branch -a
3840
git remote -v
39-
python -V
40-
pip list --not-required
41-
pip list
41+
uv run python -V
42+
uv pip list
4243
4344
# Build documentation
4445
- uses: sphinx-doc/github-problem-matcher@master
4546
- name: Build documentation
4647
run: |
4748
cd docs
48-
make html
49+
uv run make html
4950
5051
- name: Clone and cleanup gh-pages branch
5152
run: |
@@ -102,7 +103,7 @@ jobs:
102103

103104
# Publish: Commit gh-pages branch and publish it to GitHub Pages
104105
- name: Publish documentation
105-
uses: peaceiris/actions-gh-pages@v3
106+
uses: peaceiris/actions-gh-pages@v4
106107
with:
107108
publish_branch: gh-pages
108109
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/_build_package.yml

+29-26
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
1-
name: Build Package
2-
3-
on: workflow_call
4-
5-
jobs:
6-
build:
7-
name: Build source distribution
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v4
11-
with:
12-
fetch-depth: 1
13-
lfs: true
14-
- uses: actions/setup-python@v4
15-
with:
16-
python-version: '3.11'
17-
cache: 'pip' # cache pip dependencies
18-
- name: Install build and twine
19-
run: pip install build twine
20-
- name: Run build
21-
run: python -m build
22-
- name: Run twine check
23-
run: twine check --strict dist/*
24-
- uses: actions/upload-artifact@v4
25-
with:
26-
path: ./dist/*.tar.gz
1+
name: Build Package
2+
3+
on: workflow_call
4+
5+
jobs:
6+
build:
7+
name: Build source distribution
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
lfs: true
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v2
15+
with:
16+
enable-cache: true
17+
cache-dependency-glob: "uv.lock"
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version-file: "pyproject.toml"
21+
- name: Build source distribution and wheel
22+
run: uv build
23+
- name: Run twine check
24+
run: uvx twine check --strict dist/*
25+
- uses: actions/upload-artifact@v4
26+
with:
27+
path: |
28+
dist/*.tar.gz
29+
dist/*.whl

.github/workflows/_code_quality.yml

+80-36
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,80 @@
1-
name: Code Quality
2-
3-
on: workflow_call
4-
5-
jobs:
6-
ruff_format:
7-
runs-on: ubuntu-latest
8-
name: ruff format
9-
steps:
10-
- uses: actions/checkout@v4
11-
- uses: actions/setup-python@v4
12-
with:
13-
python-version: '3.11'
14-
cache: 'pip' # cache pip dependencies
15-
- name: Install dependencies
16-
run: pip install -r requirements.txt
17-
- name: Install ruff
18-
run: pip install ruff==0.3.0
19-
- name: Run ruff format
20-
run: ruff format --diff .
21-
22-
ruff_check:
23-
runs-on: ubuntu-latest
24-
name: ruff check
25-
steps:
26-
- uses: actions/checkout@v4
27-
- uses: actions/setup-python@v4
28-
with:
29-
python-version: '3.11'
30-
cache: 'pip' # cache pip dependencies
31-
- name: Install dependencies
32-
run: pip install -r requirements.txt
33-
- name: Install ruff
34-
run: pip install ruff==0.3.0
35-
- name: Run ruff check
36-
run: ruff check --diff .
1+
name: Code Quality
2+
3+
on: workflow_call
4+
5+
jobs:
6+
ruff_format:
7+
runs-on: ubuntu-latest
8+
name: ruff format
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Install uv
12+
uses: astral-sh/setup-uv@v2
13+
with:
14+
enable-cache: true
15+
cache-dependency-glob: "uv.lock"
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version-file: "pyproject.toml"
20+
- name: Install the project
21+
run: uv sync --upgrade
22+
- name: Run ruff format
23+
run: uv run ruff format --diff
24+
25+
ruff_check:
26+
runs-on: ubuntu-latest
27+
name: ruff check
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v2
32+
with:
33+
enable-cache: true
34+
cache-dependency-glob: "uv.lock"
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version-file: "pyproject.toml"
39+
- name: Install the project
40+
run: uv sync --upgrade
41+
- name: Run ruff check
42+
run: uv run ruff check --diff
43+
44+
# pyright:
45+
# runs-on: ubuntu-latest
46+
# name: pyright
47+
# steps:
48+
# - uses: actions/checkout@v4
49+
# - name: Install uv
50+
# uses: astral-sh/setup-uv@v2
51+
# with:
52+
# enable-cache: true
53+
# cache-dependency-glob: "uv.lock"
54+
# - name: Set up Python
55+
# uses: actions/setup-python@v5
56+
# with:
57+
# python-version-file: "pyproject.toml"
58+
# - name: Install the project
59+
# run: uv sync --upgrade
60+
# - name: Run pyright
61+
# run: uv run pyright
62+
63+
mypy:
64+
runs-on: ubuntu-latest
65+
name: mypy
66+
steps:
67+
- uses: actions/checkout@v4
68+
- name: Install uv
69+
uses: astral-sh/setup-uv@v2
70+
with:
71+
enable-cache: true
72+
cache-dependency-glob: "uv.lock"
73+
- name: Set up Python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version-file: "pyproject.toml"
77+
- name: Install the project
78+
run: uv sync --upgrade
79+
- name: Run mypy
80+
run: uv run mypy

.github/workflows/_merge_into_release.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,4 @@ jobs:
2222
with:
2323
type: now
2424
target_branch: release
25-
# @TODO: A dedicated RELEASE_TOKEN should be created in the repo settings
26-
# and used for this task when in production.
27-
# It is set here to the default GITHUB_TOKEN only
28-
# for demonstration purposes, enabling the workflow in the repo template
29-
# to run without additional configuration.
30-
# github_token: ${{ secrets.RELEASE_TOKEN }}
31-
github_token: ${{ secrets.GITHUB_TOKEN }}
25+
github_token: ${{ secrets.RELEASE_TOKEN }}

.github/workflows/_publish_package.yml

-19
This file was deleted.

.github/workflows/_publish_package_test.yml

-19
This file was deleted.

.github/workflows/_test.yml

+16-13
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,34 @@ on: workflow_call
44

55
jobs:
66
test:
7-
name: Test on ${{matrix.python.toxenv}}-${{matrix.platform.toxenv}}
7+
name: Test on ${{matrix.python.version}}-${{matrix.platform.runner}}
88
runs-on: ${{ matrix.platform.runner }}
99
strategy:
1010
matrix:
1111
platform:
1212
- runner: ubuntu-latest
13-
toxenv: linux
1413
- runner: windows-latest
15-
toxenv: windows
14+
# - runner: macos-latest
1615
python:
1716
- version: '3.10'
18-
toxenv: 'py310'
1917
- version: '3.11'
20-
toxenv: 'py311'
21-
# libcosimpy does so far not work in version 12
22-
# - version: '3.12'
23-
# toxenv: 'py312'
18+
- version: '3.12'
2419
steps:
2520
- uses: actions/checkout@v4
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v2
23+
with:
24+
enable-cache: true
25+
cache-dependency-glob: "uv.lock"
2626
- name: Install Python ${{ matrix.python.version }}
27-
uses: actions/setup-python@v4
27+
uses: actions/setup-python@v5
2828
with:
2929
python-version: ${{ matrix.python.version }}
30-
cache: 'pip' # cache pip dependencies
31-
- name: Install tox
32-
run: python -m pip install tox
30+
- name: Install the project
31+
run: uv sync --upgrade -p ${{ matrix.python.version }} --no-dev
32+
- name: Install pytest
33+
run: |
34+
uv pip install pytest
35+
uv pip install pytest-cov
3336
- name: Run pytest
34-
run: tox -e ${{matrix.python.toxenv}}-${{matrix.platform.toxenv}}
37+
run: uv run pytest --cov

0 commit comments

Comments
 (0)