Skip to content

Conversation

Kimahriman
Copy link
Contributor

@Kimahriman Kimahriman commented Jul 17, 2025

Resolves #646

What changes were proposed in this pull request?

Lazily import connect client to avoid import errors if not trying to use connect. If the user is using connect (i.e. is_remote() is true), it will throw an error if there is a dependency issue when creating the graphframe object.

Why are the changes needed?

To let the python package work with classic spark without grpc related dependencies installed.

return GraphFrame(impl.vertices, impl.edges)

def __init__(self, v: DataFrame, e: DataFrame) -> None:
self._impl: GraphFrameClassic | 'GraphFrameConnect'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of typing issues but fixed this one at least while I was here. _impl defaulted to the first thing assigned to it which was GraphFrameConnect

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope one day to implement something cool instead, like spark's decorator about dynamic dispatch... This "_impl" based realization is not perfect :(

@SemyonSinchenko
Copy link
Collaborator

jfyi: There is a pre-comfigured pre-commit.

pre-coomit --all-files should work

Copy link
Collaborator

@SemyonSinchenko SemyonSinchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for it!

@SemyonSinchenko SemyonSinchenko merged commit ff7a20d into graphframes:master Jul 17, 2025
5 checks passed
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

Successfully merging this pull request may close these issues.

bug: graphframes-py requires grpc related dependencies
2 participants