Skip to content

Commit 8d64a8d

Browse files
Easy api (#255)
* Add `py.typed` * Trim whitespace * Simple HP types interface * Add dictionary parsing * Add note about compiling from source * Specified space types * Added examples to readme and docs * Add `py.typed` * Trim whitespace * Simple HP types interface * Add dictionary parsing * Add note about compiling from source * Pre-commit fixes * Specified space types * Added examples to readme and docs * Add requirement for `typing_extensions` * Remove unknown `bibtex` lexer * Fix doctests * Add code doc for Int * Docs for Float's * Fix import bug * Add doc for categoricals * Add doc for distributions * Integrated AutoML Sphinx Theme * Add in some removed plugins * Add a Makefile * Increased veresion * Big ol doc update * Deflate API * Code fix * Comments * Remove references to `examples` folder for docs * Emphasise Ordinal and add more doc on diff for HP * Change from Int to Integer * Fix unused import * Fix doctests, make reproducible * Rename "master" to "main" around the place * Update changelog * Add tolerance to failing test * Update docs workflow properly * Revert back to v3 * Compile extra requirements into just "dev" * Fix Makefile * Fix install in pytest workflow * Export types * Make authors it's own file like version * Add some more indicators of Mac/Windows support * Fix doctest Co-authored-by: René Sass <mail@renesass.de>
1 parent e681dc9 commit 8d64a8d

54 files changed

Lines changed: 2508 additions & 1494 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,64 @@
1-
name: Docs
1+
name: docs
22

33
on:
4-
54
# Trigger manually
65
workflow_dispatch:
76

8-
# Trigger on any push to the master
7+
# Trigger on any push to the main
98
push:
109
branches:
11-
- master
10+
- main
11+
- development
1212

13-
# Trigger on any push to a PR that targets master
13+
# Trigger on any push to a PR that targets main
1414
pull_request:
1515
branches:
16-
- master
16+
- main
17+
- development
1718

18-
jobs:
19+
permissions:
20+
contents: write
21+
22+
env:
23+
name: "ConfigSpace"
1924

25+
jobs:
2026
build-and-deploy:
2127
runs-on: ubuntu-latest
2228
steps:
2329
- name: Checkout
24-
uses: actions/checkout@v2
30+
uses: actions/checkout@v3
2531

2632
- name: Setup Python
27-
uses: actions/setup-python@v2
33+
uses: actions/setup-python@v3
2834
with:
29-
python-version: 3.8
35+
python-version: "3.8"
3036

3137
- name: Install dependencies
3238
run: |
33-
pip install -e .[docs,examples,examples_unix]
39+
pip install ".[dev]"
3440
3541
- name: Make docs
3642
run: |
37-
cd docs
38-
make html
39-
40-
- name: Run doctests
41-
run: |
42-
cd docs
43-
make doctest
43+
make clean
44+
make docs
4445
4546
- name: Pull latest gh-pages
46-
if: (contains(github.ref, 'master')) && github.event_name == 'push'
47+
if: (contains(github.ref, 'develop') || contains(github.ref, 'main')) && github.event_name == 'push'
4748
run: |
4849
cd ..
49-
git clone https://github.com/automl/ConfigSpace.git --branch gh-pages --single-branch gh-pages
50+
git clone https://github.com/${{ github.repository }}.git --branch gh-pages --single-branch gh-pages
5051
5152
- name: Copy new docs into gh-pages
52-
if: (contains(github.ref, 'develop') || contains(github.ref, 'master')) && github.event_name == 'push'
53+
if: (contains(github.ref, 'develop') || contains(github.ref, 'main')) && github.event_name == 'push'
5354
run: |
5455
branch_name=${GITHUB_REF##*/}
5556
cd ../gh-pages
5657
rm -rf $branch_name
57-
cp -r ../ConfigSpace/docs/build/html $branch_name
58+
cp -r ../${{ env.name }}/docs/build/html $branch_name
5859
5960
- name: Push to gh-pages
60-
if: (contains(github.ref, 'master')) && github.event_name == 'push'
61+
if: (contains(github.ref, 'develop') || contains(github.ref, 'main')) && github.event_name == 'push'
6162
run: |
6263
last_commit=$(git log --pretty=format:"%an: %s")
6364
cd ../gh-pages

.github/workflows/pre-commit.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ on:
88
# Trigger on any push to the master
99
push:
1010
branches:
11-
- master
11+
- main
12+
- development
1213

1314
# Trigger on any push to a PR that targets master
1415
pull_request:
1516
branches:
16-
- master
17+
- main
18+
- development
1719

1820
jobs:
1921

.github/workflows/pytest.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
# Triggers with push to master
88
push:
99
branches:
10-
- master
10+
- main
11+
- development
1112

1213
# Triggers with push to a pr aimed at master
1314
pull_request:
1415
branches:
15-
- master
16+
- main
17+
- development
1618

1719
schedule:
1820
# Every day at 7AM UTC
@@ -22,7 +24,7 @@ env:
2224

2325
package-name: ConfigSpace
2426
test-dir: test
25-
extra-requires: "[test]" # "" for no extra_requires
27+
extra-requires: "[dev]" # "" for no extra_requires
2628

2729
# Arguments used for pytest
2830
pytest-args: >-

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ on:
4040

4141
push:
4242
branches:
43-
- master
43+
- main
4444
# Release branches
4545
- "[0-9]+.[0-9]+.X"
4646

@@ -54,7 +54,7 @@ env:
5454
test-dir: test
5555
test-reqs: "pytest"
5656
test-cmd: "pytest -v"
57-
extra-requires: "[test]"
57+
extra-requires: "[dev]"
5858

5959
jobs:
6060

@@ -74,11 +74,10 @@ jobs:
7474
# Not supported by numpy
7575
- system: "musllinux"
7676

77-
# Scipy doesn't have a wheel for cp310 i686
77+
# Scipy doesn't have a wheel for cp310 i686
7878
- py: cp310
7979
arch: "i686"
8080

81-
8281
steps:
8382
- name: Checkout ${{ env.package-name }}
8483
uses: actions/checkout@v2

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
.DS_Store
2+
13
# Documentation
24
docs/build/*
5+
docs/examples/*
36

47
*.py[cod]
58

@@ -68,4 +71,4 @@ prof/
6871
.vscode
6972

7073
# Running pre-commit seems to generate these
71-
.mypy_cache
74+
.mypy_cache

.pre-commit-config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
repos:
22
- repo: https://github.com/pre-commit/mirrors-mypy
3-
rev: v0.761
3+
rev: v0.961
44
hooks:
55
- id: mypy
66
args: [--show-error-codes, --ignore-missing-imports, --follow-imports, skip]
77
name: mypy ConfigSpace
88
files: ConfigSpace
9+
910
- repo: https://gitlab.com/pycqa/flake8
10-
rev: 3.8.3
11+
rev: 4.0.1
1112
hooks:
1213
- id: flake8
1314
name: flake8 ConfigSpace
1415
files: ConfigSpace
16+
1517
- id: flake8
1618
name: flake8 test
1719
files: test

ConfigSpace/__authors__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
__authors__ = [
2+
"Matthias Feurer",
3+
"Katharina Eggensperger",
4+
"Syed Mohsin Ali",
5+
"Christina Hernandez Wunsch",
6+
"Julien-Charles Levesque",
7+
"Jost Tobias Springenberg",
8+
"Philipp Mueller",
9+
"Marius Lindauer",
10+
"Jorn Tuyls",
11+
"Eddie Bergman",
12+
]

ConfigSpace/__init__.py

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,68 @@
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

2929
from ConfigSpace.__version__ import __version__
30-
__authors__ = [
31-
"Matthias Feurer", "Katharina Eggensperger", "Syed Mohsin Ali",
32-
"Christina Hernandez Wunsch", "Julien-Charles Levesque",
33-
"Jost Tobias Springenberg", "Philipp Mueller", "Marius Lindauer",
34-
"Jorn Tuyls"
35-
]
30+
from ConfigSpace.__authors__ import __authors__
3631

37-
from ConfigSpace.configuration_space import Configuration, \
38-
ConfigurationSpace
39-
from ConfigSpace.hyperparameters import CategoricalHyperparameter, \
40-
UniformFloatHyperparameter, UniformIntegerHyperparameter, Constant, \
41-
UnParametrizedHyperparameter, OrdinalHyperparameter
42-
from ConfigSpace.conditions import AndConjunction, OrConjunction, \
43-
EqualsCondition, NotEqualsCondition, InCondition, GreaterThanCondition, LessThanCondition
44-
from ConfigSpace.forbidden import ForbiddenAndConjunction, \
45-
ForbiddenEqualsClause, ForbiddenInClause, ForbiddenLessThanRelation, ForbiddenEqualsRelation, \
46-
ForbiddenGreaterThanRelation
32+
import ConfigSpace.api.distributions as distributions
33+
import ConfigSpace.api.types as types
34+
from ConfigSpace.api import (Beta, Categorical, Distribution, Float, Integer,
35+
Normal, Uniform)
36+
from ConfigSpace.conditions import (AndConjunction, EqualsCondition,
37+
GreaterThanCondition, InCondition,
38+
LessThanCondition, NotEqualsCondition,
39+
OrConjunction)
40+
from ConfigSpace.configuration_space import Configuration, ConfigurationSpace
41+
from ConfigSpace.forbidden import (ForbiddenAndConjunction,
42+
ForbiddenEqualsClause,
43+
ForbiddenEqualsRelation,
44+
ForbiddenGreaterThanRelation,
45+
ForbiddenInClause,
46+
ForbiddenLessThanRelation)
47+
from ConfigSpace.hyperparameters import (BetaFloatHyperparameter,
48+
BetaIntegerHyperparameter,
49+
CategoricalHyperparameter, Constant,
50+
NormalFloatHyperparameter,
51+
NormalIntegerHyperparameter,
52+
OrdinalHyperparameter,
53+
UniformFloatHyperparameter,
54+
UniformIntegerHyperparameter,
55+
UnParametrizedHyperparameter)
4756

48-
__all__ = ["__version__", "Configuration", "ConfigurationSpace",
49-
"CategoricalHyperparameter", "UniformFloatHyperparameter",
50-
"UniformIntegerHyperparameter", "Constant",
51-
"UnParametrizedHyperparameter", "OrdinalHyperparameter",
52-
"AndConjunction", "OrConjunction",
53-
"EqualsCondition", "NotEqualsCondition",
54-
"InCondition", "GreaterThanCondition",
55-
"LessThanCondition", "ForbiddenAndConjunction",
56-
"ForbiddenEqualsClause", "ForbiddenInClause",
57-
"ForbiddenLessThanRelation", "ForbiddenEqualsRelation",
58-
"ForbiddenGreaterThanRelation"]
57+
__all__ = [
58+
"__authors__",
59+
"__version__",
60+
"Configuration",
61+
"ConfigurationSpace",
62+
"CategoricalHyperparameter",
63+
"UniformFloatHyperparameter",
64+
"UniformIntegerHyperparameter",
65+
"BetaFloatHyperparameter",
66+
"BetaIntegerHyperparameter",
67+
"NormalFloatHyperparameter",
68+
"NormalIntegerHyperparameter",
69+
"Constant",
70+
"UnParametrizedHyperparameter",
71+
"OrdinalHyperparameter",
72+
"AndConjunction",
73+
"OrConjunction",
74+
"EqualsCondition",
75+
"NotEqualsCondition",
76+
"InCondition",
77+
"GreaterThanCondition",
78+
"LessThanCondition",
79+
"ForbiddenAndConjunction",
80+
"ForbiddenEqualsClause",
81+
"ForbiddenInClause",
82+
"ForbiddenLessThanRelation",
83+
"ForbiddenEqualsRelation",
84+
"ForbiddenGreaterThanRelation",
85+
"Beta",
86+
"Categorical",
87+
"Distribution",
88+
"Float",
89+
"Integer",
90+
"Normal",
91+
"Uniform",
92+
"distributions",
93+
"types",
94+
]

ConfigSpace/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Version information."""
22

33
# The following line *must* be the last in the module, exactly as formatted:
4-
__version__ = "0.5.0"
4+
__version__ = "0.6.0"

ConfigSpace/api/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import ConfigSpace.api.distributions as distributions
2+
import ConfigSpace.api.types as types
3+
from ConfigSpace.api.distributions import Beta, Distribution, Normal, Uniform
4+
from ConfigSpace.api.types import Categorical, Float, Integer
5+
6+
__all__ = [
7+
"types",
8+
"distributions",
9+
"Beta",
10+
"Distribution",
11+
"Normal",
12+
"Uniform",
13+
"Categorical",
14+
"Float",
15+
"Integer",
16+
]

0 commit comments

Comments
 (0)