kcl-lang / kpm

KCL Package Manager
https://kcl-lang.io
Apache License 2.0
27 stars 44 forks source link

[LFX] Enhancement: KCL Package Management Dependencies Sparse Checkout #304

Closed zong-zhe closed 2 months ago

zong-zhe commented 6 months ago

Enhancement

kpm is a package management tool for KCL. When the scale of KCL project becomes larger and larger, and the external packages that KCL project relies on become more and more, kpm will become slow due to the need to download a large number of third-party dependencies. kpm needs to support Sparse-Checkout, which means downloading specific dependencies as needed rather than all of them, to improve the performance of the kpm.

kpm currently supports managing third-party library dependencies through Git repositories. It requires that a kcl.mod file must be present at the root directory of the Git repository. kpm treats the entire Git repository as a single KCL package. This approach presents performance problem when dealing with monorepos, which may contain many KCL packages. The current KCL program might only depend on one of these packages, and KPM would only need to download that specific package, not the entire repository. Therefore, when adding Git repositories as third-party dependencies in kpm, there is a need to support adding a subdirectory of a Git repository as the third-party dependency.

d4v1d03 commented 6 months ago

What's the pre-test to this issue @zong-zhe , @Peefy ?

zong-zhe commented 6 months ago

Hi @d4v1d03 πŸ˜„ Welcome ! I update the pretest for this issue.

officialasishkumar commented 6 months ago
β”œβ”€β”€ my_package
β”‚Β Β  β”œβ”€β”€ a.xyz
β”‚Β Β  β”œβ”€β”€ b.xyz
β”‚Β Β  β”œβ”€β”€ kcl.mod
β”‚Β Β  β”œβ”€β”€ kcl.mod.lock
β”‚Β Β  └── main.k
β”œβ”€β”€ my_package_1
β”‚Β Β  β”œβ”€β”€ kcl.mod
β”‚Β Β  β”œβ”€β”€ kcl.mod.lock
β”‚Β Β  └── main.k

If this is the entire working directory of my monorepo for KCL, will sparse checkout isolate a directory, such as my_package_1, when running KPM commands from the root?

Additionally, please let me know if there are any specific functionalities required.

cc: @zong-zhe @Peefy

officialasishkumar commented 6 months ago

Hey,

How do you want me to send the design doc? Through email or a pull request?

cc: @zong-zhe @Peefy

zong-zhe commented 6 months ago

Hey,

How do you want me to send the design doc? Through email or a pull request?

cc: @zong-zhe @Peefy

Hi πŸ˜€οΌŒPR for a markdown is OK.

zong-zhe commented 5 months ago

Hi @officialasishkumar @d4v1d03 πŸ˜„

I have added a new Pretest 3, which is responsible for refactoring the code of kpm downloading third-party dependencies from git repositories. This Pretest 3 will not change any feature, and this Pretest will help you to have a deeper understanding of the current status of kpm. Including code implementation, unit testing, integration test, etc., complete refactoring, and make it available at https://github.com/kcl-lang/cli