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

Simplify .show_graph() by extracting functions for the raw syntax? #20684

Open
etiennebacher opened this issue Jan 13, 2025 · 0 comments
Open

Comments

@etiennebacher
Copy link
Contributor

etiennebacher commented Jan 13, 2025

Originally posted in #20631 but it may be better in a separate issue.

It seems to me that .show_graph() becomes quite complicated by returning various output types depending on the arguments (and #20631 also adds some complexity). It's also not very clear from the outside how those arguments interact. For example if I read

.show_graph(show=True, raw_output_format="mermaid", output_path="foobar")

then it's not clear to me what I should expect (the current behavior would be to ignore show and output_path).

Since to_dot() and to_mermaid() already exist (or will exist) on the Rust side, wouldn't it be better to have the following function signatures in Python?

def to_dot(
    self,
    *,
    [ optimization args ]
) -> str

def to_mermaid(
    self,
    *,
    [ optimization args ]
) -> str

def show_graph(
    self,
    *,
    format = "graphviz",
    output_path = None,
    [ optimization args ]
) -> None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant