kcl-lang / kcl

KCL Programming Language (CNCF Sandbox Project). https://kcl-lang.io
https://kcl-lang.io
Apache License 2.0
1.61k stars 112 forks source link

[LFX] Enhancement: KCL IDE automatically updates the dependencies through kpm #998

Closed zong-zhe closed 3 months ago

zong-zhe commented 8 months ago

Enhancement

When a KCL package is loaded using KCL IDE, the IDE automatically updates the dependencies of the current KCL package through the kcl mod command.

PreTest

octonawish-akcodes commented 8 months ago

Can I some more context here? @zong-zhe @Peefy

zong-zhe commented 8 months ago

Hi @octonawish-akcodes πŸ˜„

Let me add more details to this issue.

KCL IDE is the main interface for users to write KCL, and kpm is the package management tool for KCL, used for managing KCL's third-party libraries.

KCL IDE is developed based on LSP - https://microsoft.github.io/language-server-protocol/ @He1pa 😊 can provide more details about KCL IDE.

KCL IDE uses kpm commands to manage KCL packages. The main work of this issue is to make KCL IDE automatically update the current KCL package's third-party dependencies according to the kcl.mod file in the KCL package when loading the KCL package, so that a legal KCL package will not cause errors cased by the third-party dependencies has not been updated.

The command used by kpm to update the KCL package's third-party library is kcl mod update, more details

Sorry that there is no document about `kcl mod update` on the official website https://kcl-lang.io/docs/tools/cli/package-management/command-reference/init, which is our negligence. We have raised an issue https://github.com/kcl-lang/kcl-lang.io/issues/253 to track this issue.

We previously integrated a command kcl mod metadata to help the IDE find KCL third-party libraries during the compilation process. kcl mod updatecan be integrated with KCL IDE in a similar way

If any other questions, please let me know πŸ˜„ πŸ˜„ πŸ˜„

octonawish-akcodes commented 8 months ago

Just a small query, how can I test my code?

d4v1d03 commented 8 months ago

/assign

d4v1d03 commented 8 months ago

Hey @zong-zhe, i got over the explaination you've given and have doubts regarding my conclusion, please correct me if i am wrong. So the fetch_metadata() function just gives us the output that fetch_mod_metadata() function returns after it passes the command 'kcl mod metadata'... from this, we store those third-party dependencies and iterate over each and verify if they need to be upgraded or not.

d4v1d03 commented 8 months ago

I can try to figure this out on my own but can you please save my time by mentioning how do i check this "version of a third-party dependency".Thank you. 😊

octonawish-akcodes commented 8 months ago

I believe you can see the versions of those third party dependencies in kcl.mod file.

zong-zhe commented 7 months ago

Hey @zong-zhe, i got over the explaination you've given and have doubts regarding my conclusion, please correct me if i am wrong. So the fetch_metadata() function just gives us the output that fetch_mod_metadata() function returns after it passes the command 'kcl mod metadata'... from this, we store those third-party dependencies and iterate over each and verify if they need to be upgraded or not.

Hi @d4v1d03 πŸ˜„ Good question ! πŸ‘ Our design is that all functionalities related to package management are handled by kpm. The KCL IDE is only responsible for sending requests to kpm and obtaining the corresponding processing results.Β Therefore, the storage and validation of third-party dependencies is done in kpm.

kpm is here ! - https://github.com/kcl-lang/kpm

zong-zhe commented 7 months ago

I can try to figure this out on my own but can you please save my time by mentioning how do i check this "version of a third-party dependency".Thank you. 😊

Hi @d4v1d03 , The Package Version Management is still in progress. More details here: https://github.com/kcl-lang/kpm/issues/246

d4v1d03 commented 7 months ago

Ok @zong-zhe , thanks for the clarification. I will work on the pretest you mentioned over here. Are there any couple more to work on so i could get a good grasp of kpm.

Peefy commented 3 months ago

Closed as 2024 LFX Phase 1 has already ended and open another one