Skip to content

Commit

Permalink
Merge pull request #36 from dnv-opensource/35-solve-errors-that-lead-…
Browse files Browse the repository at this point in the history
…to-nightly-build-failing

35 solve errors that lead to nightly build failing
  • Loading branch information
ClaasRostock authored Jan 18, 2025
2 parents d8a748d + faec175 commit c0fae3d
Show file tree
Hide file tree
Showing 65 changed files with 1,715 additions and 1,513 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@
*.png -text
*.gif -text
*.ico -text

# Denote all files that are truly binary and should not be modified.
*.onnx binary
*.fmu binary
2 changes: 1 addition & 1 deletion .github/workflows/_build_and_publish_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
lfs: true
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
with:
lfs: true
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
Expand All @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
Expand All @@ -47,7 +47,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
Expand All @@ -66,7 +66,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ jobs:
- version: '3.10'
- version: '3.11'
- version: '3.12'
- version: '3.13'
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
enable-cache: false
cache-dependency-glob: "uv.lock"
- name: Install Python ${{ matrix.python.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Install the project
run: uv sync --upgrade -p ${{ matrix.python.version }} --no-dev
- name: Install pytest
run: |
uv pip install pytest
uv pip install pytest-cov
run: uv sync -p ${{ matrix.python.version }} -U --no-dev
- name: Run pytest
run: uv run pytest --cov
run: >
uv run --with pytest --with pytest-cov
pytest --cov
24 changes: 11 additions & 13 deletions .github/workflows/_test_future.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Unit Tests (py313)
# Test also with Python 3.13 (experimental; workflow will not fail on error.)
name: Unit Tests (py314)
# Test also with Python 3.14 (experimental; workflow will not fail on error.)

on: workflow_call

jobs:
test313:
test314:
name: Test on ${{matrix.python.version}}-${{matrix.platform.runner}} (experimental)
continue-on-error: true
runs-on: ${{ matrix.platform.runner }}
Expand All @@ -14,24 +14,22 @@ jobs:
- runner: ubuntu-latest
- runner: windows-latest
python:
- version: '3.13.0-alpha - 3.13.0'
uvpy: '3.13'
- version: '3.14.0-alpha - 3.14.0'
uvpy: '3.14'
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
enable-cache: false
cache-dependency-glob: "uv.lock"
- name: Install Python ${{ matrix.python.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Install the project
run: uv sync --upgrade -p ${{ matrix.python.uvpy }} --no-dev
- name: Install pytest
run: |
uv pip install pytest
uv pip install pytest-cov
run: uv sync -p ${{ matrix.python.uvpy }} -U --no-dev
- name: Run pytest
run: uv run pytest --cov
run: >
uv run --with pytest --with pytest-cov
pytest --cov
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,8 @@ demos/**/*.log
demos/**/*.db
demos/**/*.nc

# Cmake generated files
CMakeUserPresets.json

# modules
modules.txt
modules.txt
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: mixed-line-ending
fix: auto
args: [--fix=auto]
- id: trailing-whitespace
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.9.2
hooks:
- id: ruff
- id: ruff-format
- id: ruff
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.9.0
# rev: v1.14.1
# hooks:
# - id: mypy
# exclude: tests/
exclude: '(.venv|.*_cache)/.*'
1 change: 1 addition & 0 deletions .sourcery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ rule_settings:

metrics:
quality_threshold: 20.0

# github:
# labels: []
# ignore_labels:
Expand Down
2 changes: 2 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"sourcery.sourcery",
"njpwerner.autodocstring",
"editorconfig.editorconfig",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-renderers",
"ms-python.mypy-type-checker",
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"python.terminal.activateEnvInCurrentTerminal": false,
"mypy-type-checker.importStrategy": "fromEnvironment",
"mypy-type-checker.reportingScope": "workspace",
"mypy-type-checker.preferDaemon": false,
"mypy-type-checker.preferDaemon": true,
"ruff.configurationPreference": "filesystemFirst",
}
36 changes: 26 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,37 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e

## [Unreleased]

-/-


## [0.4.1] - 2025-01-18

### Added
* Added support for Python 3.13
* Added CITATION.cff
* pyproject.toml : Added keywords

### Solved
* Resolved issues raised by `ruff` 0.9.2

### Dependencies
* Updated to ruff>=0.8.3 (from ruff>=0.6.3)
* Updated to pyright>=1.1.390 (from pyright>=1.1.378)
* Updated to sourcery>=1.27 (from sourcery>=1.22)
* Updated to ruff>=0.9.2 (from ruff>=0.6.3)
* Updated to pyright>=1.1.392 (from pyright>=1.1.378)
* Updated to sourcery>=1.31 (from sourcery>=1.22)
* Updated to types-lxml>=2024.12 (from types-lxml>=2024.4)
* Updated to sphinx-autodoc-typehints>=3.0 (from sphinx-autodoc-typehints>=2.2)
* Updated to mypy>=1.14 (from mypy>=1.13)
* Updated to setup-uv@v5 (from setup-uv@v2)
* Updated to lxml>=5.3 (from lxml>=5.2)
* Updated to types-lxml>=2024.11 (from types-lxml>=2024.4)
* Updated to jupyter>=1.1 (from jupyter>=1.0)
* Updated to pytest-cov>=6.0 (from pytest-cov>=5.0)
* Updated to Sphinx>=8.1 (from Sphinx>=8.0)
* Updated to sphinx-argparse-cli>=1.19 (from sphinx-argparse-cli>=1.17)
* Updated to sphinx-autodoc-typehints>=2.5 (from sphinx-autodoc-typehints>=2.2)
* Updated to pre-commit>=4.0 (from pre-commit>=3.8)
* Updated to mypy>=1.13 (from mypy>=1.11.1)

### Solved
* Resolved issues raised by `ruff`
* Updated to mypy>=1.14 (from mypy>=1.11.1)
* numpy: As Python 3.13 requires numpy 2.x, made minimum required numpy version in pyproject.toml dependent on Python version:
* "numpy>=1.26; python_version < '3.13'",
* "numpy>=2.2; python_version >= '3.13'",


## [0.4.0] - 2024-11-11
Expand Down Expand Up @@ -360,7 +375,8 @@ This removes the need to manually add /src to the PythonPath environment variabl
* Added support for Python 3.10

<!-- Markdown link & img dfn's -->
[unreleased]: https://github.com/dnv-opensource/dictIO/compare/v0.4.0...HEAD
[unreleased]: https://github.com/dnv-opensource/dictIO/compare/v0.4.1...HEAD
[0.4.1]: https://github.com/dnv-opensource/dictIO/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/dnv-opensource/dictIO/compare/v0.3.4...v0.4.0
[0.3.4]: https://github.com/dnv-opensource/dictIO/compare/v0.3.3...v0.3.4
[0.3.3]: https://github.com/dnv-opensource/dictIO/compare/v0.3.2...v0.3.3
Expand Down
35 changes: 35 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
title: dictIO
version: 0.4.1
abstract: >-
Python package to read, write and manipulate dictionary text files.
Supports dictIOs native file format, as well as JSON, XML and OpenFOAM.
type: software
authors:
- name: DNV SE
address: 'Brooktorkai 18'
post-code: '20457'
city: Hamburg
country: DE
website: 'https://www.dnv.com/'
- given-names: Frank
family-names: Lumpitzsch
affiliation: DNV
email: frank.lumpitzsch@dnv.com
website: 'https://www.linkedin.com/in/frank-lumpitzsch-23013196/'
- given-names: Claas
family-names: Rostock
affiliation: DNV
email: claas.rostock@dnv.com
website: 'https://www.linkedin.com/in/claasrostock/?locale=en_US'
- given-names: Seunghyeon
family-names: Yoo
affiliation: DNV
email: seunghyeon.yoo@dnv.com
website: 'https://www.linkedin.com/in/seunghyeon-yoo-3625173b/'
keywords:
license: MIT
license-url: 'https://dnv-opensource.github.io/dictIO/LICENSE.html'
url: 'https://dnv-opensource.github.io/dictIO/README.html'
repository-code: 'https://github.com/dnv-opensource/dictIO'
message: 'Please cite this software using these metadata.'
cff-version: 1.2.0
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,21 @@ Clone the dictIO repository into your local development directory:
```sh
git clone https://github.com/dnv-opensource/dictIO path/to/your/dev/dictIO
```
Change into the project directory after cloning:
```sh
cd dictIO
```

### 4. Install dependencies
Run `uv sync` to create a virtual environment and install all project dependencies into it:
```sh
uv sync
```
> **Note**: Using `--no-dev` will omit installing development dependencies.
> **Note**: `uv` will create a new virtual environment called `.venv` in the project root directory when running
> `uv sync` the first time. Optionally, you can create your own virtual environment using e.g. `uv venv`, before running
> `uv sync`.
### 5. (Optional) Activate the virtual environment
When using `uv`, there is in almost all cases no longer a need to manually activate the virtual environment. <br>
Expand Down Expand Up @@ -163,6 +172,20 @@ uv run pre-commit install

All pre-commit hooks configured in `.pre-commit-config.yaml` will now run each time you commit changes.

pre-commit can also manually be invoked, at anytime, using:
```sh
uv run pre-commit run --all-files
```

To skip the pre-commit validation on commits (e.g. when intentionally committing broken code), run:
```sh
uv run git commit -m <MSG> --no-verify
```

To update the hooks configured in `.pre-commit-config.yaml` to their newest versions, run:
```sh
uv run pre-commit autoupdate
```

### 7. Test that the installation works
To test that the installation works, run pytest in the project root folder:
Expand All @@ -172,7 +195,7 @@ uv run pytest

## Meta

Copyright (c) 2024 [DNV](https://www.dnv.com) SE. All rights reserved.
Copyright (c) 2024 [DNV](https://www.dnv.com) AS. All rights reserved.

Frank Lumpitzsch - [@LinkedIn](https://www.linkedin.com/in/frank-lumpitzsch-23013196/) - frank.lumpitzsch@dnv.com

Expand Down
6 changes: 3 additions & 3 deletions STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@ If you are interested in the long story including the why‘s, read these discus
import pandas as pd
import numpy as np

import my_package
import my_package.my_module
from my_package.my_module import my_function, MyClass
import dictIO
import dictIO.my_module
from dictIO.my_module import my_function, MyClass
```

* Even if a Python file is intended to be used as executable / script file only, it shall still be importable as a module, and its import should not have any side effects. Its main functionality shall hence be in a `main()` function, so that the code can be imported as a module for testing or being reused in the future:
Expand Down
4 changes: 2 additions & 2 deletions docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ if "%SPHINXBUILD%" == "" (
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
Expand All @@ -25,6 +23,8 @@ if errorlevel 9009 (
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -a -E
goto end

Expand Down
Loading

0 comments on commit c0fae3d

Please sign in to comment.