Cli
async_cli_task(file, nodes, update, force, save, context, background, pretty, batch, print_status, progress, model='gpt-3.5-turbo-instruct')
async
Executes a task asynchronously.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
Path
|
The file to process. |
required |
nodes |
List
|
The nodes to process. |
required |
update |
bool
|
Whether to update the task. |
required |
force |
bool
|
Whether to force the task. |
required |
save |
bool
|
Whether to save the task. |
required |
context |
bool
|
Whether to include context. |
required |
background |
bool
|
Whether to run the task in the background. |
required |
pretty |
bool
|
Whether to format the output. |
required |
batch |
bool
|
Whether to run in batch mode. |
required |
print_status |
bool
|
Whether to print the status. |
required |
progress |
Progress
|
The progress object. |
required |
model |
str
|
The model to use for the task. Defaults to "gpt-3.5-turbo-instruct". |
'gpt-3.5-turbo-instruct'
|
Returns:
Type | Description |
---|---|
None
|
None |
Side Effects
Writes to the file if save is True. Prints the pass/fail status if print_status is True. Pretty prints the result if pretty is True.
Examples:
>>> await async_cli_task(file, nodes, update, force, save, context, background, pretty, batch, print_status, progress)
None
Source code in write_the/cli/tasks.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
callback(version=typer.Option(None, '-v', '--version', help='Show the pipeline version.', is_eager=True, callback=_print_version, show_default=False))
AI-powered Code Generation and Refactoring Tool
Source code in write_the/cli/main.py
convert(in_file=typer.Argument(..., help='Path to the code file.', dir_okay=False, exists=True), out_file=typer.Argument(None, help='File to save the output to.', dir_okay=False), input_format=typer.Option(None, '--input-format', '-i', help='The input format of the file.'), output_format=typer.Option(None, '--output-format', '-o', help='The format to convert the file to.'), force=typer.Option(False, '--force', '-f', help='Generate output file even if they already exist.'), pretty=typer.Option(False, '--pretty/--plain', '-p', help='Syntax highlight the output.'), model=typer.Option(None, '--model', '-m', help='The model to use for generating the tests.', callback=_get_model_callback))
async
Convert input file to a different format.
Source code in write_the/cli/main.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
|
docs(file=typer.Argument(..., help='Path to the code file/folder.'), nodes=typer.Option(None, '--node', '-n', help='Generate docs for specific nodes (functions and classes).'), save=typer.Option(False, '--save/--print', '-s', help='Save the docstrings to file or print to stdout.'), pretty=typer.Option(False, '--pretty/--plain', '-p', help='Syntax highlight and format the output.'), context=typer.Option(False, '--context/--no-context', '-c', help='Send context (other nodes) with nodes.'), background=typer.Option(True, '--background/--no-background', '-g', help='Send background (other code) with nodes.'), force=typer.Option(False, '--force/--no-force', '-f', help='Generate docstings even if they already exist.'), update=typer.Option(False, '--update/--no-update', '-u', help='Update the existing docstrings.'), batch=typer.Option(False, '--batch/--no-batch', '-b', help='Send each node as a separate request.'), model=typer.Option(None, '--model', '-m', help='The model to use for generating the docstrings.', callback=_get_model_callback))
async
Document your code with AI.
Source code in write_the/cli/main.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 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 |
|
mkdocs(code_dir=typer.Argument(..., help='Path to the projects code. Uses docstings to build API reference.', file_okay=False), readme=typer.Option(None, help='Path to projects README (used to create index.md).', dir_okay=False), out_dir=typer.Option(Path('.'), '--out', '-o', help='Path to save output (docs/ and yaml). Defaults to current directory.'))
Generate a mkdocs website for a project including the API reference.
Source code in write_the/cli/main.py
model(desired_model=typer.Argument(None, help='Set the default model.'), list=typer.Option(False, '--list', '-l', help='List all available models.'))
View or set the default model.
Source code in write_the/cli/main.py
tests(file=typer.Argument(..., help='Path to the code file/folder.'), tests_dir=typer.Option('tests', '--out', '-o', help='Path to save the docs.'), save=typer.Option(False, '--save/--print', '-s', help='Save the tests to the tests directory or print to stdout.'), pretty=typer.Option(False, '--pretty/--plain', '-p', help='Syntax highlight the output.'), group=typer.Option(False, '--group/--flat', '-g', help='Group the tests into folder or keep them flat.'), force=typer.Option(False, '--force', '-f', help='Generate tests even if they already exist.'), empty=typer.Option(False, '--empty', '-e', help='Save empty files if a test creation fails. This will prevent write-the from regenerating failed test creations.'), model=typer.Option(None, '--model', '-m', help='The model to use for generating the tests.', callback=_get_model_callback))
async
Generate tests for your code.
Source code in write_the/cli/main.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|