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

Allows to use Python plugins directly #1831

Open
wonderyl opened this issue Jan 19, 2025 · 3 comments
Open

Allows to use Python plugins directly #1831

wonderyl opened this issue Jan 19, 2025 · 3 comments
Assignees
Labels
Milestone

Comments

@wonderyl
Copy link

Feature Request

Is your feature request related to a problem? Please describe:
I'm a new KCL users, please correct me if I'm wrong. My understanding is, to use a Python plugin, we need to run a KCL file within Python. This crease inconvenience.

Describe the feature you'd like:
With interpreter-based language, like Python, KCL can run the plug-in on the fly. This would allow KCL to access a rich set of libraries of Python without any boilerplate.

Describe alternatives you've considered:
The existing plugin solution.

Teachability, Documentation, Adoption, Migration Strategy:
n/a

@He1pa
Copy link
Contributor

He1pa commented Feb 5, 2025

Are you asking for this?

@wonderyl
Copy link
Author

wonderyl commented Feb 5, 2025

Nope.
Correct me if I'm wrong, but the existing plug-in system requires kcl to be called within the language, not the otherway around.
I want to KCL to call a Python function directly. When this is implemented, you can use all existing libs of Python without any boilerplate.

@Peefy Peefy added the feat label Feb 5, 2025
@Peefy
Copy link
Contributor

Peefy commented Feb 5, 2025

Actually, this is feasible. What we need to do is to extend the implementation of the Client interface in the KCL Lib SDK that KCL CLI depends on, replacing NativeClient with PythonClient.

The Python client does the following things:

  1. Call Rust Core through the KCL Python Binding
  2. Dynamically search and load Python plugin functions through python importlib

@Peefy Peefy added this to the v1.0 Release milestone Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants