def _populate_demo_app(name_variants: NameVariants):
    """Populate the demo app that imports the custom components.

    Args:
        name_variants: the tuple including various names such as package name, class name needed for the project.
    """
    from reflex import constants
    from reflex.compiler import templates
    from reflex.reflex import _init

    demo_app_dir = Path(name_variants.demo_app_dir)
    demo_app_name = name_variants.demo_app_name

    console.info(f"Creating app for testing: {demo_app_dir!s}")

    demo_app_dir.mkdir(exist_ok=True)

    with set_directory(demo_app_dir):
        # We start with the blank template as basis.
        _init(name=demo_app_name, template=constants.Templates.DEFAULT)
        # Then overwrite the app source file with the one we want for testing custom components.
        # This source file is rendered using jinja template file.
        demo_file = Path(f"{demo_app_name}/{demo_app_name}.py")
        demo_file.write_text(
            templates.CUSTOM_COMPONENTS_DEMO_APP.render(
                custom_component_module_dir=name_variants.custom_component_module_dir,
                module_name=name_variants.module_name,
            )
        )
        # Append the custom component package to the requirements.txt file.
        with Path(f"{constants.RequirementsTxt.FILE}").open(mode="a") as f:
            f.write(f"{name_variants.package_name}\n")
Populate the demo app that imports the custom components.

    Args:
        name_variants: the tuple including various names such as package name, class name needed for the project.
    
reflex/custom_components/custom_components.py