sample_generator
¶
create_sample_cv_file(*, file_path=None, name='John Doe')
¶
Generate a sample YAML file containing only the CV section.
Why
Standalone CV files let users focus on content separately from design, locale, and settings configuration.
Parameters:
-
file_path(Path | None, default:None) –Optional path to write file.
-
name(str, default:'John Doe') –Person's full name.
Returns:
-
str | None–YAML string if file_path is None, otherwise None after writing file.
Source code in src/rendercv/schema/sample_generator.py
create_sample_design_file(*, file_path=None, theme='classic')
¶
Generate a sample YAML file containing only the design section.
Why
Standalone design files let users explore all theme options without mixing in CV content or locale settings.
Parameters:
-
file_path(Path | None, default:None) –Optional path to write file.
-
theme(str, default:'classic') –Design theme identifier.
Returns:
-
str | None–YAML string if file_path is None, otherwise None after writing file.
Source code in src/rendercv/schema/sample_generator.py
create_sample_locale_file(*, file_path=None, locale='english')
¶
Generate a sample YAML file containing only the locale section.
Why
Standalone locale files let users customize language and date formatting independently from CV content and design.
Parameters:
-
file_path(Path | None, default:None) –Optional path to write file.
-
locale(str, default:'english') –Language/date format identifier.
Returns:
-
str | None–YAML string if file_path is None, otherwise None after writing file.
Source code in src/rendercv/schema/sample_generator.py
create_sample_rendercv_pydantic_model(*, name='John Doe', theme='classic', locale='english')
¶
Build sample CV model from sample content.
Why
New users need working examples to understand structure. Sample content provides realistic content that validates successfully and renders to all output formats without errors.
Parameters:
-
name(str, default:'John Doe') –Person's full name.
-
theme(str, default:'classic') –Design theme identifier.
-
locale(str, default:'english') –Locale language identifier.
Returns:
-
RenderCVModel–Validated model with sample content.
Source code in src/rendercv/schema/sample_generator.py
create_sample_settings_file(*, file_path=None, omitted_fields=None)
¶
Generate a sample YAML file containing only the settings section.
Why
Standalone settings files let users configure render options independently from CV content, design, and locale.
Parameters:
-
file_path(Path | None, default:None) –Optional path to write file.
Returns:
-
str | None–YAML string if file_path is None, otherwise None after writing file.
Source code in src/rendercv/schema/sample_generator.py
create_sample_yaml_file(*, dictionary, file_path=None)
¶
Convert a dictionary to formatted YAML and optionally write to file.
Why
Multiple sample file generators share the same conversion and file-writing logic. Centralizing it avoids duplication across create_sample_cv_file, create_sample_design_file, etc.
Parameters:
-
dictionary(dict) –Data structure to convert to YAML.
-
file_path(Path | None, default:None) –Optional path to write file.
Returns:
-
str | None–YAML string if file_path is None, otherwise None after writing file.
Source code in src/rendercv/schema/sample_generator.py
create_sample_yaml_input_file(*, file_path=None, name='John Doe', theme='classic', locale='english')
¶
Generate formatted sample YAML with schema hint and commented design options.
Why
New command provides users with immediately usable CV templates. JSON schema hint enables IDE autocompletion, commented design fields show customization options without overwhelming beginners.
Example
Parameters:
-
file_path(Path | None, default:None) –Optional path to write file.
-
name(str, default:'John Doe') –Person's full name.
-
theme(str, default:'classic') –Design theme identifier.
-
locale(str, default:'english') –Language/date format identifier.
Returns:
-
str | None–YAML string if file_path is None, otherwise None after writing file.
Source code in src/rendercv/schema/sample_generator.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
dictionary_to_yaml(dictionary)
¶
Convert dictionary to formatted YAML string with multiline preservation.
Why
Sample YAML generation must produce readable output with proper formatting for multiline strings. Custom representer ensures bullet points and descriptions use pipe syntax.
Parameters:
-
dictionary(dict) –Data structure to convert.
Returns:
-
str–Formatted YAML string.
Source code in src/rendercv/schema/sample_generator.py
rendercv_model_to_dictionary(data_model)
¶
Convert a RenderCVModel to a plain dictionary via JSON serialization.
Why
The YAML library sometimes has problems with the dictionary returned by Pydantic's model_dump(). Converting through JSON first produces clean Python dicts that serialize reliably.
Parameters:
-
data_model(RenderCVModel) –Validated RenderCV model.
Returns:
-
dict–Plain dictionary representation of the model.