Commit 8a5532f
[ENH] Improve Global Config Architecture (#1577)
#### Metadata
* Reference Issue: fixes #1564
* New Tests Added: No
* Documentation Updated: No
* Change Log Entry: Replaces global variables with an instance of a
dataclass `OpenMLConfig`.
#### Details
* What does this PR implement/fix? Explain your changes.
* Mainly Introduces an `OpenMLConfig` dataclass and an
`OpenMLConfigManager` class to accumulate all config functions and
varialbles into one class, and a single module-level instance `_config`
in `openml.config`.
* Reads/parses configuration defaults from `OpenMLConfig`.
* Adds `__getattr__` so attribute reads on openml.config forward to the
dataclass (preserving read compatibility).
* Changes `openml/__init__.py` to route to the instance of
`OpenMLConfigManager` when `openml.config` is called.
* Moved `ConfigurationForExamples` inside `OpenMLConfigManager` to
preserve API.
* Why is this change necessary? What is the problem it solves?
* consolidates defaults and runtime state into one place,
* simplifies consistent parsing and writing of the config file,
* removes the use of global variables.
---------
Co-authored-by: Franz Király <fkiraly@gcos.ai>
Co-authored-by: Armaghan Shakir <raoarmaghanshakir040@gmail.com>1 parent 25ba6f8 commit 8a5532f
19 files changed
Lines changed: 516 additions & 581 deletions
File tree
- openml
- datasets
- evaluations
- runs
- setups
- study
- tasks
- utils
- tests
- test_evaluations
- test_openml
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | | - | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
73 | | - | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | | - | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
303 | | - | |
| 305 | + | |
| 306 | + | |
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
| |||
316 | 319 | | |
317 | 320 | | |
318 | 321 | | |
319 | | - | |
| 322 | + | |
320 | 323 | | |
321 | 324 | | |
322 | 325 | | |
| |||
336 | 339 | | |
337 | 340 | | |
338 | 341 | | |
339 | | - | |
340 | | - | |
| 342 | + | |
| 343 | + | |
341 | 344 | | |
342 | 345 | | |
343 | 346 | | |
| |||
362 | 365 | | |
363 | 366 | | |
364 | 367 | | |
365 | | - | |
| 368 | + | |
366 | 369 | | |
367 | 370 | | |
368 | | - | |
| 371 | + | |
369 | 372 | | |
370 | 373 | | |
371 | 374 | | |
| |||
0 commit comments