Skip to content

Commit

Permalink
Generate code from pipeline (pipeline.to_code()) (#2214)
Browse files Browse the repository at this point in the history
* pipeline.to_code() with jupyter support

* Update Documentation & Code Style

* add imports

* refactoring

* Update Documentation & Code Style

* docstrings added and refactoring

* Update Documentation & Code Style

* improve imports code generation

* add comment param

* Update Documentation & Code Style

* add simple test

* add to_notebook_cell()

* Update Documentation & Code Style

* introduce helper classes for code gen and eval report gen

* add more tests

* Update Documentation & Code Style

* fix Dict typings

* Update Documentation & Code Style

* validate user input before code gen

* enable urls for to_code()

* Update Documentation & Code Style

* remove all chars except colon from validation regex

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
tstadel and github-actions[bot] authored Feb 23, 2022
1 parent 4bad21e commit e20f2e0
Show file tree
Hide file tree
Showing 3 changed files with 694 additions and 127 deletions.
38 changes: 38 additions & 0 deletions docs/_src/api/api/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,44 @@ Returns a configuration for the Pipeline that can be used with `BasePipeline.loa

- `return_defaults`: whether to output parameters that have the default values.

<a id="base.BasePipeline.to_code"></a>

#### to\_code

```python
def to_code(pipeline_variable_name: str = "pipeline", generate_imports: bool = True, add_comment: bool = False) -> str
```

Returns the code to create this pipeline as string.

**Arguments**:

- `pipeline_variable_name`: The variable name of the generated pipeline.
Default value is 'pipeline'.
- `generate_imports`: Whether to include the required import statements into the code.
Default value is True.
- `add_comment`: Whether to add a preceding comment that this code has been generated.
Default value is False.

<a id="base.BasePipeline.to_notebook_cell"></a>

#### to\_notebook\_cell

```python
def to_notebook_cell(pipeline_variable_name: str = "pipeline", generate_imports: bool = True, add_comment: bool = True)
```

Creates a new notebook cell with the code to create this pipeline.

**Arguments**:

- `pipeline_variable_name`: The variable name of the generated pipeline.
Default value is 'pipeline'.
- `generate_imports`: Whether to include the required import statements into the code.
Default value is True.
- `add_comment`: Whether to add a preceding comment that this code has been generated.
Default value is True.

<a id="base.BasePipeline.load_from_config"></a>

#### load\_from\_config
Expand Down
Loading

0 comments on commit e20f2e0

Please sign in to comment.