Skip to content

Commit df6dd5e

Browse files
authored
Refactor: decythonize configuration space (#321)
* refactor: Initial Cleanup * refactor: ... * chore: Update and Fix tooling * fix: Make tooling work for 3.7
1 parent eb1ff7e commit df6dd5e

54 files changed

Lines changed: 6410 additions & 5298 deletions

Some content is hidden

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

.flake8

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/.dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
target-branch: "main"
7+
schedule:
8+
interval: "weekly"
9+
assignees:
10+
- "Neonkraft"
11+
reviewers:
12+
- "Neonkraft"
13+
commit-message:
14+
prefix: "chore: "

.github/workflows/docs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ jobs:
3636

3737
- name: Install dependencies
3838
run: |
39-
pip install build
40-
pip install ".[docs]"
39+
pip install ".[dev]"
4140
4241
- name: Make docs
4342
run: |

.github/workflows/pytest.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ env:
2424

2525
package-name: ConfigSpace
2626
test-dir: test
27-
extra-requires: "[test]" # "" for no extra_requires
27+
extra-requires: "[dev]" # "" for no extra_requires
2828

2929
# Arguments used for pytest
3030
pytest-args: >-
@@ -37,7 +37,7 @@ env:
3737
#
3838
code-cov-active: true # Copied in job setup
3939
code-cov-os: ubuntu-latest # Copied in job setup
40-
code-cov-python-version: "3.7"
40+
code-cov-python-version: "3.8"
4141
code-cov-args: >-
4242
--cov=ConfigSpace
4343
--cov-report=xml
@@ -71,7 +71,6 @@ jobs:
7171
- name: Install ${{ env.package-name }}
7272
run: |
7373
python -m pip install --upgrade pip
74-
python -m pip install wheel
7574
python -m pip install -e ".${{ env.extra-requires }}"
7675
7776
- name: Store git status
@@ -107,7 +106,7 @@ jobs:
107106
strategy:
108107
fail-fast: false
109108
matrix:
110-
python-version: ["3.7", "3.8", "3.9", "3.10"]
109+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
111110
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
112111

113112
steps:
@@ -144,7 +143,7 @@ jobs:
144143
strategy:
145144
fail-fast: false
146145
matrix:
147-
python-version: ["3.7", "3.8", "3.9", "3.10"]
146+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
148147
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
149148

150149
steps:

.landscape.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.pre-commit-config.yaml

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,69 @@
1+
default_language_version:
2+
python: python3
3+
files: |
4+
(?x)^(
5+
ConfigSpace|
6+
test
7+
)/.*\.py$
18
repos:
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v4.4.0
11+
hooks:
12+
- id: check-added-large-files
13+
files: ".*"
14+
- id: check-case-conflict
15+
files: ".*"
16+
- id: check-merge-conflict
17+
files: ".*"
18+
- id: check-yaml
19+
files: ".*"
20+
- id: end-of-file-fixer
21+
files: ".*"
22+
types: ["yaml"]
23+
- id: check-toml
24+
files: ".*"
25+
types: ["toml"]
26+
- id: debug-statements
27+
files: '^src/.*\.py$'
28+
- repo: https://github.com/python-jsonschema/check-jsonschema
29+
rev: 0.22.0
30+
hooks:
31+
- id: check-github-workflows
32+
files: '^github/workflows/.*\.ya?ml$'
33+
types: ["yaml"]
34+
- id: check-dependabot
35+
files: '^\.github/dependabot\.ya?ml$'
236
- repo: https://github.com/pre-commit/mirrors-mypy
3-
rev: v0.961
37+
rev: v1.2.0
438
hooks:
539
- id: mypy
6-
args: [--show-error-codes, --ignore-missing-imports, --follow-imports, skip]
7-
name: mypy ConfigSpace
8-
files: ConfigSpace
40+
files: '^ConfigSpace/.*\.py$'
41+
args:
42+
- "--no-warn-return-any" # Disable this because it doesn't know about 3rd party imports
43+
- "--ignore-missing-imports"
44+
- "--show-traceback"
45+
- id: mypy
46+
files: '^test/.*\.py$'
47+
args:
48+
- "--no-warn-return-any" # Disable this because it doesn't know about 3rd party imports
49+
- "--ignore-missing-imports"
50+
- "--show-traceback"
51+
- "--disable-error-code"
52+
- "no-untyped-def"
953

10-
- repo: https://github.com/pycqa/flake8
11-
rev: 5.0.4
54+
- repo: https://github.com/psf/black
55+
rev: 23.3.0
1256
hooks:
13-
- id: flake8
14-
name: flake8 ConfigSpace
15-
files: ConfigSpace
16-
17-
- id: flake8
18-
name: flake8 test
19-
files: test
20-
57+
- id: black
58+
args: ["--config=pyproject.toml"]
59+
- repo: https://github.com/charliermarsh/ruff-pre-commit
60+
rev: v0.0.263
61+
hooks:
62+
- id: ruff
63+
args: ["--fix", "ConfigSpace", "test"]
2164
- repo: https://github.com/MarcoGorelli/cython-lint
22-
rev: v0.14.0
65+
rev: v0.15.0
2366
hooks:
24-
- id: cython-lint
67+
- id: cython-lint
2568
args: [--ignore=E501]
26-
- id: double-quote-cython-strings
69+
- id: double-quote-cython-strings

ConfigSpace/__authors__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
__authors__ = [
24
"Matthias Feurer",
35
"Katharina Eggensperger",
@@ -9,4 +11,5 @@
911
"Marius Lindauer",
1012
"Jorn Tuyls",
1113
"Eddie Bergman",
14+
"Arjun Krishnakumar",
1215
]

ConfigSpace/__init__.py

Lines changed: 67 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,63 @@
2626
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

29-
from ConfigSpace.__version__ import __version__
3029
from ConfigSpace.__authors__ import __authors__
31-
32-
from ConfigSpace.api import (Beta, Categorical, Distribution, Float, Integer,
33-
Normal, Uniform)
34-
from ConfigSpace.conditions import (AndConjunction, EqualsCondition,
35-
GreaterThanCondition, InCondition,
36-
LessThanCondition, NotEqualsCondition,
37-
OrConjunction)
38-
from ConfigSpace.configuration_space import Configuration, ConfigurationSpace
39-
from ConfigSpace.forbidden import (ForbiddenAndConjunction,
40-
ForbiddenEqualsClause,
41-
ForbiddenEqualsRelation,
42-
ForbiddenGreaterThanRelation,
43-
ForbiddenInClause,
44-
ForbiddenLessThanRelation)
45-
from ConfigSpace.hyperparameters import (BetaFloatHyperparameter,
46-
BetaIntegerHyperparameter,
47-
CategoricalHyperparameter, Constant,
48-
NormalFloatHyperparameter,
49-
NormalIntegerHyperparameter,
50-
OrdinalHyperparameter,
51-
UniformFloatHyperparameter,
52-
UniformIntegerHyperparameter,
53-
UnParametrizedHyperparameter)
54-
import ConfigSpace.api.distributions as distributions
55-
import ConfigSpace.api.types as types
30+
from ConfigSpace.__version__ import __version__
31+
from ConfigSpace.api import (
32+
Beta,
33+
Categorical,
34+
Distribution,
35+
Float,
36+
Integer,
37+
Normal,
38+
Uniform,
39+
distributions,
40+
types,
41+
)
42+
from ConfigSpace.conditions import (
43+
AndConjunction,
44+
EqualsCondition,
45+
GreaterThanCondition,
46+
InCondition,
47+
LessThanCondition,
48+
NotEqualsCondition,
49+
OrConjunction,
50+
)
51+
from ConfigSpace.configuration import Configuration
52+
from ConfigSpace.configuration_space import ConfigurationSpace
53+
from ConfigSpace.exceptions import (
54+
ActiveHyperparameterNotSetError,
55+
AmbiguousConditionError,
56+
ChildNotFoundError,
57+
CyclicDependancyError,
58+
ForbiddenValueError,
59+
HyperparameterAlreadyExistsError,
60+
HyperparameterIndexError,
61+
HyperparameterNotFoundError,
62+
IllegalValueError,
63+
InactiveHyperparameterSetError,
64+
ParentNotFoundError,
65+
)
66+
from ConfigSpace.forbidden import (
67+
ForbiddenAndConjunction,
68+
ForbiddenEqualsClause,
69+
ForbiddenEqualsRelation,
70+
ForbiddenGreaterThanRelation,
71+
ForbiddenInClause,
72+
ForbiddenLessThanRelation,
73+
)
74+
from ConfigSpace.hyperparameters import (
75+
BetaFloatHyperparameter,
76+
BetaIntegerHyperparameter,
77+
CategoricalHyperparameter,
78+
Constant,
79+
NormalFloatHyperparameter,
80+
NormalIntegerHyperparameter,
81+
OrdinalHyperparameter,
82+
UniformFloatHyperparameter,
83+
UniformIntegerHyperparameter,
84+
UnParametrizedHyperparameter,
85+
)
5686

5787
__all__ = [
5888
"__authors__",
@@ -91,4 +121,15 @@
91121
"Uniform",
92122
"distributions",
93123
"types",
124+
"ForbiddenValueError",
125+
"IllegalValueError",
126+
"ActiveHyperparameterNotSetError",
127+
"InactiveHyperparameterSetError",
128+
"HyperparameterNotFoundError",
129+
"ChildNotFoundError",
130+
"ParentNotFoundError",
131+
"HyperparameterIndexError",
132+
"AmbiguousConditionError",
133+
"HyperparameterAlreadyExistsError",
134+
"CyclicDependancyError",
94135
]

ConfigSpace/__version__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""Version information."""
22

33
# The following line *must* be the last in the module, exactly as formatted:
4+
from __future__ import annotations
5+
46
__version__ = "0.6.1"

ConfigSpace/api/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import ConfigSpace.api.distributions as distributions
2-
import ConfigSpace.api.types as types
1+
from ConfigSpace.api import distributions, types
32
from ConfigSpace.api.distributions import Beta, Distribution, Normal, Uniform
43
from ConfigSpace.api.types import Categorical, Float, Integer
54

0 commit comments

Comments
 (0)