Repository: great-expectations/great_expectations

Issue:
Bug: Variable name in v3-api checkpoint new notebook is invalid when using "." in checkpoint name
**Describe the bug**
The boilerplate in the notebook creates an invalid variable name when using "." in the checkpoint name, see description and screenshot.

**To Reproduce**
Steps to reproduce the behavior:
- Run `great_expectations --v3-api checkpoint new my.checkpoint.name`
- Notebook opens
- The second code cell will look like this:

```
my_checkpoint_name = "my.checkpoint.name"  # This was populated from your CLI command.

my.checkpoint.name_config = f"""
(more yaml here)
"""
print(my.checkpoint.name_config)
```
where `my.checkpoint.name_config` is not a valid variable name in python, hence the print statement throws an error. I assume this will be the same when using other invalid characters.

**Workaround**
Manually change the config variable name.

**Expected behavior**
The variable name should just be `config` or `checkpoint_config` and doesn't need the checkpoint name prefix. 

**Environment (please complete the following information):**
 - Operating System: Mac OS Big Sur
 - Great Expectations Version: 0.13.18

**Additional context**
See screenshot.

![Screen Shot 2021-04-22 at 3 15 57 PM](https://user-images.githubusercontent.com/1734474/115773794-90206a80-a365-11eb-9b30-97fbcea99c50.png)





Discussion:
Hi @spbail - it is a good find! Any chance you could fix as part of your getting started tutorial work or should we ask the engineering to fix this?
I'm taking this one!

Resolving patch:
diff --git a/great_expectations/cli/suite.py b/great_expectations/cli/suite.py
--- a/great_expectations/cli/suite.py
+++ b/great_expectations/cli/suite.py
@@ -113,7 +113,7 @@ def suite_new(
     no_jupyter,
 ):
     """
-    Create a new empty Expectation Suite.
+    Create a new Expectation Suite.
     Edit in jupyter notebooks, or skip with the --no-jupyter flag.
     """
     context: DataContext = ctx.obj.data_context
@@ -399,7 +399,7 @@ def suite_edit(
     no_jupyter,
 ):
     """
-    Generate a Jupyter notebook for editing an existing Expectation Suite.
+    Edit an existing Expectation Suite.
 
     The SUITE argument is required. This is the name you gave to the suite
     when you created it.
@@ -710,7 +710,7 @@ def suite_demo(ctx):
 @click.pass_context
 def suite_delete(ctx, suite):
     """
-    Delete an expectation suite from the expectation store.
+    Delete an Expectation Suite from the Expectation Store.
     """
     context: DataContext = ctx.obj.data_context
     usage_event_end: str = ctx.obj.usage_event_end
@@ -756,7 +756,7 @@ def suite_delete(ctx, suite):
 @suite.command(name="list")
 @click.pass_context
 def suite_list(ctx):
-    """Lists available Expectation Suites."""
+    """List existing Expectation Suites."""
     context: DataContext = ctx.obj.data_context
     usage_event_end: str = ctx.obj.usage_event_end
     try:
diff --git a/great_expectations/render/renderer/checkpoint_new_notebook_renderer.py b/great_expectations/render/renderer/checkpoint_new_notebook_renderer.py
--- a/great_expectations/render/renderer/checkpoint_new_notebook_renderer.py
+++ b/great_expectations/render/renderer/checkpoint_new_notebook_renderer.py
@@ -104,7 +104,7 @@ def _add_sample_checkpoint_config(self):
                 first_expectation_suite.expectation_suite_name
             )
             sample_yaml_str = f'my_checkpoint_name = "{self.checkpoint_name}" # This was populated from your CLI command.\n\n'
-            sample_yaml_str += f'{self.checkpoint_name}_config = f"""'
+            sample_yaml_str += f'yaml_config = f"""'
             sample_yaml_str += "\nname: {my_checkpoint_name}"
             sample_yaml_str += f"""
 config_version: 1.0
@@ -120,7 +120,7 @@ def _add_sample_checkpoint_config(self):
     expectation_suite_name: {first_expectation_suite_name}
 """
             sample_yaml_str += '"""'
-            sample_yaml_str += f"\nprint({self.checkpoint_name}_config)"
+            sample_yaml_str += f"\nprint(yaml_config)"
 
             self.add_code_cell(
                 sample_yaml_str,
@@ -142,7 +142,7 @@ def _add_test_and_save_your_checkpoint_configuration(self):
 If you instead wish to use python instead of yaml to configure your Checkpoint, you can use `context.add_checkpoint()` and specify all the required parameters."""
         )
         self.add_code_cell(
-            f"""my_checkpoint = context.test_yaml_config(yaml_config={self.checkpoint_name}_config)""",
+            f"""my_checkpoint = context.test_yaml_config(yaml_config=yaml_config)""",
             lint=True,
         )
 
@@ -163,7 +163,7 @@ def _add_add_checkpoint(self):
 Run the following cell to save this Checkpoint to your Checkpoint Store."""
         )
         self.add_code_cell(
-            f"context.add_checkpoint(**yaml.load({self.checkpoint_name}_config))",
+            f"context.add_checkpoint(**yaml.load(yaml_config))",
             lint=True,
         )
 


Test patch:
diff --git a/tests/cli/test_suite.py b/tests/cli/test_suite.py
--- a/tests/cli/test_suite.py
+++ b/tests/cli/test_suite.py
@@ -41,11 +41,11 @@ def test_suite_help_output(caplog):
   --help  Show this message and exit.
 
 Commands:
-  delete  Delete an expectation suite from the expectation store.
+  delete  Delete an Expectation Suite from the Expectation Store.
   demo    This command is not supported in the v3 (Batch Request) API.
-  edit    Generate a Jupyter notebook for editing an existing Expectation...
-  list    Lists available Expectation Suites.
-  new     Create a new empty Expectation Suite.
+  edit    Edit an existing Expectation Suite.
+  list    List existing Expectation Suites.
+  new     Create a new Expectation Suite.
 """
         in stdout
     )
diff --git a/tests/render/renderer/test_checkpoint_new_notebook_renderer.py b/tests/render/renderer/test_checkpoint_new_notebook_renderer.py
--- a/tests/render/renderer/test_checkpoint_new_notebook_renderer.py
+++ b/tests/render/renderer/test_checkpoint_new_notebook_renderer.py
@@ -155,7 +155,7 @@ def checkpoint_new_notebook_assets():
             "execution_count": None,
             "source": (
                 'my_checkpoint_name = "my_checkpoint_name"  # This was populated from your CLI command.\n\n'
-                'my_checkpoint_name_config = f"""\n'
+                'yaml_config = f"""\n'
                 "name: {my_checkpoint_name}\n"
                 """config_version: 1.0
 class_name: SimpleCheckpoint
@@ -170,7 +170,7 @@ def checkpoint_new_notebook_assets():
     expectation_suite_name: Titanic.warning
 """
                 '"""'
-                "\nprint(my_checkpoint_name_config)"
+                "\nprint(yaml_config)"
             ),
             "outputs": [],
         },
@@ -193,7 +193,7 @@ def checkpoint_new_notebook_assets():
             "cell_type": "code",
             "metadata": {},
             "execution_count": None,
-            "source": """my_checkpoint = context.test_yaml_config(yaml_config=my_checkpoint_name_config)""",
+            "source": """my_checkpoint = context.test_yaml_config(yaml_config=yaml_config)""",
             "outputs": [],
         },
     ]
@@ -221,7 +221,7 @@ def checkpoint_new_notebook_assets():
             "cell_type": "code",
             "metadata": {},
             "execution_count": None,
-            "source": f"context.add_checkpoint(**yaml.load(my_checkpoint_name_config))",
+            "source": f"context.add_checkpoint(**yaml.load(yaml_config))",
             "outputs": [],
         },
     ]