Skip to content

Commit

Permalink
Polishing (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Aug 26, 2024
1 parent 95891f5 commit d476eba
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 120 deletions.
36 changes: 1 addition & 35 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: PyPI
on: push
jobs:
build-n-publish-optimagic:
build-n-publish:
name: Build and publish optimagic Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
Expand All @@ -29,37 +29,3 @@ jobs:
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
with:
password: ${{ secrets.PYPI_API_TOKEN }}
29 changes: 0 additions & 29 deletions .tools/update_init_files.py

This file was deleted.

13 changes: 0 additions & 13 deletions .tools/update_name_pyproject.py

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is a record of all past optimagic releases and what went into them in reverse
chronological order. We follow [semantic versioning](https://semver.org/) and all
releases are available on [Anaconda.org](https://anaconda.org/OpenSourceEconomics/optimagic).
releases are available on [Anaconda.org](https://anaconda.org/optimagic-dev/optimagic).

Following the [scientific python guidelines](https://scientific-python.org/specs/spec-0000/)
we drop the official support for Python 3.9.
Expand Down
6 changes: 3 additions & 3 deletions CITATION
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

Please use one of the following samples to cite the estimagic version (change
Please use one of the following samples to cite the optimagic version (change
x.y) from this installation

Text:

[optimagic] optimagic x.y, 2024
Janos Gabler, https://github.com/OpenSourceEconomics/optimagic
Janos Gabler, https://github.com/optimagic-dev/optimagic

BibTeX:

@Unpublished{Gabler2024,
Title = {optimagic: A library for nonlinear optimization},
Author = {Janos Gabler},
Year = {2024},
Url = {https://github.com/OpenSourceEconomics/optimagic}
Url = {https://github.com/optimagic-dev/optimagic}
}

If you are unsure about which version of optimagic you are using run: `conda list optimagic`.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# optimagic

![PyPI - Version](https://img.shields.io/pypi/v/optimagic)
[![image](https://img.shields.io/pypi/pyversions/estimagic)](https://pypi.org/project/estimagic)
[![image](https://img.shields.io/conda/vn/conda-forge/estimagic.svg)](https://anaconda.org/conda-forge/estimagic)
[![image](https://img.shields.io/conda/pn/conda-forge/estimagic.svg)](https://anaconda.org/conda-forge/estimagic)
[![image](https://img.shields.io/pypi/l/estimagic)](https://pypi.org/project/estimagic)
[![image](https://readthedocs.org/projects/estimagic/badge/?version=latest)](https://estimagic.readthedocs.io/en/latest)
[![image](https://img.shields.io/github/actions/workflow/status/OpenSourceEconomics/estimagic/main.yml?branch=main)](https://github.com/OpenSourceEconomics/estimagic/actions?query=branch%3Amain)
[![image](https://codecov.io/gh/OpenSourceEconomics/estimagic/branch/main/graph/badge.svg)](https://codecov.io/gh/OpenSourceEconomics/optimagic)
[![image](https://results.pre-commit.ci/badge/github/OpenSourceEconomics/estimagic/main.svg)](https://github.com/OpenSourceEconomics/optimagic/actions?query=branch%3Amain)
[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![image](https://img.shields.io/pypi/pyversions/optimagic)](https://pypi.org/project/optimagic)
[![image](https://img.shields.io/conda/vn/conda-forge/optimagic.svg)](https://anaconda.org/conda-forge/optimagic)
[![image](https://img.shields.io/conda/pn/conda-forge/optimagic.svg)](https://anaconda.org/conda-forge/optimagic)
[![image](https://img.shields.io/pypi/l/optimagic)](https://pypi.org/project/optimagic)
[![image](https://readthedocs.org/projects/optimagic/badge/?version=latest)](https://optimagic.readthedocs.io/en/latest)
[![image](https://img.shields.io/github/actions/workflow/status/optimagic-dev/optimagic/main.yml?branch=main)](https://github.com/optimagic-dev/optimagic/actions?query=branch%3Amain)
[![image](https://codecov.io/gh/optimagic-dev/optimagic/branch/main/graph/badge.svg)](https://codecov.io/gh/optimagic-dev/optimagic)
[![image](https://results.pre-commit.ci/badge/github/optimagic-dev/optimagic/main.svg)](https://results.pre-commit.ci/latest/github/optimagic-dev/optimagic/main)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![image](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
[![image](https://pepy.tech/badge/estimagic/month)](https://pepy.tech/project/estimagic)
[![image](https://pepy.tech/badge/optimagic/month)](https://pepy.tech/project/optimagic)
[![image](https://img.shields.io/badge/NumFOCUS-affiliated%20project-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org/sponsored-projects/affiliated-projects)
[![image](https://img.shields.io/twitter/follow/aiidateam.svg?style=social&label=Follow)](https://x.com/optimagic)

Expand Down Expand Up @@ -86,7 +86,7 @@ If you use optimagic for your research, please do not forget to cite it.
Title = {optimagic: A library for nonlinear optimization},
Author = {Janos Gabler},
Year = {2022},
Url = {https://github.com/OpenSourceEconomics/optimagic}
Url = {https://github.com/optimagic-dev/optimagic}
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

extlinks = {
"ghuser": ("https://github.com/%s", "@"),
"gh": ("https://github.com/OpenSourceEconomics/optimagic/pulls/%s", "#"),
"gh": ("https://github.com/optimagic-dev/optimagic/pulls/%s", "#"),
}

intersphinx_mapping = {
Expand Down
12 changes: 6 additions & 6 deletions docs/source/development/how_to_contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ ideas and guide the development process from the beginning. You can start a conv
by posting an issue on GitHub or by emailing [janosg](https://github.com/janosg).

To get familiar with the codebase, we recommend checking out our
[issue tracker](https://github.com/OpenSourceEconomics/optimagic/issues) for some
immediate and clearly defined tasks.
[issue tracker](https://github.com/optimagic-dev/optimagic/issues) for some immediate
and clearly defined tasks.

## 2. Before you start

Expand All @@ -30,11 +30,11 @@ contribution process (see Notes below).

## 3. Step-by-step guide

1. Fork the [optimagic repository](https://github.com/OpenSourceEconomics/optimagic/).
This action creates a copy of the repository with write access for you.
1. Fork the [optimagic repository](https://github.com/optimagic-dev/optimagic/). This
action creates a copy of the repository with write access for you.

```{note}
For regular contributors: **Clone** the [repository](https://github.com/OpenSourceEconomics/optimagic/) to your local machine and create a new branch for implementing your changes. You can push your branch directly to the remote optimagic repository and open a PR from there.
For regular contributors: **Clone** the [repository](https://github.com/optimagic-dev/optimagic/) to your local machine and create a new branch for implementing your changes. You can push your branch directly to the remote optimagic repository and open a PR from there.
```

2. Clone your forked repository to your disk. This is where you'll make all your
Expand Down Expand Up @@ -110,7 +110,7 @@ Skip the next paragraph if you haven't worked on the documentation.
```

Follow the steps outlined in the optimagic
[PR template](https://github.com/OpenSourceEconomics/optimagic/blob/main/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md)
[PR template](https://github.com/optimagic-dev/optimagic/blob/main/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md)
to describe your contribution, the problem it addresses, and your proposed solution.

Opening a PR initiates a complete CI run, including the `pytest` suite, linters, code
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ content-type = "text/markdown"
text = "MIT"

[project.urls]
Repository = "https://github.com/opensourceeconomics/optimagic"
Github = "https://github.com/opensourceeconomics/optimagic"
Tracker = "https://github.com/OpenSourceEconomics/optimagic/issues"
Repository = "https://github.com/optimagic-dev/optimagic"
Github = "https://github.com/optimagic-dev/optimagic"
Tracker = "https://github.com/optimagic-dev/optimagic/issues"


# ======================================================================================
Expand Down
53 changes: 39 additions & 14 deletions src/optimagic/deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def throw_derivative_future_warning():
msg = (
"To align optimagic with scipy.optimize, the `derivative` argument has been "
"renamed to `jac`. Please use `jac` instead of `derivative`. Using `derivative`"
" will become an error in optimagic version 0.6.0 and later."
" will become an error in optimagic version 0.6.0 and later. For more details "
"see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_derivatives.html"
)
warnings.warn(msg, FutureWarning)

Expand All @@ -55,7 +57,8 @@ def throw_derivative_kwargs_future_warning():
"To align optimagic with scipy.optimize, the `derivative_kwargs` argument has "
"been renamed to `jac_kwargs`. Please use `jac_kwargs` instead of "
"`derivative_kwargs`. Using `derivative_kwargs` will become an error in "
"optimagic version 0.6.0 and later."
"optimagic version 0.6.0 and later. For more details see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_derivatives.html"
)
warnings.warn(msg, FutureWarning)

Expand All @@ -65,7 +68,9 @@ def throw_criterion_and_derivative_future_warning():
"To align optimagic with scipy.optimize, the `criterion_and_derivative` "
"argument has been renamed to `fun_and_jac`. Please use `fun_and_jac` "
"instead of `criterion_and_derivative`. Using `criterion_and_derivative` "
"will become an error in optimagic version 0.6.0 and later."
"will become an error in optimagic version 0.6.0 and later. For more details "
"see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_derivatives.html"
)
warnings.warn(msg, FutureWarning)

Expand All @@ -76,7 +81,8 @@ def throw_criterion_and_derivative_kwargs_future_warning():
"argument has been renamed to `fun_and_jac_kwargs`. Please use "
"`fun_and_jac_kwargs` instead of `criterion_and_derivative_kwargs`. Using "
"`criterion_and_derivative_kwargs` will become an error in optimagic version "
"0.6.0 and later."
"0.6.0 and later. For more details see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_derivatives.html"
)
warnings.warn(msg, FutureWarning)

Expand All @@ -94,7 +100,9 @@ def throw_multistart_options_future_warning():
msg = (
"Specifying multistart options via the argument `multistart_options` is "
"deprecated and will be removed in optimagic version 0.6.0 and later. You can "
"pass these options directly to the `multistart` argument instead."
"pass these options directly to the `multistart` argument instead. For more "
"details see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_multistart.html"
)
warnings.warn(msg, FutureWarning)

Expand Down Expand Up @@ -279,7 +287,8 @@ def throw_dict_output_warning():
"0.6.0 and later. Please use the optimagic.mark.scalar, optimagic.mark."
"least_squares, or optimagic.mark.likelihood decorators to indicate the type "
"of problem you are solving. Use optimagic.FunctionValue objects to return "
"additional information for the logging."
"additional information for the logging. Please see the documentation for more "
"details: https://optimagic.readthedocs.io/en/latest/how_to/how_to_criterion_function.html"
)
warnings.warn(msg, FutureWarning)

Expand Down Expand Up @@ -367,6 +376,10 @@ def throw_dict_constraints_future_warning_if_required(
)
for t in types:
msg += f" {{'type': '{t}', ...}} -> {replacements[t]}(...)\n"
msg += (
"\nFor more details see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_constraints.html"
)

warnings.warn(msg, FutureWarning)

Expand All @@ -387,14 +400,17 @@ def replace_and_warn_about_deprecated_multistart_options(options):
msg = (
"The `share_optimization` option is deprecated and will be removed in "
"version 0.6.0. Use `stopping_maxopt` instead to specify the number of "
"optimizations directly."
"optimizations directly. For more details see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_multistart.html"
)
warnings.warn(msg, FutureWarning)

if options.convergence_relative_params_tolerance is not None:
msg = (
"The `convergence_relative_params_tolerance` option is deprecated and will "
"be removed in version 0.6.0. Use `convergence_xtol_rel` instead."
"be removed in version 0.6.0. Use `convergence_xtol_rel` instead. For more "
"details see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_convergence.html"
)
warnings.warn(msg, FutureWarning)
if options.convergence_xtol_rel is None:
Expand All @@ -407,7 +423,9 @@ def replace_and_warn_about_deprecated_multistart_options(options):
"The `optimization_error_handling` option is deprecated and will be "
"removed in version 0.6.0. Setting this attribute also sets the error "
"handling for exploration. Use the new `error_handling` option to set the "
"error handling for both optimization and exploration."
"error handling for both optimization and exploration. For more details "
"see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_error_handling.html"
)
warnings.warn(msg, FutureWarning)
if options.error_handling is None:
Expand All @@ -418,7 +436,9 @@ def replace_and_warn_about_deprecated_multistart_options(options):
"The `exploration_error_handling` option is deprecated and will be "
"removed in version 0.6.0. Setting this attribute also sets the error "
"handling for exploration. Use the new `error_handling` option to set the "
"error handling for both optimization and exploration."
"error handling for both optimization and exploration. For more details "
"see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_error_handling.html"
)
warnings.warn(msg, FutureWarning)
if options.error_handling is None:
Expand All @@ -435,7 +455,9 @@ def replace_and_warn_about_deprecated_base_steps(
msg = (
"The `base_steps` argument is deprecated and will be removed alongside "
"Richardson extrapolation in optimagic version 0.6.0. To specify the "
"step size use the `step_size` argument instead."
"step size use the `step_size` argument instead. For more details see the "
"documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_step_size.html"
)
warnings.warn(msg, FutureWarning)

Expand All @@ -448,10 +470,11 @@ def replace_and_warn_about_deprecated_base_steps(
def replace_and_warn_about_deprecated_derivatives(candidate, name):
msg = (
f"Specifying a dictionary of {name} functions is deprecated and will be "
"removed in optimagic version 0.6.0. Please specify a single function that has "
"removed in optimagic version 0.6.0. Please specify a single function that "
"returns the correct derivative for your optimizer or a list of functions that "
"are decorated with the `mark.scalar`, `mark.likelihood` or "
"`mark.least_squares` decorators."
"`mark.least_squares` decorators. For more details see the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_derivatives.html"
)
warnings.warn(msg, FutureWarning)

Expand Down Expand Up @@ -552,7 +575,9 @@ def pre_process_constraints(
else:
msg = (
f"Invalid constraint type: {type(constraints)}. Must be a constraint "
"object or list thereof imported from `optimagic`."
"object or list thereof imported from `optimagic`. For more details see "
"the documentation: "
"https://optimagic.readthedocs.io/en/latest/how_to/how_to_constraints.html"
)
raise InvalidConstraintError(msg)

Expand Down
6 changes: 3 additions & 3 deletions src/optimagic/optimization/create_optimization_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,23 +282,23 @@ def create_optimization_problem(
if hess is not None:
msg = (
"The hess argument is not yet supported in optimagic. Creat an issue on "
"https://github.com/OpenSourceEconomics/optimagic/ if you have urgent need "
"https://github.com/optimagic-dev/optimagic/ if you have urgent need "
"for this feature."
)
raise NotImplementedError(msg)

if hessp is not None:
msg = (
"The hessp argument is not yet supported in optimagic. Creat an issue on "
"https://github.com/OpenSourceEconomics/optimagic/ if you have urgent need "
"https://github.com/optimagic-dev/optimagic/ if you have urgent need "
"for this feature."
)
raise NotImplementedError(msg)

if callback is not None:
msg = (
"The callback argument is not yet supported in optimagic. Creat an issue "
"on https://github.com/OpenSourceEconomics/optimagic/ if you have urgent "
"on https://github.com/optimagic-dev/optimagic/ if you have urgent "
"need for this feature."
)
raise NotImplementedError(msg)
Expand Down
Loading

0 comments on commit d476eba

Please sign in to comment.