Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build/changes for distribution build #134

Merged
merged 5 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ include README.rst
recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-exclude container_recipes *
recursive-exclude examples *
recursive-exclude notebooks *
recursive-exclude scripts *
recursive-exclude subselection *

recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
recursive-include carps/configs *
59 changes: 55 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,66 @@
.PHONY: test docs check install-dev
# These have been configured to only really run short tasks. Longer form tasks
# are usually completed in github actions.

SHELL := /bin/bash

NAME := CARP-S
PACKAGE_NAME := carps
VERSION := 0.1.0

DIST := dist

.PHONY: help install-dev clean-build check build docs publish test

help:
@echo "Makefile ${NAME}"
@echo "* install-dev to install all dev requirements and install pre-commit"
@echo "* clean-build to clean any build files"
@echo "* check to run the pre-commit check"
@echo "* build to build a dist"
@echo "* docs to generate and view the html files, checks links"
@echo "* publish to help publish the current branch to pypi"
@echo "* test to run the tests"

PYTHON ?= python

test:
python -m pytest tests
$(PYTHON) -m pytest tests

docs:
python -m webbrowser -t "http://127.0.0.1:8000/"
python -m mkdocs serve --clean
$(PYTHON) -m webbrowser -t "http://127.0.0.1:8000/"
$(PYTHON) -m mkdocs serve --clean

check:
pre-commit run --all-files

install-dev:
pip install -e ".[dev]"
pre-commit install

clean-build:
rm -rf ${DIST}

# Build a distribution in ./dist
build:
$(PYTHON) -m pip install build
$(PYTHON) -m build --sdist

# Publish to testpypi
# Will echo the commands to actually publish to be run to publish to actual PyPi
# This is done to prevent accidental publishing but provide the same conveniences
publish: clean-build build
read -p "Did you update the version number in Makefile, pyproject.toml, and CITATION.cff?"

$(PIP) install twine
$(PYTHON) -m twine upload --repository testpypi ${DIST}/*
@echo
@echo "Test with the following:"
@echo "* Create a new virtual environment to install the uplaoded distribution into"
@echo "* Run the following:"
@echo "--- pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ${PACKAGE_NAME}==${VERSION}"
@echo
@echo "* Run this to make sure it can import correctly, plus whatever else you'd like to test:"
@echo "--- python -c 'import ${PACKAGE_NAME}'"
@echo
@echo "Once you have decided it works, publish to actual pypi with"
@echo "--- python -m twine upload dist/*"
44 changes: 34 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,36 @@ For more details on CARP-S, please have a look at the
[documentation](https://AutoML.github.io/CARP-S/latest/).

## Installation
To install CARP-S, you can use the following commands:
To install CARP-S, you can simply use `pip`:

```bash
conda create -n carps python=3.11
conda activate carps
pip install carps
```

Additionally, you need to install the requirements for the benchmark and optimizer that you want to use.
For example, if you want to use the `SMAC2.0` optimizer and the `BBOB` benchmark, you need to install the
requirements for both of them via:

```bash
pip install carps[smac,bbob]
```

All possible install options for benchmarks are:
```bash
dummy,bhob,hpob,hpobench,mfpbench,pymoo,yahpoo
```

All possible install options for optimizers are:
```bash
dummy,dehb,hebo,nevergrad,optuna,skopt,smac,smac14,synetune
```

Please note that installing all requirements for all benchmarks and optimizers in a single
environment will not be possible due to conflicting dependencies.

If you want to install from source, you can clone the repository and install CARP-S via:

```bash
git clone https://github.com/AutoML/CARP-S.git
Expand All @@ -26,19 +55,14 @@ conda activate carps
pip install .
```

If you want to install CARP-S for development, you can use the following command:
For installing the requirements for the optimizer and benchmark, you can then use the following command:
```bash
# Install for development
make install-dev
pip install ".[smac,bbob]"
```

Additionally, you need to install the requirements for the benchmark and optimizer that you want to use.
For example, if you want to use the `SMAC2.0` optimizer and the `BBOB` benchmark, you need to install the
requirements for both of them.

If you want to install CARP-S for development, you can use the following command:
```bash
pip install -r container_recipes/optimizers/SMAC3/SMAC3_requirements.txt
pip install -r container_recipes/benchmarks/BBOB/BBOB_requirements.txt
make install-dev
```

## Minimal Example
Expand Down
2 changes: 1 addition & 1 deletion carps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime

name = "SMACBenchmarking"
name = "CARP-S"
package_name = "carps"
author = "AutoML"
author_email = "[email protected]"
Expand Down
55 changes: 51 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
requires = ["setuptools >= 70.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["carps"]
[tool.setuptools.packages.find]

[project]
name = "carps"
Expand Down Expand Up @@ -78,8 +77,56 @@ dev = [
"pytest-coverage",
"pytest-cases",
]


dummy = ["scikit-learn"]
bbob = ["ioh==0.3.14"]
hpob = ["xgboost==1.5.2"]
hpobench = [
"hpobench@git+https://github.com/automl/HPOBench.git",
"tqdm",
"pandas==1.2.4",
"Cython==0.29.36",
"scikit-learn==0.24.2", #--no-build-isolation
"openml==0.12.2",
"xgboost==1.3.1",
"ConfigSpace==0.6.1",
]
mfpbench = [
"scikit-learn",
"mf-prior-bench",
# PD1
"xgboost>=1.7",
]
pymoo = ["pymoo"]
yahpoo = [
"yahpo-gym==1.0.1",
"onnxruntime==1.15.0",
"ConfigSpace~=0.6.0",
]
dehb = ["dehb"]
hebo = ["hebo==0.3.5"]
nevergrad = [
"nevergrad",
"hyperopt",
"bayesian-optimization",
"ioh==0.3.14",
# make sure that joblib is quite new >= 1.4.2
]
optuna = ["optuna"]
skopt = ["scikit-optimize"]
smac = [
"swig",
"smac>=2.1.0"
]
smac14 = [
"smac==1.4",
"scikit-learn==1.1.3"
]
synetune = [
"syne-tune[basic]==0.13.0",
# for bore
"xgboost==2.0.3",
"scikit-learn==1.4.0",
]

# https://docs.pytest.org/en/7.2.x/reference/reference.html#ini-options-ref
[tool.pytest.ini_options]
Expand Down