You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Discussion] Issue with importing "-" packages either on the same level or nested. #1266
Hello @Peefy , I continue to enjoy my learning of KCL)
Yet met another minor bug in import, which you might be aware of... If issue with importing modules has been resolved, I'm successfully able to import artifathub modules with dashes in name. Local packages seem to misbehave.
1. Minimal reproduce step (Required)
tree
.
├── a-b.k
├── a.k
├── kcl.mod
└── kcl.mod.lock
a.k:
# It actually could be import nested.a_b (in case file is nested/a-b.k)
import .a_b
output = a_b.hello
kcl.mod:
[package]
name = "iaas-alerting"
edition = "v0.8.0"
version = "0.0.1"
[dependencies]
victoria-metrics-operator = { oci = "oci://ghcr.io/kcl-lang/victoria-metrics-operator", tag = "0.0.1" }
k8s = { oci = "oci://ghcr.io/kcl-lang/k8s", tag = "1.28" }
4. What is your KCL components version? (Required)
Yes. Local packages are yet not supported. It is just a little like python, we can use the pip package that contains - but we can not import local package contains -
changed the title [-][bug] Issue with importing "-" packages either on the same level or nested.[/-][+][Discussion] Issue with importing "-" packages either on the same level or nested.[/+]on May 2, 2024
I see, getting best of python, doesn't necessary mean that kcl import system should resemble this behavior. For the perspective of uniform behavior import of remote modules or local packages could behave the same way, i.e. it works for remote and it works for local the same way...
Though it's not clear how to differentiate a_b.k and a-b.k :))) without a failure... It would be nice if KCL blended best from Go and Python... Namely go like import system could look better:
Activity
Peefy commentedon May 2, 2024
Yes. Local packages are yet not supported. It is just a little like python, we can use the pip package that contains - but we can not import local package contains -
[-][bug] Issue with importing "-" packages either on the same level or nested.[/-][+][Discussion] Issue with importing "-" packages either on the same level or nested.[/+]dennybaa commentedon May 2, 2024
I see, getting best of python, doesn't necessary mean that kcl import system should resemble this behavior. For the perspective of uniform behavior import of remote modules or local packages could behave the same way, i.e. it works for remote and it works for local the same way...
Though it's not clear how to differentiate
a_b.kanda-b.k:))) without a failure... It would be nice if KCL blended best from Go and Python... Namely go like import system could look better:import (
"pkg.a-k" as ak
"pkg.a_k" as a_k
)
But this is all preferences...