Skip to content

Commit

Permalink
Merge pull request #501 from OpenSourceEconomics/0.5.0
Browse files Browse the repository at this point in the history
Collection of all breaking changes from EP-02 and EP-03
  • Loading branch information
janosg authored Aug 22, 2024
2 parents ef92f4f + 43f8488 commit caeb370
Show file tree
Hide file tree
Showing 447 changed files with 29,573 additions and 26,192 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: ''

---

* estimagic version used, if any:
* optimagic version used, if any:
* Python version, if any:
* Operating System:

Expand Down
49 changes: 24 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./.envs/testenv-linux.yml
environment-file: ./.tools/envs/testenv-linux.yml
cache-environment: true
create-args: |
python=${{ matrix.python-version }}
- name: run pytest
shell: bash -l {0}
run: |
micromamba activate estimagic
micromamba activate optimagic
pytest --cov-report=xml --cov=./
- name: Upload coverage report.
if: runner.os == 'Linux' && matrix.python-version == '3.10'
Expand All @@ -60,19 +60,19 @@ jobs:
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./.envs/testenv-others.yml
environment-file: ./.tools/envs/testenv-others.yml
cache-environment: true
create-args: |
python=${{ matrix.python-version }}
- name: run pytest
shell: bash -l {0}
run: |
micromamba activate estimagic
micromamba activate optimagic
pytest -m "not slow and not jax"
run-tests-with-old-pandas:
# This job is only for testing if estimagic works with older pandas versions, as
# many pandas functions we use will be deprecated in pandas 3. estimagic's behavior
# for older verions is handled in src/estimagic/compat.py.
# 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.
name: Run tests for ${{ matrix.os}} on ${{ matrix.python-version }} with pandas 1
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -87,17 +87,15 @@ jobs:
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./.envs/testenv-pandas.yml
environment-file: ./.tools/envs/testenv-pandas.yml
cache-environment: true
create-args: |
python=${{ matrix.python-version }}
- name: run pytest
shell: bash -l {0}
run: |
micromamba activate estimagic
pytest tests/visualization
pytest tests/parameters
pytest tests/inference
micromamba activate optimagic
pytest -m "not slow and not jax"
code-in-docs:
name: Run code snippets in documentation
runs-on: ubuntu-latest
Expand All @@ -106,33 +104,34 @@ jobs:
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./.envs/testenv-linux.yml
environment-name: estimagic
cache-env: true
extra-specs: python=3.12
environment-file: ./.tools/envs/testenv-linux.yml
environment-name: optimagic
cache-environment: true
create-args: |
python=3.12
- name: run sphinx
shell: bash -l {0}
run: |-
micromamba activate estimagic
micromamba activate optimagic
cd docs/source
python -m doctest -v how_to_guides/optimization/how_to_specify_constraints.md
python -m doctest -v how_to/how_to_constraints.md
run-mypy:
name: Run mypy
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: create build environment
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./.envs/testenv-linux.yml
environment-name: estimagic
cache-env: true
extra-specs: |
environment-file: ./.tools/envs/testenv-linux.yml
environment-name: optimagic
cache-environment: true
create-args: |
python=3.10
- name: Run mypy
shell: bash -l {0}
run: |-
micromamba activate estimagic
micromamba activate optimagic
mypy
38 changes: 36 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name: PyPI
on: push
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
build-n-publish-optimagic:
name: Build and publish optimagic Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -24,6 +24,40 @@ jobs:
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN_OPTIMAGIC }}
build-n-publish-estimagic:
name: Build and publish estimagic Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install pypa/build
run: >-
python -m
pip install
build
toml
--user
- name: Set name entry in pyproject.toml to estimagic
run: >-
python .tools/update_name_pyproject.py
- name: Add FutureWarning to init files
run: >-
python .tools/update_init_files.py
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@ venv.bak/


src/estimagic/_version.py
src/optimagic/_version.py

*.~lock.*
81 changes: 46 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ repos:
rev: 1.16.0
hooks:
- id: yamlfix
exclude: tests/optimization/fixtures
exclude: tests/optimagic/optimizers/_pounders/fixtures
- repo: local
hooks:
- id: update-environment-files
name: check environment file updates
entry: python .envs/update_envs.py
entry: python .tools/update_envs.py
language: python
always_run: true
require_serial: true
Expand All @@ -24,7 +24,7 @@ repos:
- id: check-added-large-files
args:
- --maxkb=1300
exclude: tests/optimization/fixtures/
exclude: tests/optimagic/optimizers/_pounders/fixtures/
- id: check-case-conflict
- id: check-merge-conflict
- id: check-vcs-permalinks
Expand All @@ -48,24 +48,13 @@ repos:
- --branch
- main
- id: trailing-whitespace
exclude: docs/
- id: check-ast
- id: check-docstring-first
exclude: src/estimagic/optimization/algo_options.py
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
exclude: tests/optimization/fixtures
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/asottile/blacken-docs
rev: 1.18.0
hooks:
- id: blacken-docs
exclude: docs/source/how_to_guides/optimization/how_to_specify_constraints.md
exclude: tests/optimagic/optimizers/_pounders/fixtures
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
Expand All @@ -77,23 +66,32 @@ repos:
- --wrap-descriptions
- '88'
- --blank
exclude: src/estimagic/optimization/algo_options.py
exclude: src/optimagic/optimization/algo_options.py
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
rev: v0.5.7
hooks:
# Run the linter.
- id: ruff
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.7
hooks:
- id: nbqa-black
- id: nbqa-ruff
types_or:
- python
- pyi
- jupyter
args:
- --fix
# Run the formatter.
- id: ruff-format
types_or:
- python
- pyi
- jupyter
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat-black
- mdformat-gfm-alerts
- mdformat-ruff
args:
- --wrap
- '88'
Expand All @@ -104,23 +102,36 @@ repos:
- id: mdformat
additional_dependencies:
- mdformat-myst
- mdformat-black
- mdformat-ruff
args:
- --wrap
- '88'
files: (docs/.)
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/mgedmin/check-manifest
rev: '0.49'
hooks:
- id: check-manifest
- id: nbstripout
exclude: |
(?x)^(
docs/source/estimagic/tutorials/estimation_tables_overview.ipynb|
docs/source/estimagic/explanation/bootstrap_montecarlo_comparison.ipynb|
)$
args:
- --no-build-isolation
- --drop-empty-cells
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
hooks:
- id: mypy
files: src|tests
additional_dependencies:
- setuptools-scm
- toml
- numpy<2.0
- packaging
- pandas-stubs
- sqlalchemy-stubs
- types-cffi
- types-openpyxl
- types-jinja2
args:
- --config=pyproject.toml
ci:
autoupdate_schedule: monthly
17 changes: 10 additions & 7 deletions .envs/testenv-linux.yml → .tools/envs/testenv-linux.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
name: estimagic
name: optimagic
channels:
- conda-forge
- nodefaults
dependencies:
- petsc4py
- jax
- pygmo
- cyipopt>=1.4.0 # dev, tests
- pygmo>=2.19.0 # dev, tests
- nlopt # dev, tests
- pip # dev, tests, docs
- pytest # dev, tests
- pytest-cov # tests
- pytest-xdist # dev, tests
- statsmodels # dev, tests
- bokeh<=2.4.3 # run, tests
- click # run, tests
- cloudpickle # run, tests
- joblib # run, tests
- numpy<2.0 # run, tests
Expand All @@ -22,16 +22,19 @@ dependencies:
- pybaum >= 0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
- tranquilo>=0.0.4 # dev, tests
- seaborn # dev, tests
- mypy>=1.11 # dev, tests
- pyyaml # dev, tests
- jinja2 # dev, tests
- annotated-types # dev, tests
- pip: # dev, tests, docs
- DFO-LS # dev, tests
- Py-BOBYQA # dev, tests
- fides==0.7.4 # dev, tests
- kaleido # dev, tests
- simoptlib==1.0.1 # dev, tests
- pandas-stubs # dev, tests
- types-cffi # dev, tests
- types-openpyxl # dev, tests
- -e ../
- types-jinja2 # dev, tests
- sqlalchemy-stubs # dev, tests
- -e ../../
Loading

0 comments on commit caeb370

Please sign in to comment.