Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty lines in the output when using LazyImport #59

Open
A13xs opened this issue Jun 22, 2023 · 1 comment
Open

Empty lines in the output when using LazyImport #59

A13xs opened this issue Jun 22, 2023 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@A13xs
Copy link

A13xs commented Jun 22, 2023

Environment

  • Operating System: Linux
  • Python Version: 3.10
  • How did you install pyforest: pip install pyforest

Description of Issue

  • What did you expect to happen?
    Lazy loading of a library should not produce blank lines in the output.
  • What happened instead?
    A line break occurs when executing an instruction that must load the referenced library.

Reproduction Steps

  1. Run code
from pyforest import LazyImport

pd = LazyImport("import pandas as pd")

def prueba(df: pd.DataFrame) -> None:
    pass

What steps have you taken to resolve this already?

I think the problem is in this code block of _importable.py
If statements arrives empty, it will print the "\n".

Anything else?

A possible solution would be not to call the display function if there are no elements in statements.

  if len(statements) > 0:
        display(
            Javascript(
                """
            if (window._pyforest_update_imports_cell) {{ window._pyforest_update_imports_cell({!r}); }}
        """.format(
                    "\n".join(statements)
                )
            )
        )
@wenh06
Copy link

wenh06 commented Sep 16, 2023

I'm facing similar problems. pyforest generates an enormous amount (~ million lines) of invisible repeated junk messages:

image

@tkrabel tkrabel added help wanted Extra attention is needed good first issue Good for newcomers labels Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants