Skip to content

Commit

Permalink
Merge branch 'main' into update-flaml
Browse files Browse the repository at this point in the history
  • Loading branch information
bpkroth authored Jan 21, 2025
2 parents b582f3d + e91546e commit 148a4be
Show file tree
Hide file tree
Showing 74 changed files with 762 additions and 390 deletions.
1 change: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"huntertran.auto-markdown-toc",
"ibm.output-colorizer",
"lextudio.restructuredtext",
"matangover.mypy",
"ms-azuretools.vscode-docker",
"ms-python.black-formatter",
"ms-python.pylint",
Expand Down
10 changes: 5 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

_A brief, descriptive title of your changes (e.g., `Fix bug in data parser for edge cases`)_

---
______________________________________________________________________

## Description

_Provide a concise summary of what this PR does. Explain why this change is necessary and what problems it addresses._

- **Issue link**: (optional) _Link the relevant issue number or GitHub Issue link if applicable (e.g., Closes #123)._

---
______________________________________________________________________

## Type of Change

Expand All @@ -25,16 +25,16 @@ _Indicate the type of change by choosing one (or more) of the following:_
- 📝 Documentation update
- 🧪 Tests

---
______________________________________________________________________

## Testing

_Describe briefly how you tested your changes._

---
______________________________________________________________________

## Additional Notes (optional)

_Add any additional context or information for reviewers._

---
______________________________________________________________________
69 changes: 64 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# Enable automatic updates via Github Actions as well.
# See https://pre-commit.ci
ci:
# Let pre-commit.ci automatically update PRs with formatting fixes.
autofix_prs: true
# skip local hooks - they should be managed manually via conda-envs/*.yml
skip: [mypy, pylint, pycodestyle, pyright]
autoupdate_schedule: monthly
autoupdate_commit_msg: |
[pre-commit.ci] pre-commit autoupdate
for more information, see https://pre-commit.ci
NOTE: Be sure to also check for other possible hook updates in the conda-envs/*.yml files (e.g., mypy, pylint, etc.).
See Also:
- https://github.com/microsoft/MLOS/blob/main/conda-envs/mlos.yml
- https://pypi.org/project/mypy/
- https://pypi.org/project/pyright/
- https://pypi.org/project/pylint/
- https://pypi.org/project/pycodestyle/
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [pre-commit]
Expand All @@ -6,7 +27,7 @@ default_stages: [pre-commit]
# are partitioned and the hook executable called in parallel across them, not
# whether hooks themselves are parallelized.
# As such, some hooks (e.g., pylint) which do internal parallelism need it set
# for effeciency and correctness anyways.
# for efficiency and correctness anyways.

repos:
#
Expand All @@ -26,12 +47,26 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
stages: [pre-commit, manual]
# TODO:
#- id: pretty-format-json
# args: [--autofix, --no-sort-keys]
# stages: [pre-commit, manual]
- id: trailing-whitespace
stages: [pre-commit, manual]
- repo: https://gitlab.com/bmares/check-json5
rev: v1.0.0
hooks:
- id: check-json5
alias: check-json
types_or: [file, json]
files: '\.json[c]?$'
# FIXME: This removes comments.
# See Also: https://github.com/dpranke/pyjson5/issues/28
#- repo: https://github.com/whtsky/pre-commit-pretty-format-json5
# rev: "1.0.0"
# hooks:
# - id: pretty-format-json5
# alias: pretty-format-json
# args: [--no-sort-keys]
# stages: [pre-commit, manual]
# types_or: [file, json]
# files: '\.json[c]?$'
- repo: https://github.com/johann-petrak/licenseheaders
rev: v0.8.8
hooks:
Expand Down Expand Up @@ -62,6 +97,16 @@ repos:
hooks:
- id: docformatter
stages: [pre-commit, manual]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat-black
- mdformat_frontmatter
- mdformat-toc

#
# Linting
#
Expand Down Expand Up @@ -96,6 +141,20 @@ repos:
(?x)^(
doc/source/conf.py
)$
- id: pyright
name: pyright
entry: pyright
language: system
types: [python]
require_serial: true
exclude: |
(?x)^(
doc/source/conf.py|
mlos_core/setup.py|
mlos_bench/setup.py|
mlos_viz/setup.py|
conftest.py
)$
- id: mypy
name: mypy
entry: mypy
Expand Down
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"huntertran.auto-markdown-toc",
"ibm.output-colorizer",
"lextudio.restructuredtext",
"matangover.mypy",
"ms-azuretools.vscode-docker",
"ms-python.black-formatter",
"ms-python.pylint",
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,5 @@
"python.testing.unittestEnabled": false,
"debugpy.debugJustMyCode": false,
"python.analysis.autoImportCompletions": true,
"python.analysis.supportRestructuredText": true,
"python.analysis.typeCheckingMode": "standard"
"python.analysis.supportRestructuredText": true
}
102 changes: 52 additions & 50 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ Simply open the project in VSCode and follow the prompts to build and open the d
1. Create the `mlos` Conda environment.

```sh
conda env create -f conda-envs/mlos.yml
```
```sh
conda env create -f conda-envs/mlos.yml
```

> See the [`conda-envs/`](./conda-envs/) directory for additional conda environment files, including those used for Windows (e.g. [`mlos-windows.yml`](./conda-envs/mlos-windows.yml)).
> See the [`conda-envs/`](./conda-envs/) directory for additional conda environment files, including those used for Windows (e.g. [`mlos-windows.yml`](./conda-envs/mlos-windows.yml)).
or

```sh
# This will also ensure the environment is update to date using "conda env update -f conda-envs/mlos.yml"
make conda-env
```
```sh
# This will also ensure the environment is update to date using "conda env update -f conda-envs/mlos.yml"
make conda-env
```

> Note: the latter expects a *nix environment.
> Note: the latter expects a \*nix environment.
1. Initialize the shell environment.

```sh
conda activate mlos
```
```sh
conda activate mlos
```

### Details

Expand All @@ -62,45 +62,47 @@ Simply open the project in VSCode and follow the prompts to build and open the d
We expect development to follow a typical "forking" style workflow:

1. Fork a copy of the [MLOS repo in Github](https://github.com/microsoft/MLOS).

1. Create a development (a.k.a. topic) branch off of `main` to work on changes.

For instance:
For instance:

```shell
git checkout -b YourDevName/some-topic-description main
```
```shell
git checkout -b YourDevName/some-topic-description main
```

1. Ensure all of the lint checks and tests pass.

The easiest way to do this is to run the `make` commands that are also used in the CI pipeline:
The easiest way to do this is to run the `make` commands that are also used in the CI pipeline:

```shell
# All at once in parallel.
make all
```shell
# All at once in parallel.
make all

# Or individually (for easier debugging)
make format
make check
make test
make dist-test
make doc-test
```
# Or individually (for easier debugging)
make format
make check
make test
make dist-test
make doc-test
```

> Note: `make format` and `make check` use [`pre-commit`](https://pre-commit.com/) to run checks and auto-formatting.
> See the [`.pre-commit-config.yaml`](./.pre-commit-config.yaml) file for more details.
> You can also run `pre-commit install` to enable the checks in your local git hooks.
>
> See the [documentation README](./doc/README.md) for more information on documentation and its testing.
> Note: `make format` and `make check` use [`pre-commit`](https://pre-commit.com/) to run checks and auto-formatting.
> See the [`.pre-commit-config.yaml`](./.pre-commit-config.yaml) file for more details.
> You can also run `pre-commit install` to enable the checks in your local git hooks.
>
> See the [documentation README](./doc/README.md) for more information on documentation and its testing.
1. Submit changes for inclusion as a [Pull Request on Github](https://github.com/microsoft/MLOS/pulls).

Some notes on organizing changes to help reviewers:
Some notes on organizing changes to help reviewers:

1. Please try to keep PRs small whenver possible and don't include unnecessaary formatting changes.
1. Larger changes can be planned in [Issues](https://github.com/microsoft/MLOS/issues), prototyped in a large draft PR for early feedback, and split into smaller PRs via discussion.
1. All changes should include test coverage (either new or existing).
1. Please try to keep PRs small whenver possible and don't include unnecessaary formatting changes.
1. Larger changes can be planned in [Issues](https://github.com/microsoft/MLOS/issues), prototyped in a large draft PR for early feedback, and split into smaller PRs via discussion.
1. All changes should include test coverage (either new or existing).

1. PRs are associated with [Github Issues](https://github.com/microsoft/MLOS/issues) and need [MLOS-committers](https://github.com/orgs/microsoft/teams/MLOS-committers) to sign-off (in addition to other CI pipeline checks like tests and lint checks to pass).

1. Once approved, the PR can be completed using a squash merge in order to keep a nice linear history.

## Distributing
Expand All @@ -109,24 +111,24 @@ You can also locally build and install from wheels like so:

1. Build the *wheel* file(s)

```sh
make dist
```
```sh
make dist
```

2. Install it.
1. Install it.

```sh
# this will install just the optimizer component with SMAC support:
pip install "dist/tmp/mlos_core-latest-py3-none-any.whl[smac]"
```
```sh
# this will install just the optimizer component with SMAC support:
pip install "dist/tmp/mlos_core-latest-py3-none-any.whl[smac]"
```

```sh
# this will install both the optimizer and the experiment runner:
pip install "dist/mlos_bench-latest-py3-none-any.whl[azure]"
```
```sh
# this will install both the optimizer and the experiment runner:
pip install "dist/mlos_bench-latest-py3-none-any.whl[azure]"
```

> Note: exact versions may differ due to automatic versioning so the `-latest-` part is a symlink.
> If distributing elsewhere, adjust for the current version number in the module's `dist` directory.
> Note: exact versions may differ due to automatic versioning so the `-latest-` part is a symlink.
> If distributing elsewhere, adjust for the current version number in the module's `dist` directory.
### See Also

Expand Down
Loading

0 comments on commit 148a4be

Please sign in to comment.