Skip to content

Commit

Permalink
Merge branch 'main' into bootstrap_weights
Browse files Browse the repository at this point in the history
  • Loading branch information
janosg authored Nov 12, 2024
2 parents 1d45f27 + 52c6774 commit 79f2d83
Show file tree
Hide file tree
Showing 45 changed files with 4,942 additions and 258 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: 1.5.6-0
environment-file: ./.tools/envs/testenv-others.yml
cache-environment: true
create-args: |
Expand All @@ -70,9 +71,10 @@ jobs:
micromamba activate optimagic
pytest -m "not slow and not jax"
run-tests-with-old-pandas:
# This job is only for testing if optimagic works with older pandas versions, as
# many pandas functions we use will be deprecated in pandas 3. optimagic's behavior
# for older verions is handled in src/optimagic/compat.py.
# This job is only for testing if optimagic works with pandas<2, as many pandas
# functions we use will be deprecated in pandas 3. optimagic's behavior for older
# verions is handled in src/optimagic/compat.py. For compatibility with we have to
# restrict numpy<2.
name: Run tests for ${{ matrix.os}} on ${{ matrix.python-version }} with pandas 1
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -96,6 +98,32 @@ jobs:
run: |
micromamba activate optimagic
pytest -m "not slow and not jax"
run-tests-with-old-numpy:
# This job is only for testing if optimagic works with numpy<2. Because we already
# test pandas<2 with numpy<2, in this environment we restrict pandas>=2.
name: Run tests for ${{ matrix.os}} on ${{ matrix.python-version }} with numpy 1
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version:
- '3.10'
steps:
- uses: actions/checkout@v4
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./.tools/envs/testenv-numpy.yml
cache-environment: true
create-args: |
python=${{ matrix.python-version }}
- name: run pytest
shell: bash -l {0}
run: |
micromamba activate optimagic
pytest -m "not slow and not jax"
code-in-docs:
name: Run code snippets in documentation
runs-on: ubuntu-latest
Expand Down
31 changes: 23 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@ repos:
language: python
always_run: true
require_serial: true
- repo: local
hooks:
- id: update-algo-selection-code
name: update algo selection code
entry: bash .tools/create_and_format_algo_selection_code.sh
language: python
files: (src/optimagic/optimizers/.|src/optimagic/algorithms.py|.tools/.)
always_run: false
require_serial: true
additional_dependencies:
- hatchling
- ruff
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args:
Expand Down Expand Up @@ -56,7 +68,7 @@ repos:
- id: yamllint
exclude: tests/optimagic/optimizers/_pounders/fixtures
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
rev: eb1df34
hooks:
- id: docformatter
args:
Expand All @@ -68,7 +80,7 @@ repos:
- --blank
exclude: src/optimagic/optimization/algo_options.py
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.7.2
hooks:
# Run the linter.
- id: ruff
Expand All @@ -85,7 +97,7 @@ repos:
- pyi
- jupyter
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.18
hooks:
- id: mdformat
additional_dependencies:
Expand All @@ -97,7 +109,7 @@ repos:
- '88'
files: (README\.md)
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.18
hooks:
- id: mdformat
additional_dependencies:
Expand All @@ -107,8 +119,9 @@ repos:
- --wrap
- '88'
files: (docs/.)
exclude: docs/source/how_to/how_to_specify_algorithm_and_algo_options.md
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
rev: 0.8.0
hooks:
- id: nbstripout
exclude: |
Expand All @@ -119,12 +132,12 @@ repos:
args:
- --drop-empty-cells
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
files: src|tests
additional_dependencies:
- numpy<2.0
- numpy
- packaging
- pandas-stubs
- sqlalchemy-stubs
Expand All @@ -135,3 +148,5 @@ repos:
- --config=pyproject.toml
ci:
autoupdate_schedule: monthly
skip:
- update-algo-selection-code
Loading

0 comments on commit 79f2d83

Please sign in to comment.