scaffold_kit.config
Provides utilities for locating and loading configuration files.
This module searches for a configuration file in the current directory, supporting multiple names and formats (YAML and JSON). It then loads the first file found and uses the values to set a series of module-level constants, providing sensible defaults if the file or specific keys are not found.
Demo
To run the module’s demonstration code, use the following command:
$ uv run python -m scaffold_kit.config
CHECKLIST_DIRECTORY = config.get('checklist_directory', '.')
module-attribute
#
Constant signifying checklist directory config.
CHECKLIST_FILE = config.get('checklist_file', 'empty-files-checklist.txt')
module-attribute
#
Constant signifying checklist file config.
IGNORE_FILE = config.get('ignore_file', '.scaffoldignore')
module-attribute
#
Constant signifying ignore file config.
SCAFFOLD_FILE = config.get('scaffold_file', 'scaffold.yaml')
module-attribute
#
Constant signifying scaffold file config.
TREE_DIRECTORY = config.get('tree_directory', '.')
module-attribute
#
Constant signifying tree directory config.
TREE_FILE = config.get('tree_file', 'tree.txt')
module-attribute
#
Constant signifying tree file config.
find_config_file()
#
Searches for a configuration file in the current directory.
The function checks for a predefined list of filenames in a specific order to locate a configuration file.
Returns:
| Type | Description |
|---|---|
str | None
|
The path to the first configuration file found, or None if no |
str | None
|
file is found. |
Source code in src/scaffold_kit/config.py
load_config(file_path)
#
Loads configuration from a given file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
The path to the configuration file. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing the loaded configuration data. |