Skip to content

Commit 56aed65

Browse files
authored
Merge pull request #228 from zong-zhe/release-0.7.0-blog
feat: release 0.7.0 blogs
2 parents c44c766 + d9efc8e commit 56aed65

File tree

11 files changed

+683
-0
lines changed

11 files changed

+683
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
---
2+
slug: 2023-11-30-kcl-0.7.0-release
3+
title: KCL v0.7.0 Release Blog
4+
authors:
5+
name: KCL Team
6+
title: KCL Team
7+
tags: [Release Blog, KCL]
8+
---
9+
10+
## Introduction
11+
12+
The KCL team is pleased to announce that KCL v0.7.0 is now available! This release has brought three key updates to everyone: **Language**, **Tools**, and **Integrations**.
13+
14+
- _Use KCL language, tools and IDE extensions with more complete features and fewer errors to improve code writing experience and efficiency._
15+
16+
- _The new KCL CLI integrates KCL package management, doc, test and other peripheral ecosystems._
17+
18+
- _The rich KCL third-party library market artifacthub.io provides more than 200 KCL third-party libraries for you to choose from._
19+
20+
KCL v0.7.0 is now available for download at [KCL v0.7.0 Release Page](https://github.com/kcl-lang/kcl/releases/tag/v0.7.0) or [KCL Official Website](https://kcl-lang.io).
21+
22+
[KCL](https://github.com/kcl-lang/kcl) is an open-source, constraint-based record and functional language hosted by Cloud Native Computing Foundation (CNCF). KCL improves the writing of numerous complex configurations, such as cloud-native scenarios, through its mature programming language technology and practice. It is dedicated to building better modularity, scalability, and stability around configurations, simpler logic writing, faster automation, and great built-in or API-driven integrations.
23+
24+
This blog will introduce the content of KCL v0.7.0 and recent developments in the KCL community to readers.
25+
26+
## Language Updates
27+
28+
### ⭐️ New KCL CLI
29+
30+
When compiling, use `kcl`, when downloading packages, use `kpm`, if you have a KCL model that you want to send to the cluster, you also need to use `kusion`, kcl is the compilation command, `kpm run` can also be compiled, I also found `kusion compile` in the kusion command line, do you have the same confusion, what is the relationship between these tools? How do I use them?
31+
32+
For this reason, we provide you with a new KCL CLI, the goal is to include the KCL ecosystem together, to provide you with a unified and concise operation page, everything, one-click direct.
33+
34+
The new KCL CLI will continue to use `kcl` as the command prefix, and currently provides multiple sub-commands including compilation, package management, and formatting tools.
35+
36+
![cli-help](/img/blog/2023-11-30-kcl-0.7.0-release/cli-help.png)
37+
38+
### πŸ”§ Diagnostic Information Optimization
39+
40+
We have tried to add repair suggestions in some error messages. If you are frustrated by the KCL compilation failure, you may wish to listen to the compiler's suggestions.
41+
42+
```python
43+
import sub as s1
44+
45+
The_first_kcl_program = s.The_first_kcl_program
46+
```
47+
48+
Let's listen to what the compiler says. You may have written `s1` as `s` by mistake.
49+
50+
![did you mean](/img/blog/2023-11-30-kcl-0.7.0-release/did-you-mean.png)
51+
52+
KCL cannot find the third-party library used in the package? Try `kcl mod add`, if it still doesn't work, we have prepared more than 200 KCL models for you on artifacthub.io, come and have a look, there is always one that suits you!
53+
54+
![try-kcl-mod-add](/img/blog/2023-11-30-kcl-0.7.0-release/try-kcl-mod-add.png)
55+
56+
### πŸš€ Language Writing Experience Optimization
57+
58+
#### Removed indentation check in some code blocks
59+
60+
In some code blocks, whether the indentation is aligned has become less important.
61+
62+
If your code is written like this
63+
64+
```python
65+
schema TestIndent:
66+
name: str
67+
msg: str
68+
id: int
69+
70+
test_indent = TestIndent {
71+
name = "test"
72+
msg = "test"
73+
id = 1
74+
}
75+
```
76+
77+
In the past, you may have encountered a lot of red errors, but now this is not a mistake, `kcl fmt` will help you tidy it up.
78+
79+
![kcl-fmt](/img/blog/2023-11-30-kcl-0.7.0-release/kclfmt.gif)
80+
81+
#### Lambda expression type annotation
82+
83+
In the new version of KCL, we have added type annotations for lambda expressions, and you can write lambda with type annotations in the new version of KCL.
84+
85+
```python
86+
schema Test:
87+
name: str
88+
89+
identity: (Test) -> bool = lambda res: Test -> bool {
90+
res.name == "hello"
91+
}
92+
93+
c = identity(Test { name = "hello" })
94+
```
95+
96+
### πŸ„ API Updates
97+
98+
- New KCL unit test API: _[https://github.com/kcl-lang/kcl/pull/904](https://github.com/kcl-lang/kcl/pull/904)_
99+
- KCL schema parsing API enhancement version `GetFullSchemaType` supports obtaining KCL package related information with third-party libraries. _[https://github.com/kcl-lang/kcl/pull/906](https://github.com/kcl-lang/kcl/pull/906)_
100+
- New KCL symbol renaming API: _[https://github.com/kcl-lang/kcl/pull/890](https://github.com/kcl-lang/kcl/pull/890)_
101+
102+
### 🐞 Other Updates and Bug Fixes
103+
104+
- KCL command-line tool supports compiling input file wildcards e.g., `kcl path/to/*.k`
105+
- Fix the type inference error of dictionary types https://github.com/kcl-lang/kcl/pull/900
106+
- Fix the check of Schema parameters https://github.com/kcl-lang/kcl/pull/877/files
107+
- Fix the problem that the compilation cache of KCL programs with third-party libraries is invalid https://github.com/kcl-lang/kcl/pull/841
108+
- In the error message, complete the missing lambda type information https://github.com/kcl-lang/kcl/pull/771
109+
- Fix the problem of singular and plural in diagnostic information https://github.com/kcl-lang/kcl/pull/769
110+
- Fix the problem that the type check is invalid in the assignment statement with type annotation https://github.com/kcl-lang/kcl/pull/757
111+
- Add a check to prohibit duplicate import statements https://github.com/kcl-lang/kcl/pull/727
112+
113+
## IDE & Toolchain Updates
114+
115+
### IDE Updates
116+
117+
#### KCL IDE supports goto reference and renaming of symbols
118+
119+
IDE supports goto reference of symbols, using `goto reference` or `find all references`:
120+
121+
![find-ref](/img/docs/tools/Ide/vs-code/FindRefs.png)
122+
123+
IDE supports renaming of symbols:
124+
125+
![rename](/img/docs/tools/Ide/vs-code/Rename.gif)
126+
127+
#### IDE supports formatting of import statements and union types
128+
129+
We have optimized the behavior of blank lines between import statements and other code blocks (formatted as one blank line) and the behavior of spaces between union types (formatted as separated by `|`):
130+
131+
![fmt](/img/blog/2023-10-25-kcl-biweekly-newsletter/Format.gif)
132+
133+
#### KCL IDE has added a lot of completion prompts
134+
135+
We have added a lot of completion prompts for the **configuration definition**, which simplifies the user's mind of writing configuration based on the model and improves the efficiency of configuration editing. In addition, the parameter completion when calling the built-in function is enhanced. Talk is cheap, let's take a look at the effect directly:
136+
137+
![func-completion](/img/blog/2023-11-08-biweekly-newsletter/module-function-completion.gif)
138+
139+
![conf-completion](/img/blog/2023-11-08-biweekly-newsletter/config-completion.gif)
140+
141+
And for the **model design**, we have also added a quick generation of docstring to reduce the boilerplate of typing by hand:
142+
143+
![gen-docstring](/img/blog/2023-11-08-biweekly-newsletter/docstring-gen.gif)
144+
145+
#### Performance
146+
147+
- KCL has designed and restructured a new semantic model, as well as an API that supports nearest symbol search and symbol semantic information query.
148+
- The migration of IDE completion, jump, and hover functions to new semantic models significantly reduces the difficulty and code volume of IDE development.
149+
- The KCL compiler supports syntax incremental parsing and semantic incremental checking, which improves the performance of KCL compilation, construction, and IDE plugin usage in most scenarios by **5-10 times**.
150+
151+
#### KCL IDE other updates and bug fixes
152+
153+
- KCL IDE extension for IntelliJ 2023.2+
154+
- Fix the problem that the language service virtual file system related bug: the file dimension change will cause the language service to crash and must be restarted to recover, which has now been fixed.
155+
- Support import statement completion of external package dependencies introduced by package management tools
156+
- Fix the display position of the function parameter undefined type error
157+
158+
### Test Tool Updates
159+
160+
Are you worried that your KCL program is written incorrectly? Why not come and test it? This update provides a new KCL test tool.
161+
162+
The new KCL test tool supports writing unit tests using KCL lambda and executing tests using the tool.
163+
164+
You can write your test cases through lambda expressions in the file with the suffix `_test.k`.
165+
166+
```python
167+
import .app
168+
169+
# Convert the `App` model into Kubernetes Deployment and Service Manifests
170+
test_kubernetesRender = lambda {
171+
a = app.App {
172+
name = "app"
173+
containers.ngnix = {
174+
image = "ngnix"
175+
ports = [{containerPort = 80}]
176+
}
177+
service.ports = [{ port = 80 }]
178+
}
179+
deployment_got = kubernetesRender(a)
180+
assert deployment_got[0].kind == "Deployment"
181+
assert deployment_got[1].kind == "Service"
182+
}
183+
```
184+
185+
You can run this test case and view the test results through `kcl test`.
186+
187+
After the test is passed, you will get the following results:
188+
189+
![test-pass](/img/blog/2023-11-30-kcl-0.7.0-release/test-pass.png)
190+
191+
If your test fails, `kcl test` will output error information to help you troubleshoot the problem.
192+
193+
![test-failed](/img/blog/2023-11-30-kcl-0.7.0-release/test-failed.png)
194+
195+
### KCL Package Management
196+
197+
The `update` command is added to the `kcl mod` command. The `update` command is used to automatically update local dependencies. `kcl mod update` will automatically download the missing third-party libraries for you. For details, please refer to: https://github.com/kcl-lang/kpm/pull/212
198+
199+
### KCL Import Tool
200+
201+
The KCL Import tool supports one-click generation of KCL configuration/models from YAML/JSON/CRD/Terraform Schema, realizing automated migration.
202+
203+
If you have the following yaml file:
204+
205+
```yaml
206+
apiVersion: apps/v1
207+
kind: Deployment
208+
metadata:
209+
name: nginx-deployment
210+
labels:
211+
app: nginx
212+
spec:
213+
replicas: 3
214+
selector:
215+
matchLabels:
216+
app: nginx
217+
template:
218+
metadata:
219+
labels:
220+
app: nginx
221+
spec:
222+
containers:
223+
- name: nginx
224+
image: nginx:1.14.2
225+
ports:
226+
- containerPort: 80
227+
```
228+
229+
You can convert it to a KCL program through the command `kcl import test.yaml`.
230+
231+
```python
232+
"""
233+
This file was generated by the KCL auto-gen tool. DO NOT EDIT.
234+
Editing this file might prove futile when you re-run the KCL auto-gen generate command.
235+
"""
236+
237+
apiVersion = "apps/v1"
238+
kind = "Deployment"
239+
metadata = {
240+
name = "nginx-deployment"
241+
labels = {
242+
app = "nginx"
243+
}
244+
}
245+
spec = {
246+
replicas = 3
247+
selector = {
248+
matchLabels = {
249+
app = "nginx"
250+
}
251+
}
252+
template = {
253+
metadata = {
254+
labels = {
255+
app = "nginx"
256+
}
257+
}
258+
spec = {
259+
containers = [
260+
{
261+
name = "nginx"
262+
image = "nginx:1.14.2"
263+
ports = [
264+
{
265+
containerPort = 80
266+
}
267+
]
268+
}
269+
]
270+
}
271+
}
272+
}
273+
```
274+
275+
More details: https://kcl-lang.io/docs/user_docs/guides/working-with-k8s/adopt-from-kubernetes
276+
277+
## Community Integrations & Extensions Updates
278+
279+
### KCL Marketplace with ArtifactHub
280+
281+
Through the integration of artifacthub.io, we have built a KCL third-party library market, where you can share your KCL programs with us. You can also choose freely and find the KCL third-party library that suits you!
282+
283+
Open the homepage of artifacthub.io, search for the keyword you need directly, and you can see the relevant content about the KCL third-party library!
284+
285+
![artifachub-index](/img/blog/2023-11-30-kcl-0.7.0-release/artifachub-index.png)
286+
287+
Click on the third-party library homepage, you can view the detailed content and related documents about the third-party library.
288+
289+
![pkg-page](/img/blog/2023-11-30-kcl-0.7.0-release/pkg-page.png)
290+
291+
If you don't know how to use these third-party libraries, the button on the right can bring up the installation page for you.
292+
293+
![install-pkg](/img/blog/2023-11-30-kcl-0.7.0-release/install-pkg.png)
294+
295+
Welcome to contribute your third-party libraries to the KCL community on artifacthub.io and make the KCL community more colorful!
296+
297+
Contributing to KCL Marketplace: https://kcl-lang.io/docs/user_docs/guides/package-management/how-to/publish_pkg_to_ah
298+
299+
## Other Updates
300+
301+
The full update and bugfix List of KCL v0.7.0 can be found at: https://github.com/kcl-lang/kcl/compare/v0.6.0...v0.7.0
302+
303+
## Document Updates
304+
305+
The versioning semantic option is added to the [KCL website](https://kcl-lang.io/). Currently, v0.4.x, v0.5.x, v0.6.x and v0.7.0 versions are supported.
306+
307+
## Community Updates
308+
309+
### KCL Officially Becomes CNCF Sandbox Project
310+
311+
πŸŽ‰ πŸŽ‰ πŸŽ‰ On September 20, 2023, the KCL project passed the evaluation of the Technical Oversight Committee of the Cloud Native Computing Foundation (CNCF), the world's top open source foundation, and officially became a CNCF sandbox project.
312+
313+
More details - https://kcl-lang.io/blog/2023-09-19-kcl-joining-cncf-sandbox/
314+
315+
## Next Steps
316+
317+
We expect to release KCL v0.8.0 in February 2024. For more details, please refer to KCL 2024 Roadmap and KCL v0.8.0 Milestone. If you have more ideas and needs, please feel free to raise Issues or Discussions in the KCL Github repository, and welcome to join our community for discussion πŸ™Œ πŸ™Œ πŸ™Œ
318+
319+
- KCL 2024 Roadmap: https://github.com/kcl-lang/kcl/issues/882
320+
- KCL v0.8.0 Milestone: https://github.com/kcl-lang/kcl/milestone/8
321+
- KCL GitHub Issues: https://github.com/kcl-lang/kcl/issues
322+
- KCL GitHub Discussion: https://github.com/orgs/kcl-lang/discussions
323+
- KCL Community: https://github.com/kcl-lang/community
324+
325+
## Additional Resources
326+
327+
For more information, see [KCL FAQ](https://kcl-lang.io/docs/user_docs/support/).
328+
329+
## Resources
330+
331+
Thank all KCL users for their valuable feedback and suggestions during this version release. For more resources, please refer to:
332+
333+
- [KCL Website](https://kcl-lang.io/)
334+
- [Kusion Website](https://kusionstack.io/)
335+
- [KCL Repo](https://github.com/kcl-lang/kcl)
336+
- [Kusion Repo](https://github.com/KusionStack/kusion)
337+
338+
See the [community](https://github.com/kcl-lang/community) for ways to join us. πŸ‘πŸ‘πŸ‘

0 commit comments

Comments
Β (0)