0
# Configuration
1
2
Configuration management through the options system, providing control over execution behavior and runtime settings. The configuration system is inherited from Mars and provides similar functionality to pandas configuration.
3
4
## Capabilities
5
6
### Options Object
7
8
Global configuration object that holds various Xorbits settings.
9
10
```python { .api }
11
options: object
12
"""
13
Global configuration options object.
14
15
Provides access to various Xorbits configuration settings including:
16
- Execution behavior settings
17
- Display options
18
- Performance tuning parameters
19
- Runtime configuration
20
"""
21
```
22
23
### Option Context Manager
24
25
Context manager for temporarily changing configuration options. Changes are automatically reverted when exiting the context.
26
27
```python { .api }
28
def option_context(*args, **kwargs):
29
"""
30
Context manager for temporarily changing configuration options.
31
32
Parameters:
33
- *args: Option names and values as alternating arguments
34
- **kwargs: Option names and values as keyword arguments
35
36
Returns:
37
- Context manager that temporarily modifies options
38
"""
39
```
40
41
**Usage Examples:**
42
43
```python
44
import xorbits
45
46
# Using with keyword arguments
47
with xorbits.option_context(display_max_rows=100):
48
# Within this context, display_max_rows is set to 100
49
# Perform operations that use this setting
50
pass
51
# Outside the context, display_max_rows reverts to previous value
52
53
# Using with positional arguments
54
with xorbits.option_context('display.max_rows', 50, 'display.max_columns', 20):
55
# Both display.max_rows and display.max_columns are temporarily changed
56
pass
57
```
58
59
### Configuration Access Patterns
60
61
While the specific configuration options are inherited from Mars, common patterns for accessing and modifying options include:
62
63
```python
64
# Access current option value
65
current_value = xorbits.options.some_option
66
67
# Temporarily change options using context manager
68
with xorbits.option_context(some_option=new_value):
69
# Code using the temporary setting
70
pass
71
72
# The options system typically includes settings for:
73
# - Display formatting and limits
74
# - Execution and performance tuning
75
# - Memory management
76
# - Distributed computing behavior
77
```
78
79
## Integration with Pandas Configuration
80
81
Xorbits pandas module also provides its own configuration system that mirrors pandas configuration:
82
83
```python
84
import xorbits.pandas as pd
85
86
# Access pandas-style configuration
87
pd.get_option('display.max_rows')
88
pd.set_option('display.max_rows', 100)
89
90
with pd.option_context('display.max_rows', 50):
91
# Temporarily change pandas display options
92
pass
93
```