Skip to content

Commit

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

13 solve errors that lead to nightly build failing
  • Loading branch information
swinter1 authored Jan 20, 2025
2 parents d3eb0ff + e7b73c5 commit b4931b5
Show file tree
Hide file tree
Showing 32 changed files with 119 additions and 87 deletions.
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
4 changes: 2 additions & 2 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ 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
enable-cache: false
cache-dependency-glob: "uv.lock"
- name: Install Python ${{ matrix.python.version }}
uses: actions/setup-python@v5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_test_future.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ 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
enable-cache: false
cache-dependency-glob: "uv.lock"
- name: Install Python ${{ matrix.python.version }}
uses: actions/setup-python@v5
Expand Down
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ repos:
- id: check-toml
- id: check-merge-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.9.2
hooks:
- id: ruff-format
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies: [numpy==1.26.4, torch==2.4.1]
exclude: '(.venv|.*_cache)/.*'
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
"justMyCode": true,
},
]
}
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
],
"mypy-type-checker.importStrategy": "fromEnvironment",
"mypy-type-checker.reportingScope": "workspace",
"mypy-type-checker.preferDaemon": false,
"mypy-type-checker.preferDaemon": true,
"ruff.configurationPreference": "filesystemFirst",
}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,25 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e

## [Unreleased]

### Added
* pyproject.toml : Added keywords

### Changed
* Updated multiple files to latest changes changes in python_project_template

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

### Dependencies
* Updated to matplotlib>=3.10 (from matplotlib>=3.9)
* Updated to sphinx-autodoc-typehints>=3.0 (from sphinx-autodoc-typehints>=2.5)
* Updated to pyarrow>=19.0 (from pyarrow>=18.1)
* Updated to mypy>=1.14 (from mypy>=1.13)
* Updated to setup-uv@v5 (from setup-uv@v2)


## [0.1.1] - 2024-12-27

### Added:
Major addition of new qoi method `MarginalCDFExtrapolation`. The following helpers are alse added.
* `utils/numerical_precision`: quantify the precision possible with different datatypes
Expand Down
30 changes: 17 additions & 13 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
cff-version: 1.2.0
title: Axtreme
message: Ax for Extremes
version: 0.1.1
abstract: >-
A toolkit for estimating the long term behaviour
(extremes) of expensive, stochastic, black box functions.
type: software
authors:
- name: DNV
address: 'Veritasveien 1, 1363 Høvik'
city: Oslo
- name: DNV AS
address: 'Veritasveien 1'
post-code: '1363'
city: Høvik
country: NO
website: 'https://www.dnv.com/'
- given-names: Sebastian
family-names: Winter
email: [email protected]
affiliation: DNV
email: [email protected]
- given-names: Kristoffer
family-names: Skare
email: [email protected]
affiliation: DNV
email: [email protected]
- given-names: Magnus
family-names: Kristiansen
email: [email protected]
affiliation: DNV
abstract: >-
A toolkit for estimating the long term behaviour
(extremes) of expensive, stochastic, black box functions.
email: [email protected]
keywords:
- Design of Experiments
- Active Learning
- Extreme Response
license: MIT
url: "https://github.com/dnv-opensource/axtreme"
version: 0.1.1
license-url: 'https://dnv-opensource.github.io/axtreme/LICENSE.html'
url: 'https://dnv-opensource.github.io/axtreme/README.html'
repository-code: 'https://github.com/dnv-opensource/axtreme'
message: 'Please cite this software using these metadata.'
cff-version: 1.2.0
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 [DNV](https://www.dnv.com) [open source](https://github.com/dnv-opensource)
Copyright (c) 2025 [DNV](https://www.dnv.com) [open source](https://github.com/dnv-opensource)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ 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` for the first time. Optionally, you can create your own using e.g. `uv venv`, before 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) Install CUDA support
Expand Down
2 changes: 1 addition & 1 deletion docs/source/axtreme.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
axtreme package
==================
===============

Subpackages
-----------
Expand Down
8 changes: 2 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

project = "axtreme"
copyright = "2024, DNV AS. All rights reserved."
author = "Sebastian Winter, Kristoffer Skare"
author = "Sebastian Winter, Kristoffer Skare, Magnus Kristiansen"

# The full version, including alpha/beta/rc tags
release = "0.1.1"
Expand All @@ -33,11 +33,10 @@

extensions = [
"myst_parser",
"sphinx.ext.autodoc", # upgrade to autodoc2if want to you myst markup in docstings
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_argparse_cli",
"sphinx.ext.mathjax",
"matplotlib.sphinxext.plot_directive",
"sphinx.ext.autosummary",
"sphinx.ext.todo",
"sphinxcontrib.mermaid",
Expand Down Expand Up @@ -74,9 +73,6 @@
autodoc_default_options = {
"member-order": "groupwise",
"undoc-members": True,
# "special-members": True,
# TODO(sw 2024-12-5): using "inherited-members" might be a more elegant want to achieve the below.
# "exclude-members": "__weakref__, __init__, __annotations__, __abstractmethods__, __module__, __parameters__, __subclasshook__",
"exclude-members": "__weakref__",
}
autodoc_preserve_defaults = True
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ axtreme Documentation
LICENSE



Indices and tables
==================

Expand Down
22 changes: 14 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ only-include = [
"tests",
".coveragerc",
".editorconfig",
".pre-commit-config.yaml",
"manage.py",
"pyproject.toml",
"pytest.ini",
"ruff.toml",
"uv.lock",
Expand Down Expand Up @@ -37,6 +40,9 @@ maintainers = [
{ name = "Jorge Luis Mendez", email = "[email protected]" },
]
keywords = [
"Design of Experiments",
"Active Learning",
"Extreme Response",
]
classifiers = [
"Development Status :: 3 - Alpha",
Expand All @@ -53,8 +59,8 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"numpy>=1.26,<2.0",
"matplotlib>=3.9",
"numpy>=1.26, <2.0",
"matplotlib>=3.10",
"statsmodels>=0.14.4",
"filterpy>=1.4.5",
"numba>=0.60.0",
Expand All @@ -80,20 +86,20 @@ Changelog = "https://github.com/dnv-opensource/axtreme/blob/main/CHANGELOG.md"
dev = [
"pytest>=8.3",
"pytest-cov>=6.0",
"ruff>=0.8.3",
"pyright>=1.1.390",
"mypy>=1.13",
"sourcery>=1.27",
"ruff>=0.9.2",
"pyright>=1.1.392",
"mypy>=1.14",
"sourcery>=1.31",
"pre-commit>=4.0",
"Sphinx>=8.1",
"sphinx-argparse-cli>=1.19",
"sphinx-autodoc-typehints>=2.5",
"sphinx-autodoc-typehints>=3.0",
"sphinxcontrib-mermaid>=1.0.0",
"myst-parser>=4.0",
"furo>=2024.8",
"jupyter>=1.1",
"pandas-stubs>=2.2",
"pyarrow>=18.1",
"pyarrow>=19.0",
]

[tool.uv]
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[pytest]
testpaths =
tests
addopts = --strict-markers --verbose
addopts = --strict-markers --verbose --durations=10
xfail_strict = True
filterwarnings =
# Filter out parameters and sklearn deprecation warnings.
Expand Down
17 changes: 13 additions & 4 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ ignore = [
"TRY003", # Avoid specifying long messages outside the exception class
"PLR1711", # Useless `return` statement at end of function
"G00", # Logging statement uses string formatting ('G00' covers all rules flagging string formatting in logging, e.g. G001, G002, etc.)
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"PLW0603", # Using the global statement to update {name} is discouraged
"PYI041", # Use `float` instead of `int | float`

# Ruff lint rules recommended to keep enabled,
# but which are typical candidates you might have a need to ignore,
Expand Down Expand Up @@ -74,8 +77,6 @@ allowed-confusables = [
[lint.pep8-naming]
ignore-names = [
"test_*",
"setUp",
"tearDown",
]

[lint.pylint]
Expand All @@ -94,7 +95,7 @@ raises-require-match-for = [
[lint.per-file-ignores]
# `__init__.py` specific ignores
"__init__.py" = [
"D104", # Missing docstring in public package
"D104", # Missing docstring in public package <- @TODO: Reactivate and resolve @ ClaasRostock, 2025-01-20
"F401", # {name} imported but unused (NOTE: ignored as imports in `__init__.py` files are almost never used inside the module, but are intended for namespaces)
"I001", # Import block is un-sorted or un-formatted
"PLC0414", # Import alias does not rename original package
Expand All @@ -108,9 +109,11 @@ raises-require-match-for = [
"PLR2004", # Magic value used in comparison
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
"ARG001", # Unused function argument: {name}
"ARG002", # Unused method argument: {name}
"INP001", # File is part of an implicit namespace package. Add an `__init__.py`. (NOTE: tests are not intended to be a module, __init__.py hence not required.)
"SLF001", # Private member accessed
"N802", # Function name should be lowercase
"N802", # Function name should be lowercase <- @TODO: Reactivate and resolve @ ClaasRostock, 2025-01-20
"TRY004", # Prefer `TypeError` exception for invalid type
]
# `stubs` specific ignores
Expand Down Expand Up @@ -139,6 +142,7 @@ raises-require-match-for = [
]
# `tutorials` specific ignores
"tutorials/**/*" = [
"D", # Missing docstrings
"S101", # Use of assert detected
"PLR2004", # Magic value used in comparison
"INP001", # File is part of an implicit namespace package. Add an `__init__.py`. (NOTE: tutorials are not intended to be a module, __init__.py hence not required.)
Expand All @@ -154,6 +158,11 @@ raises-require-match-for = [
"N803", # allow capital variables (e.g X). The botorch interface requireds this
"N806", # allow capital variables (e.g X). The botorch interface requireds this
]
# utils/logging specific ignores
"**/utils/logging.py" = [
"A005", # Module `logging` shadows a Python standard-library module
]


[lint.pydocstyle]
convention = "google"
Expand Down
2 changes: 1 addition & 1 deletion src/axtreme/data/batch_invariant_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __init__(self, sampler: Sampler[int] | Iterable[int], batch_shape: torch.Siz
if partial_batch_data_len % batch_shape[0] != 0:
msg = (
f"Final batch will have {partial_batch_data_len} items,"
f" which does not fit into batch shape {torch.Size([*batch_shape[:-1] , -1])}"
f" which does not fit into batch shape {torch.Size([*batch_shape[:-1], -1])}"
)
raise ValueError(msg)

Expand Down
2 changes: 1 addition & 1 deletion src/axtreme/eval/qoi_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def plot_col_histogram(df: pd.DataFrame, ax: Axes, col_name: str = "mean", brute
f"mean of dist {values.mean():.3f}."
f" std of dist {values.std():.3f},"
# Protect against divide by error error
f"C.o.V {values.std()/ values.mean() if values.mean() > 1e-2 else np.nan:.3f}" # noqa: PLR2004
f"C.o.V {values.std() / values.mean() if values.mean() > 1e-2 else np.nan:.3f}" # noqa: PLR2004
)
_ = ax.set_title(title_str)
_ = ax.set_ylabel("density")
Expand Down
Loading

0 comments on commit b4931b5

Please sign in to comment.