scaffold_kit.init
Project initialization module.
This module provides functionality to initialize new projects by copying example configuration and scaffold files from the scaffold_kit package. It supports copying individual example files or all example files at once to help users quickly set up their project structure.
Usage
To run this script, navigate to your project’s root directory or parent directory and execute it as a module:
Copy all example files:#
$ uv run python -m scaffold_kit.init
Copy a specific example file:#
$ uv run python -m scaffold_kit.scaffold config-file
init_project(example_name=None)
#
Initialize a new project by copying example files.
This function initializes a new project by copying example files from the scaffold_kit package. It can copy either a specific example file or all example files to the current working directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
example_name
|
Optional[str]
|
The name of the example file to copy. If None, all example files will be copied. Valid options include ‘ignore-file’, ‘config-file’, and ‘scaffold-file’. |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Exit code: 0 for success, 1 if any errors occurred. |
Examples:
Copy a specific example file:
>>> init_project('config-file')
Successfully copied '.scaffoldkitrc.yaml' to the current directory.
0
Copy all example files:
>>> init_project()
No example specified. Copying all example files...
Successfully copied '.scaffoldignore' to the current directory.
Successfully copied '.scaffoldkitrc.yaml' to the current directory.
Successfully copied 'scaffold.yaml' to the current directory.
0
Source code in src/scaffold_kit/init.py
main()
#
Main entry point to run the init process.
Parses command-line arguments and runs the init_project process.