Skip to content

FILE: docs/configuration.md

Configuration

DataKit supports a per‑project configuration file named .datakit.toml. This file lets you set default parameters for theme, imputation, output, and colours without repeating them in every script.

Where to put the file

Place .datakit.toml in your working directory or any parent directory. DataKit searches upward from the current working directory (like .gitignore).

File format

[theme]
style = "whitegrid"
palette = "muted"
font_scale = 1.2
dpi = 120

[imputation]
threshold = 0.4
strategy = "smart"

[output]
save_dir = "figures"
dpi = 150
format = "png"

[colors]
palette = "tab10"

Loading the configuration

import datakit as dk

# Load config from default location (search upward)
dk.load_config()

# Load from a specific path
dk.load_config(path="/path/to/.datakit.toml")

# Get the loaded config as a dict
config = dk.get_config()
print(config)

Using configuration in functions

Functions that support from_config=True will read default values from the config file. Explicit function arguments always override config values.

Theme example

# Reads style, palette, font_scale, dpi from [theme] section
dk.set_theme(from_config=True)

Imputation example (planned for future versions)

Some functions may use [imputation] and [output] sections as defaults when from_config=True is passed.

Section details

[theme]

Key Default Used by
style "whitegrid" set_theme()
palette "muted" set_theme()
font_scale 1.2 set_theme()
dpi 120 set_theme()

[imputation]

Key Default Used by
threshold 0.4 auto_impute()
strategy "smart" auto_impute()

[output]

Key Default Used by
save_dir "figures" plot_distributions(), quick_eda()
dpi 150 all plotting functions
format "png" not yet used (reserved)

[colors]

Key Default Used by
palette "tab10" ColorRegistry

Example: full config file

[theme]
style = "darkgrid"
palette = "colorblind"
font_scale = 1.5
dpi = 200

[imputation]
threshold = 0.3
strategy = "smart"

[output]
save_dir = "my_plots"
dpi = 300
format = "png"

[colors]
palette = "Set2"

Notes

  • The configuration system is optional. If no file is found, DataKit uses built‑in defaults.
  • Config values never override explicit function arguments – they only provide defaults when the argument is omitted.
  • To see which version of the config is loaded, call dk.get_config() after loading.