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

Enhancement: The feature renaming dependency is incomplete #397

Open
zong-zhe opened this issue Jul 24, 2024 · 6 comments · May be fixed by #420
Open

Enhancement: The feature renaming dependency is incomplete #397

zong-zhe opened this issue Jul 24, 2024 · 6 comments · May be fixed by #420
Assignees
Labels
enhancement New feature or request

Comments

@zong-zhe
Copy link
Contributor

Problem

The current kpm renaming dependency is incomplete, the current state of this function is only to replace the dependent name in kcl.mod.

This will result in the following situation:

kcl mod add helloworld:0.1.0 --rename new_helloworld

The command above will add dependency into kcl.mod as below

[dependencies]
new_helloworld = 0.1.0

And the kcl.mod.lock

[dependencies]
  [dependencies.new_helloworld]
    name = "new_helloworld"
    full_name = "new_helloworld_0.1.0"
    version = "0.1.0"

And these incomplete information does not support updating the dependency for helloworld when kcl mod update or kcl run. The link between helloworld and new_helloworld is missing.

Solution

Referring to cargo, add a package field to declare the association between new name and old name in kcl.mod.

Here is a example:

[dependencies]
new-flask-demo-kcl-manifests = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", version = "v0.1.0", package = "flask-demo-kcl-manifests" }
flask-demo-kcl-manifests = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", version = "v0.1.0" }

new_helloworld = { version = "1.0.0", package = "helloworld" }
helloworld = "1.0.0"
@zong-zhe zong-zhe self-assigned this Jul 24, 2024
@zong-zhe zong-zhe added the enhancement New feature or request label Jul 24, 2024
@Manoramsharma
Copy link
Contributor

Hi @zong-zhe I would like to collaborate on this one.

@zong-zhe
Copy link
Contributor Author

Hi @Manoramsharma 😃

Are you going to finish this part of the work?

@Manoramsharma
Copy link
Contributor

@zong-zhe It will be better if you can add some sub-tasks that will ultimately be achieving this and I can contribute to those small sub-tasks if you think this issue to be a complex one.

@zong-zhe
Copy link
Contributor Author

Hi @Manoramsharma 😃

The first step is to add this package field so that you can write something like this in kcl.mod

new_helloworld = {version = "1.0.204", package = "new_helloworld"} 

flask-demo-kcl-manifests_new = {git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", version = "v0.1.0 ", package = “flask-demo-kcl-manifests” } 

helloworld_oci = {oci = "https://ghcr.io/kcl-lang/helloworld ", version = "v0.1.0, "package =" helloworld_oci "} 

The first PR is that kcl.mod supports reading and writing to the above formats with package.

Change the contents of this file and write the corresponding tests for your work: https://github.com/kcl-lang/kpm/blob/main/pkg/downloader/toml.go

@Gmin2
Copy link
Contributor

Gmin2 commented Jul 30, 2024

Hey @zong-zhe
image
the rename flag is not working as described above
Screencast from 30-07-24 10:29:27 PM IST.webm

@Manoramsharma Manoramsharma linked a pull request Jul 30, 2024 that will close this issue
15 tasks
@zong-zhe
Copy link
Contributor Author

zong-zhe commented Aug 1, 2024

Hey @zong-zhe image the rename flag is not working as described above Screencast from 30-07-24 10:29:27 PM IST.webm

Hi @Gmin2 😃

kpm is currently used by the kcl cli as a library. The kpm command has not been maintained for a long time. You can try to test this function through the kcl cli.

kcl cli - https://github.com/kcl-lang/cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants