Skip to content

Commit 783f7cd

Browse files
ci: Update tooling (#1298)
* ci: Migrate everything to pyproject.toml * style: Apply ruff fixes * style: Apply (more) ruff fixes * style(ruff): Add some file specific ignores * ci: Fix build with setuptools * ci(ruff): Allow prints in cli.py * fix: Circular import * test: Use raises(..., match=) * fix(cli): re-add missing print statements * fix: Fix some over ruff-ized code * add make check to documentation * ci: Change to `build` for sdist * ci: Add ruff to `"test"` deps --------- Co-authored-by: Lennart Purucker <[email protected]>
1 parent 56895c2 commit 783f7cd

Some content is hidden

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

78 files changed

+3672
-3349
lines changed

.flake8

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

.github/workflows/dist.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ jobs:
1313
python-version: 3.8
1414
- name: Build dist
1515
run: |
16-
python setup.py sdist
16+
pip install build
17+
python -m build --sdist
1718
- name: Twine check
1819
run: |
1920
pip install twine

.nojekyll

Whitespace-only changes.

.pre-commit-config.yaml

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
1+
default_language_version:
2+
python: python3
3+
files: |
4+
(?x)^(
5+
openml|
6+
tests
7+
)/.*\.py$
18
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 23.12.1
9+
- repo: https://github.com/charliermarsh/ruff-pre-commit
10+
rev: v0.1.5
411
hooks:
5-
- id: black
6-
args: [--line-length=100]
12+
- id: ruff
13+
args: [--fix, --exit-non-zero-on-fix, --no-cache]
14+
- id: ruff-format
715
- repo: https://github.com/pre-commit/mirrors-mypy
816
rev: v1.8.0
917
hooks:
1018
- id: mypy
11-
name: mypy openml
12-
files: openml/.*
1319
additional_dependencies:
1420
- types-requests
1521
- types-python-dateutil
16-
- id: mypy
17-
name: mypy tests
18-
files: tests/.*
19-
additional_dependencies:
20-
- types-requests
21-
- types-python-dateutil
22-
- id: mypy
23-
name: mypy top-level-functions
24-
files: openml/_api_calls.py
25-
additional_dependencies:
26-
- types-requests
27-
- types-python-dateutil
28-
args: [ --disallow-untyped-defs, --disallow-any-generics,
29-
--disallow-any-explicit, --implicit-optional ]
30-
- repo: https://github.com/pycqa/flake8
31-
rev: 6.1.0
22+
- repo: https://github.com/python-jsonschema/check-jsonschema
23+
rev: 0.27.1
3224
hooks:
33-
- id: flake8
34-
name: flake8 openml
35-
files: openml/.*
36-
additional_dependencies:
37-
- flake8-print==5.0.0
38-
- id: flake8
39-
name: flake8 tests
40-
files: tests/.*
41-
additional_dependencies:
42-
- flake8-print==5.0.0
25+
- id: check-github-workflows
26+
files: '^github/workflows/.*\.ya?ml$'
27+
types: ["yaml"]
28+
- id: check-dependabot
29+
files: '^\.github/dependabot\.ya?ml$'
30+
- repo: https://github.com/pre-commit/pre-commit-hooks
31+
rev: v4.5.0
32+
hooks:
33+
- id: check-added-large-files
34+
files: ".*"
35+
- id: check-case-conflict
36+
files: ".*"
37+
- id: check-merge-conflict
38+
files: ".*"
39+
- id: check-yaml
40+
files: ".*"
41+
- id: end-of-file-fixer
42+
files: ".*"
43+
types: ["yaml"]
44+
- id: check-toml
45+
files: ".*"
46+
types: ["toml"]
47+
- id: debug-statements
48+
files: '^src/.*\.py$'

CONTRIBUTING.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -214,28 +214,32 @@ Before each commit, it will automatically run:
214214
but make sure to make adjustments if it does fail.
215215

216216
If you want to run the pre-commit tests without doing a commit, run:
217-
```bash
218-
$ pre-commit run --all-files
219-
```
217+
```bash
218+
$ make check
219+
```
220+
or on a system without make, like Windows:
221+
```bash
222+
$ pre-commit run --all-files
223+
```
220224
Make sure to do this at least once before your first commit to check your setup works.
221225

222226
Executing a specific unit test can be done by specifying the module, test case, and test.
223227
To obtain a hierarchical list of all tests, run
224228

225-
```bash
226-
$ pytest --collect-only
227-
228-
<Module 'tests/test_datasets/test_dataset.py'>
229-
<UnitTestCase 'OpenMLDatasetTest'>
230-
<TestCaseFunction 'test_dataset_format_constructor'>
231-
<TestCaseFunction 'test_get_data'>
232-
<TestCaseFunction 'test_get_data_rowid_and_ignore_and_target'>
233-
<TestCaseFunction 'test_get_data_with_ignore_attributes'>
234-
<TestCaseFunction 'test_get_data_with_rowid'>
235-
<TestCaseFunction 'test_get_data_with_target'>
236-
<UnitTestCase 'OpenMLDatasetTestOnTestServer'>
237-
<TestCaseFunction 'test_tagging'>
238-
```
229+
```bash
230+
$ pytest --collect-only
231+
232+
<Module 'tests/test_datasets/test_dataset.py'>
233+
<UnitTestCase 'OpenMLDatasetTest'>
234+
<TestCaseFunction 'test_dataset_format_constructor'>
235+
<TestCaseFunction 'test_get_data'>
236+
<TestCaseFunction 'test_get_data_rowid_and_ignore_and_target'>
237+
<TestCaseFunction 'test_get_data_with_ignore_attributes'>
238+
<TestCaseFunction 'test_get_data_with_rowid'>
239+
<TestCaseFunction 'test_get_data_with_target'>
240+
<UnitTestCase 'OpenMLDatasetTestOnTestServer'>
241+
<TestCaseFunction 'test_tagging'>
242+
```
239243

240244
You may then run a specific module, test case, or unit test respectively:
241245
```bash

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ CTAGS ?= ctags
77

88
all: clean inplace test
99

10+
check:
11+
pre-commit run --all-files
12+
1013
clean:
1114
$(PYTHON) setup.py clean
1215
rm -rf dist openml.egg-info

mypy.ini

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

openml/__init__.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,36 @@
1717

1818
# License: BSD 3-Clause
1919

20-
from . import _api_calls
21-
from . import config
22-
from .datasets import OpenMLDataset, OpenMLDataFeature
23-
from . import datasets
24-
from . import evaluations
20+
from . import (
21+
_api_calls,
22+
config,
23+
datasets,
24+
evaluations,
25+
exceptions,
26+
extensions,
27+
flows,
28+
runs,
29+
setups,
30+
study,
31+
tasks,
32+
utils,
33+
)
34+
from .__version__ import __version__
35+
from .datasets import OpenMLDataFeature, OpenMLDataset
2536
from .evaluations import OpenMLEvaluation
26-
from . import extensions
27-
from . import exceptions
28-
from . import tasks
37+
from .flows import OpenMLFlow
38+
from .runs import OpenMLRun
39+
from .setups import OpenMLParameter, OpenMLSetup
40+
from .study import OpenMLBenchmarkSuite, OpenMLStudy
2941
from .tasks import (
30-
OpenMLTask,
31-
OpenMLSplit,
32-
OpenMLSupervisedTask,
3342
OpenMLClassificationTask,
34-
OpenMLRegressionTask,
3543
OpenMLClusteringTask,
3644
OpenMLLearningCurveTask,
45+
OpenMLRegressionTask,
46+
OpenMLSplit,
47+
OpenMLSupervisedTask,
48+
OpenMLTask,
3749
)
38-
from . import runs
39-
from .runs import OpenMLRun
40-
from . import flows
41-
from .flows import OpenMLFlow
42-
from . import study
43-
from .study import OpenMLStudy, OpenMLBenchmarkSuite
44-
from . import utils
45-
from . import setups
46-
from .setups import OpenMLSetup, OpenMLParameter
47-
48-
49-
from .__version__ import __version__ # noqa: F401
5050

5151

5252
def populate_cache(task_ids=None, dataset_ids=None, flow_ids=None, run_ids=None):

openml/__version__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
# License: BSD 3-Clause
44

55
# The following line *must* be the last in the module, exactly as formatted:
6+
from __future__ import annotations
7+
68
__version__ = "0.14.1"

0 commit comments

Comments
 (0)