Configuration#
Darts configuration system for global options and settings.
This module provides functionality to configure global behavior of Darts, similar to pandas’ options system.
Available Options#
Display Options
display.max_rowsint (default: 10)Maximum number of rows to display in TimeSeries representation. When a TimeSeries has more rows than this, the display will be truncated, showing the first and last portion of rows.
display.max_colsint (default: 10)Maximum number of columns to display in TimeSeries representation. When a TimeSeries has more columns than this, the display will be truncated, showing the first and last portion of columns.
Plotting Options
plotting.use_darts_stylebool (default: False)Whether to apply Darts’ custom matplotlib plotting style. When True, Darts will configure matplotlib with a custom style optimized for time series visualization. When False, matplotlib’s default or user-configured style will be used. Changes to this option take effect immediately.
Examples
>>> from darts import get_option, set_option, option_context
>>> # Get current display settings
>>> get_option('display.max_rows')
10
>>> # Change display settings globally
>>> set_option('display.max_rows', 20)
>>> # Temporarily change settings within a context
>>> with option_context('display.max_rows', 5):
... print(my_timeseries) # Shows only 5 rows
>>> # Settings automatically restored after context
>>> get_option('display.max_rows')
20
- darts.config.describe_option(pat)[source]#
Describe one or more options.
Available Options:
display.[max_rows, max_cols]
plotting.use_darts_style
- Parameters:
pat (
str) – The option key or pattern to describe. Can match multiple options. Use “all” to describe all options.- Returns:
The description for the specified options.
- Return type:
str
- Raises:
ValueError – If no option matches the pattern.
Examples
>>> from darts import describe_option >>> describe_option('display.max_rows') display.max_rows : int Maximum number of rows to display in TimeSeries representation... [default: 10] [currently: 10]
>>> describe_option('display') # Describe all display options >>> describe_option('all') # Describe all options
- darts.config.get_option(pat)[source]#
Retrieves the value of the specified option.
Available Options:
display.[max_rows, max_cols]
plotting.use_darts_style
- Parameters:
pat (
str) – The option key to retrieve. Must uniquely identify a single option.- Returns:
The current value of the option.
- Return type:
Any
- Raises:
ValueError – If no option matches the pattern, or if the pattern is ambiguous.
Examples
>>> from darts import get_option >>> get_option('display.max_rows') 10
- darts.config.option_context(*args)[source]#
Context manager to temporarily set options in the with statement context.
Available Options:
display.[max_rows, max_cols]
plotting.use_darts_style
- Parameters:
*args – Pairs of (key, value) for options to set temporarily.
- Yields:
None
- Return type:
Generator[None,None,None]
Examples
>>> from darts import option_context, get_option >>> get_option('display.max_rows') 10 >>> with option_context('display.max_rows', 20, 'display.max_cols', 15): ... print(get_option('display.max_rows')) ... print(get_option('display.max_cols')) 20 15 >>> get_option('display.max_rows') # Back to original 10
- darts.config.reset_option(pat)[source]#
Reset one or more options to their default value.
Available Options:
display.[max_rows, max_cols]
plotting.use_darts_style
- Parameters:
pat (
str) – The option key or pattern to reset. Can match multiple options. Use “all” to reset all options.- Raises:
ValueError – If no option matches the pattern.
- Return type:
None
Examples
>>> from darts import reset_option >>> reset_option('display.max_rows') # Reset single option >>> reset_option('display') # Reset all display options >>> reset_option('all') # Reset all options
- darts.config.set_option(pat, value)[source]#
Sets the value of the specified option.
Available Options:
display.[max_rows, max_cols]
plotting.use_darts_style
- Parameters:
pat (
str) – The option key to set. Must uniquely identify a single option.value (
Any) – The new value for the option. Must be valid according to the option’s validator.
- Raises:
ValueError – If no option matches the pattern, if the pattern is ambiguous, or if the value is invalid for the option.
- Return type:
None
Examples
>>> from darts import set_option >>> set_option('display.max_rows', 20)