Skip to main content

· 4 min read

KCL is an open-source configuration and policy language hosted by the Cloud Native Computing Foundation (CNCF) as a Sandbox Project. Built on a foundation of constraints and functional programming principles, KCL enhances the process of writing complex configurations, particularly in cloud-native environments. By leveraging advanced programming language techniques, KCL promotes improved modularity, scalability, and stability in configuration management. It simplifies logic writing, offers easy-to-use automation APIs, and seamlessly integrates with existing systems.

This section will update the KCL language community's latest news, including features, website updates, and the latest community news, helping everyone better understand the KCL community!

KCL Website: https://kcl-lang.io

Special Thanks

Special thanks to all community contributors over the past two weeks. The following list is in no particular order:

  • Thanks to @shruti2522 for contributions to the KCL IDE string union type variable completion and function symbol highlighting 🙌
  • Thanks to @ihor-hrytskiv for contributions to the jsonpatch module 🙌
  • Thanks to @selfuryon for contributions to the KCL Nix Package 🙌
  • Thanks to @nestoralonso for contributions to the ArgoCD KCL plugin 🙌
  • Thanks to @Vishalk91-4 for contributions to the KCL tree-sitter-grammar 🙌
  • Thanks to @Daksh-10 for contributions to the KCL tree-sitter-grammar 🙌
  • Thanks to @officialasishkumar for contributions to the kcl.mod file serialization/deserialization API 🙌
  • Thanks to @d4v1d03 for contributions to the KCL FAQ documentation 🙌
  • Thanks to @liangyuanpeng, @atelsier, @mproffitt, @steeling, @eshepelyuk, @SjuulJanssen, @riven-blade, @excalq, @Wck-iipi, @Yvan da Silva, @Hai Wu, and others for their invaluable suggestions and feedback during the recent period of using KCL 🙌

Overview

Thanks to all contributors for their outstanding work over the past two weeks (2024.05.30 - 2024.06.12). Here is an overview of the key content:

📦️ Modules Updates

The jsonpatch library released version 0.0.4, fixing unexpected errors in the set_obj function. You can add the latest jsonpatch dependency using kcl mod add jsonpatch. Usage example:

import jsonpatch as p

test_json_patch = lambda {
data = {
"firstName": "John",
"lastName": "Doe",
"age": 30,
"address": {
"streetAddress": "1234 Main St",
"city": "New York",
"state": "NY",
"postalCode": "10001"
},
"phoneNumbers": [
{
"type": "home",
"number": "212-555-1234"
},
{
"type": "work",
"number": "646-555-5678"
}
]
}
phoneNumbers0type: str = p.get_obj(data, "phoneNumbers/0/type")
addressCity: str = p.get_obj(data, "address/city")
newType = p.set_obj(data, "phoneNumbers/0/type", "school")
newState = p.set_obj(data, "address/state", "WA")
assert phoneNumbers0type == "home"
assert addressCity == "New York"
assert newType["phoneNumbers"][0]["type"] == "school"
assert newState["address"]["state"] == "WA"
}

test_json_patch()

🏄 Language Updates

  • Fixed an error with the schema insertion operator += during configuration merging.
  • Improved error messages for undefined variables in multi-line string interpolation.

💻 IDE Updates

  • Added highlighting support for kcl.mod and kcl.mod.lock files.
  • Added support for restarting the kcl-language-server via VS Code Command.
  • Improved messaging when the kcl-language-server is not found.
  • Added member completion for string union types.
  • Added function symbol highlighting to differentiate between normal variables and function variables.

📬️ Toolchain Updates

  • kcl import tool now supports conversion from toml to KCL configuration.
  • kcl import tool now supports YAML Stream format input and conversion to KCL configuration.
  • kcl run now supports toml format output.
  • kcl run and kcl mod commands now support the -q flag to disable extra message output.
  • kcl mod add command improves the downloading process to prevent errors caused by unexpected interruptions.
  • kcl mod add command supports adding dependencies from various OCI and Git sources.

⛵️ API Updates

  • Added support for prototext format and KCL schema output to KCL configuration.
  • Added support for serializing arbitrary Go types to KCL configuration.
  • ListVariables API now supports multiple file input and configuration merge output.

🔥 SDK Updates

Resources

❤️ See here to join us!

For more resources, please refer to

· 6 min read

KCL is an open-source configuration and policy language hosted by the Cloud Native Computing Foundation (CNCF) as a Sandbox Project. Built on a foundation of constraints and functional programming principles, KCL enhances the process of writing complex configurations, particularly in cloud-native environments. By leveraging advanced programming language techniques, KCL promotes improved modularity, scalability, and stability in configuration management. It simplifies logic writing, offers easy-to-use automation APIs, and seamlessly integrates with existing systems.

This section will update the KCL language community's latest news, including features, website updates, and the latest community news, helping everyone better understand the KCL community!

KCL Website: https://kcl-lang.io

Special Thanks

Special thanks to all community contributors over the past two weeks. The following list is in no particular order:

  • Congratulations to @AkashKumar7902 for completing the LFX 1 task, successfully merging the mvp version of the kpm version management module into the main branch 🙌
  • Thanks to @shashank-iitbhu for his continued contributions to the IDE Quick Fix feature 🙌
  • Thanks to @Wck-iipi for his continued contributions to the IDE hover feature 🙌
  • Thanks to @warjiang for his contributions to the devcontainer 🙌
  • Thanks to @shruti2522 for her continued contributions to the IDE hover feature 🙌
  • Thanks to @XiaoK29 for his continued contributions to the KCL go SDK code optimization 🙌
  • Thanks to @d4v1d03 for his continued contributions to the KCL documentation 🙌
  • Thanks to @officialasishkumar for his contributions to the package management tool third-party dependency renaming feature 🙌
  • Thanks to @Vishalk91-4, @Daksh-10 for their contributions to the KCL tree sitter syntax and parser generator 🙌
  • Thanks to @SamirMarin for his contributions to the Crossplane KCL function 🙌
  • Thanks to @officialasishkumar, @d4v1d03, @karlhepler, @Hai Wu, @ron18219, @olinux, @Alexander Fuchs, @Emmanuel Alap, @excalq, @leon-andria, @taylormonacelli, @dennybaa, @zhuxw, @aleeriz, @steeling, @Stéphane Este-Gracias and others for their valuable feedback and suggestions while using KCL recently 🙌

Overview

Thanks to all contributors for their outstanding work over the past two weeks (2024.05.15 - 2024.05.29). Here is an overview of the key content:

📦️ Modules Updates

  • New module difflib added to support configuration comparison.

Add difflib as a dependency by kcl mod add difflib.

Through the diff method provided by the difflib, the configuration difference is output.

import difflib
import yaml

data1 = {
"Name": "John",
"age": 30,
}
data2 = {
"Name": "John",
"age": 20,
}
diff = difflib.diff(yaml.encode(data1), yaml.encode(data2))

The expected output is the diff as below:

data1:
Name: John
age: 30
data2:
Name: John
age: 20
diff: |2
Name: John
+ age: 20
- age: 30

🏄 Language Updates

  • KCL 0.9.0-beta.1 released.
  • Enhanced the check process for non-empty attributes in the schema, optimized the diagnostic information when the check statement is invalid due to empty attributes.
  • Fixed the issue of doc parse parsing string literals as doc.
  • Fixed the issue of the resolver node type missing during the compilation process.
  • Added syntax error types to support quick recovery of IDE syntax errors.
  • Fixed the memory leak issue in the KCL runtime.

💻 IDE Updates

  • Added support for quick fix of some compilation errors in the IDE.
  • Added support for some syntax IDE hover highlights.

IDE hover highlights for some syntax.

hoverstrlit

  • Added vscode extension to the devcontainer configuration.
  • Added config expression hover tips corresponding to the schema fields in the IDE.
  • Added support for identifying compilation units through the kcl.mod file in the IDE.
  • Fixed the document hover format error in the IDE.
  • Fixed the compilation error caused by the LSP panic in the IDE.
  • Optimized the log content of LSP input.

📬️ Toolchain Updates

  • KCL testing tool supports fast eval mode.
  • Added kcl clean to support cleaning module caches.
  • Fixed the unexpected error in the YAML Stream format import process of the KCL import tool.

Package management tool updates.

  • Added support for renaming dependencies to prevent name conflicts through the mod add --rename parameter and the kcl.mod file.
  • Fixed the issue of missing dependencies in the kcl.mod file when adding a local file directory as a dependency.
  • Added support for adding git third-party dependencies through branch names.
  • Removed the invalid log output when updating dependencies.
  • Added API support for writing kcl.mod and kcl.mod.lock files.
  • Removed the process of requesting metadata when loading third-party dependencies.
  • When packaging and uploading KCL, diagnostic information is output for the case of local dependencies in the KCL package.
  • LFX term 1 task completed, the version management module mvp version merged into the main branch.
  • Supported specifying files to be packaged and skipped through the include and exclude fields in the kcl.mod file.
  • Removed the calculation checksum process of dependencies.

⛵️ API Updates

  • Added UpdateDependencies API to support updating KCL third-party libraries.
  • Added API support for writing kcl.mod and kcl.mod.lock files.
  • OverrideFile API returns compilation error information.
  • OverrideFile API supports inserting configurations through operators ":" and "+=".
  • ListVariable API return values support parsing List and Dict structures.
  • Fixed the issue of configuration format error caused by the insertion of import statements in the OverrideFile API.
  • Refactored the API for obtaining schema types.
  • Fixed the issue of panic caused by the LSP handle_semantic_tokens_full and handle_document_symbol methods.

🔥 SDK Updates

  • KCL SDK v0.9.0-beta.1 released, synchronously supporting API updates.
  • KCL Go SDK supports importing KCL Schema through the protobuf file.

📂️ Documentation Updates

  • Fixed typos in the development guide documentation and some environment configuration descriptions.
  • Added documentation for the file.read_env function.
  • The language document has been updated to include information about the "-" and "." symbols in schema property names.

📺️ Ecosystem Integration

  • Crossplane kcl function has released version 0.9.0, which fixes memory leaks and arm64 image errors. It also supports setting external package dependencies and compilation parameters at the function level.
  • Added support for the KCL tree sitter schema, mixin, rule, and other syntax support and corresponding tests.

Resources

❤️ See here to join us!

For more resources, please refer to