File tree Expand file tree Collapse file tree 2 files changed +35
-4
lines changed Expand file tree Collapse file tree 2 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -56,13 +56,15 @@ class DebugSettings(BaseModel):
56
56
57
57
58
58
class AppSettings (BaseSettings ):
59
- model_config = SettingsConfigDict (env_prefix = "DOCLING_" , env_nested_delimiter = "_" )
59
+ model_config = SettingsConfigDict (
60
+ env_prefix = "DOCLING_" , env_nested_delimiter = "_" , env_nested_max_split = 1
61
+ )
60
62
61
- perf : BatchConcurrencySettings
62
- debug : DebugSettings
63
+ perf : BatchConcurrencySettings = BatchConcurrencySettings ()
64
+ debug : DebugSettings = DebugSettings ()
63
65
64
66
cache_dir : Path = Path .home () / ".cache" / "docling"
65
67
artifacts_path : Optional [Path ] = None
66
68
67
69
68
- settings = AppSettings (perf = BatchConcurrencySettings (), debug = DebugSettings () )
70
+ settings = AppSettings ()
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+
4
+ def _setup_env ():
5
+ os .environ ["DOCLING_PERF_PAGE_BATCH_SIZE" ] = "12"
6
+ os .environ ["DOCLING_DEBUG_VISUALIZE_RAW_LAYOUT" ] = "True"
7
+ os .environ ["DOCLING_ARTIFACTS_PATH" ] = "/path/to/artifacts"
8
+
9
+
10
+ def test_settings ():
11
+ _setup_env ()
12
+
13
+ import importlib
14
+
15
+ import docling .datamodel .settings as m
16
+
17
+ # Reinitialize settings module
18
+ importlib .reload (m )
19
+
20
+ # Check top level setting
21
+ assert str (m .settings .artifacts_path ) == "/path/to/artifacts"
22
+
23
+ # Check nested set via environment variables
24
+ assert m .settings .perf .page_batch_size == 12
25
+ assert m .settings .debug .visualize_raw_layout is True
26
+
27
+ # Check nested defaults
28
+ assert m .settings .perf .doc_batch_size == 2
29
+ assert m .settings .debug .visualize_ocr is False
You can’t perform that action at this time.
0 commit comments