Configuration#
WindKit can stamp your name, email and institution on the datasets it creates,
as the author, author_email and institution attributes. The
attribution travels with the data into every file you write, which helps keep
your datasets FAIR: anyone reusing them can see who created them and whom to
contact.
Attribution is optional. WindKit never prompts for it and never writes it unless you ask. When a field is not configured, the corresponding attribute is left out.
Quick Start#
Run the windkit configure command once in a terminal:
windkit configure
It asks for each field and saves the answers to the configuration file, so every later session picks them up. To configure WindKit from a script or a container, pass the fields as flags instead:
windkit configure --name "John Doe" --email "john.doe@example.com" --institution "Example University"
Fields not given as flags are prompted for, with the current values as
defaults, and an empty answer keeps the current value. Without a terminal to
prompt on, they keep their current values, and the command fails if a field
has neither a flag nor a current value. An empty flag value such as
--email "" leaves a field unset.
Configuration Sources#
Each field is taken from the first of these sources that sets it:
Environment variables.
The TOML configuration file, as written by
windkit configure.
Empty values count as unset. WindKit reads the sources the first time it stamps a dataset and keeps the result for the rest of the Python session, so changes take effect in the next session.
Environment Variables#
Environment variables are useful for automated scripts, CI/CD pipelines, or for overriding a single field without editing the file. The following variables are recognized, and their names are case-insensitive:
WINDKIT_NAME: Your full name.WINDKIT_EMAIL: Your email address.WINDKIT_INSTITUTION: Your institution or company name.
Example (Linux/macOS):
export WINDKIT_NAME="John Doe"
export WINDKIT_EMAIL="john.doe@example.com"
export WINDKIT_INSTITUTION="Example University"
Example (Windows Command Prompt):
set WINDKIT_NAME=Jane Doe
set WINDKIT_EMAIL=jane.doe@example.com
set WINDKIT_INSTITUTION=Research Labs Inc.
Example (Windows PowerShell):
$env:WINDKIT_NAME="Alice Smith"
$env:WINDKIT_EMAIL="alice.smith@example.com"
$env:WINDKIT_INSTITUTION="Global Wind Energy"
TOML Configuration File#
windkit configure saves your settings to windkit_config.toml in the
user configuration directory:
Linux:
~/.config/windkit/windkit_config.tomlmacOS:
~/Library/Application Support/windkit/windkit_config.tomlWindows:
C:\Users\<username>\AppData\Roaming\DTU Wind Energy\windkit\windkit_config.toml
windkit configure prints the path it saves to.
You can also create or edit the file by hand. Every field is optional:
name = "Your Full Name"
email = "your.email@example.com"
institution = "Your Company or Institution"
If the file cannot be read or is not valid TOML, WindKit warns once and carries on without it.
Note
WindKit 2.1 and earlier share this file but require all three fields. If a field is left unset, those versions prompt for it and rewrite the file.
Note
WindKit no longer reads the windkit.ini file used before version 1.0.
If you only have that file, run windkit configure to create the TOML file.
Accessing Your Configuration#
windkit.config.get_config() returns the settings WindKit uses. A field
that is not configured is None:
from windkit.config import get_config
config = get_config()
print(config.name, config.email, config.institution)
Deprecated since version 2.2: windkit.config.CONFIG is deprecated and will be removed in WindKit 3.0.
Use windkit.config.get_config() instead. CONFIG now returns the
same windkit.config.Config object, whose fields may be None,
rather than a pydantic settings object.