diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6d11761..9806aa5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,13 +7,13 @@ on: # Trigger on any push to the main push: branches: - - main + - master - development # Trigger on any push to a PR that targets main pull_request: branches: - - main + - master - development permissions: @@ -23,49 +23,16 @@ env: name: DEHB jobs: - build-and-deploy: + deploy: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - pip install ".[dev]" - - - name: Make docs - run: | - make clean - make docs - - - name: Pull latest gh-pages - if: (contains(github.ref, 'development') || contains(github.ref, 'main')) - run: | - cd .. - git clone https://github.com/${{ github.repository }}.git --branch gh-pages --single-branch gh-pages - - - name: Copy new docs into gh-pages - if: (contains(github.ref, 'development') || contains(github.ref, 'main')) - run: | - branch_name=${GITHUB_REF##*/} - cd ../gh-pages - rm -rf $branch_name - cp -r ../${{ env.name }}/docs/build/html $branch_name - - - name: Push to gh-pages - if: (contains(github.ref, 'development') || contains(github.ref, 'main')) - run: | - last_commit=$(git log --pretty=format:"%an: %s") - cd ../gh-pages - branch_name=${GITHUB_REF##*/} - git add $branch_name/ - git config --global user.name 'Github Actions' - git config --global user.email 'not@mail.com' - git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} - git commit -am "$last_commit" - git push + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - uses: actions/cache@v3 + with: + key: ${{ github.ref }} + path: .cache + - run: pip install "mkdocs-material" "mkdocstrings[python]" + - run: mkdocs gh-deploy --force \ No newline at end of file diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index f0f7778..e17b845 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -7,13 +7,13 @@ on: # Triggers with push to main push: branches: - - main + - master - development # Triggers with push to a PR aimed at main pull_request: branches: - - main + - master - development schedule: diff --git a/README.md b/README.md index 25b0391..4932e93 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # DEHB: Evolutionary Hyperband for Scalable, Robust and Efficient Hyperparameter Optimization [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Tests](https://github.com/automl/DEHB/actions/workflows/pytest.yml/badge.svg)](https://github.com/automl/DEHB/actions/workflows/pytest.yml) +[![docs](https://github.com/automl/DEHB/actions/workflows/docs.yml/badge.svg)](https://github.com/automl/DEHB/actions/workflows/docs.yml) [![Coverage Status](https://coveralls.io/repos/github/automl/DEHB/badge.svg)](https://coveralls.io/github/automl/DEHB) [![PyPI](https://img.shields.io/pypi/v/dehb)](https://pypi.org/project/dehb/) [![Static Badge](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20-blue)](https://pypi.org/project/dehb/) diff --git a/dehb/__init__.py b/dehb/__init__.py deleted file mode 100644 index 8e13c4e..0000000 --- a/dehb/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .optimizers import DE, AsyncDE -from .optimizers import DEHB -from .utils import SHBracketManager - diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index c46d87d..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -SPHINXBUILD = sphinx-build -BUILDDIR = build -SPHINXOPTS = -ALLSPHINXOPTS = $(SPHINXOPTS) . - -.PHONY: clean html linkcheck examples docs - -clean: - rm -rf $(BUILDDIR)/* - rm -rf api - rm -rf examples - -html: - SPHINX_GALLERY_PLOT=False $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -linkcheck: - SPHINX_GALLERY_PLOT=False $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -examples: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -docs: html linkcheck - diff --git a/docs/advanced_usage/index.rst b/docs/advanced_usage/index.rst deleted file mode 100644 index ddca77c..0000000 --- a/docs/advanced_usage/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -Advanced Usage -============== - -.. toctree:: - :hidden: - :maxdepth: 2 - - -.. warning:: - - This page is under construction. \ No newline at end of file diff --git a/docs/api.rst b/docs/api.rst deleted file mode 100644 index 4ca79dc..0000000 --- a/docs/api.rst +++ /dev/null @@ -1,9 +0,0 @@ -API References --------------- - - -.. autosummary:: - :toctree: api - :recursive: - - dehb diff --git a/docs/assets/automl_org.png b/docs/assets/automl_org.png new file mode 100644 index 0000000..e8c0f3a Binary files /dev/null and b/docs/assets/automl_org.png differ diff --git a/docs/basic_usage/index.rst b/docs/basic_usage/index.rst deleted file mode 100644 index 8c7e9f5..0000000 --- a/docs/basic_usage/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -Basic Usage -=========== - -.. toctree:: - :hidden: - :maxdepth: 2 - - -.. warning:: - - This page is under construction. \ No newline at end of file diff --git a/docs/commands.rst b/docs/commands.rst deleted file mode 100644 index 9a4c073..0000000 --- a/docs/commands.rst +++ /dev/null @@ -1,41 +0,0 @@ -Helpful Commands -================ - -.. warning:: - - Remove this page in production mode. - - -.. note:: - - This is a note. - - -.. code:: - - # Let's output some code here - print("Hello World") - - -Reference to a link: - `Your link `_ or ``_. - - -Reference to the glossary: - :term:`Your term ` or :term:`BO`. - - -Reference to another page: - :ref:`Your page` or :ref:`Installation` - - -Write a list: - -* Item 1 -* Item 2 - - -Write an ordered list: - -#. Step 1 -#. Step 2 \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index eb17c83..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,17 +0,0 @@ -import automl_sphinx_theme - -from dehb import copyright, author, version, name - - -options = { - "copyright": copyright, - "author": author, - "version": version, - "name": name, - "html_theme_options": { - "github_url": "https://github.com/automl/DEHB", - "twitter_url": "https://twitter.com/automl_org?lang=de", - } -} - -automl_sphinx_theme.set_options(globals(), options) diff --git a/docs/faq.rst b/docs/faq.rst deleted file mode 100644 index 0dfa74e..0000000 --- a/docs/faq.rst +++ /dev/null @@ -1,10 +0,0 @@ -Frequently Asked Questions -========================== - -.. warning:: - - This page is under construction. - - -Your first question here - Your answer here diff --git a/docs/glossary.rst b/docs/glossary.rst deleted file mode 100644 index 707c8a2..0000000 --- a/docs/glossary.rst +++ /dev/null @@ -1,8 +0,0 @@ -Glossary -======== - -.. glossary:: - - BO - Bayesian Optimization. A Black-Box optimization algorithm weighing exploration & exploitation - to find the minimum of its objective. diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..77e18f1 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,3 @@ +# Welcome to DEHB + +Evolutionary Hyperband for Scalable, Robust and Efficient Hyperparameter Optimization. diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 1109221..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,18 +0,0 @@ -Home -==== - -.. toctree:: - :hidden: - :maxdepth: 2 - - installation - examples/index - basic_usage/index - advanced_usage/index - commands - api - glossary - faq - - -Lorem ipsum dolor. \ No newline at end of file diff --git a/docs/installation.rst b/docs/installation.rst deleted file mode 100644 index 22c30be..0000000 --- a/docs/installation.rst +++ /dev/null @@ -1,6 +0,0 @@ -Installation -============ - -.. warning:: - - This page is under construction. \ No newline at end of file diff --git a/docs/references/bracket_manager.md b/docs/references/bracket_manager.md new file mode 100644 index 0000000..cd256be --- /dev/null +++ b/docs/references/bracket_manager.md @@ -0,0 +1,3 @@ +# Bracket manager + +::: dehb.utils.bracket_manager \ No newline at end of file diff --git a/docs/references/de.md b/docs/references/de.md new file mode 100644 index 0000000..5e425c5 --- /dev/null +++ b/docs/references/de.md @@ -0,0 +1,3 @@ +# DE + +::: dehb.optimizers.de \ No newline at end of file diff --git a/docs/references/dehb.md b/docs/references/dehb.md new file mode 100644 index 0000000..ea2c06e --- /dev/null +++ b/docs/references/dehb.md @@ -0,0 +1,3 @@ +# DEHB + +::: dehb.optimizers.dehb \ No newline at end of file diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..a795c05 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,6 @@ +Examples +======== + +We provide several examples of how to use DEHB with Python. The examples were structured in order to give the user an +introduction to the interface of DEHB and how to use it. Moreover the examples show how to use DEHB with and without +the ConfigSpace library and an exemplary optimization with PyTorch. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..f2afacb --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,72 @@ +site_name: DEHB + +nav: + - Home: index.md + - Code Reference: + - DEHB: references/dehb.md + - DE: references/de.md + - Bracket Manager: references/bracket_manager.md + +theme: + name: material + logo: assets/automl_org.png + favicon: assets/automl_org.png + icon: + repo: fontawesome/brands/github + features: + - content.code.annotate + - content.code.copy + - navigation.footer + - navigation.tabs + - navigation.tabs.sticky + - toc.follow + - header.autohide + - search.suggest + - search.highlight + - search.share + font: + text: Roboto + code: Roboto Mono + palette: + - scheme: slate + media: "(prefers-color-scheme: dark)" + primary: indigo + accent: deep purple + toggle: + icon: material/eye-outline + name: Switch to light mode + + # Palette toggle for light mode + - scheme: default + media: "(prefers-color-scheme: light)" + primary: indigo + accent: deep purple + toggle: + icon: material/eye + name: Switch to dark mode + +plugins: + - search + - mkdocstrings: + default_handler: python + enable_inventory: true + custom_templates: docs/_templates + handlers: + python: + paths: [src] + options: # https://mkdocstrings.github.io/python/usage/ + docstring_section_style: spacy + show_docstring_attributes: true + show_docstring_description: true + show_root_heading: false + show_root_toc_entry: false + show_object_full_path: false + merge_init_into_class: true + docstring_style: google + show_if_no_docstring: false + show_bases: true + show_source: true + members_order: "source" + show_signature: true + separate_signature: false + show_signature_annotations: false \ No newline at end of file diff --git a/dehb/README.md b/src/dehb/README.md similarity index 100% rename from dehb/README.md rename to src/dehb/README.md diff --git a/src/dehb/__init__.py b/src/dehb/__init__.py new file mode 100644 index 0000000..a64d457 --- /dev/null +++ b/src/dehb/__init__.py @@ -0,0 +1,11 @@ +import datetime +from .optimizers import DE, AsyncDE +from .optimizers import DEHB +from .utils import SHBracketManager + +name = "DEHB" +author = ( + "N. Awad and N. Mallik and F. Hutter" +) +copyright = f"Copyright {datetime.date.today().strftime('%Y')}, Noor Awad, Neeratyoy Mallik and Frank Hutter" +version = "0.0.5" \ No newline at end of file diff --git a/dehb/optimizers/__init__.py b/src/dehb/optimizers/__init__.py similarity index 100% rename from dehb/optimizers/__init__.py rename to src/dehb/optimizers/__init__.py diff --git a/dehb/optimizers/de.py b/src/dehb/optimizers/de.py similarity index 100% rename from dehb/optimizers/de.py rename to src/dehb/optimizers/de.py diff --git a/dehb/optimizers/dehb.py b/src/dehb/optimizers/dehb.py similarity index 99% rename from dehb/optimizers/dehb.py rename to src/dehb/optimizers/dehb.py index e4af345..aa496cb 100644 --- a/dehb/optimizers/dehb.py +++ b/src/dehb/optimizers/dehb.py @@ -10,8 +10,8 @@ from loguru import logger from distributed import Client -from dehb.optimizers import DE, AsyncDE -from dehb.utils import SHBracketManager +from src.dehb.optimizers import DE, AsyncDE +from src.dehb.utils import SHBracketManager logger.configure(handlers=[{"sink": sys.stdout, "level": "INFO"}]) diff --git a/dehb/utils/__init__.py b/src/dehb/utils/__init__.py similarity index 100% rename from dehb/utils/__init__.py rename to src/dehb/utils/__init__.py diff --git a/dehb/utils/bracket_manager.py b/src/dehb/utils/bracket_manager.py similarity index 100% rename from dehb/utils/bracket_manager.py rename to src/dehb/utils/bracket_manager.py diff --git a/tests/test_dehb.py b/tests/test_dehb.py index 1170830..47f45af 100644 --- a/tests/test_dehb.py +++ b/tests/test_dehb.py @@ -3,7 +3,7 @@ import ConfigSpace import numpy as np import time -from dehb.optimizers.dehb import DEHB +from src.dehb.optimizers.dehb import DEHB def create_toy_searchspace(): """Creates a toy searchspace with a single hyperparameter. diff --git a/tests/test_imports.py b/tests/test_imports.py new file mode 100644 index 0000000..4bd1c5e --- /dev/null +++ b/tests/test_imports.py @@ -0,0 +1,28 @@ +import importlib + +class TestImports(): + """This class bundles all import tests for the DEHB project. + """ + def test_dehb_import(self): + """Test if DEHB can be imported properly. + """ + try: + importlib.import_module("src.dehb.optimizers.dehb") + except ImportError as e: + assert False, f"Failed to import dehb: {e}" + + def test_de_import(self): + """Test if DE can be imported properly. + """ + try: + importlib.import_module("src.dehb.optimizers.de") + except ImportError as e: + assert False, f"Failed to import de: {e}" + + def test_utils_import(self): + """Test if BracketManager can be imported properly. + """ + try: + importlib.import_module("src.dehb.utils") + except ImportError as e: + assert False, f"Failed to import dehb: {e}" \ No newline at end of file