Skip to main content

· 7 min read

Introduction​

The KCL team is pleased to announce that KCL v0.13.0 is now available! This release has brought three key updates to everyone

  • A more expressive and consistent KCL language: ES6-style config entry shorthand, more flexible lambda expressions, friendlier multi-line strings and equality semantics.
  • A more complete standard library and cross-language API: new reduce, json.merge, file.readbase64 and net.is_IPv6 functions, RFC 7396 JSON Merge Patch support, Source Map v3 output, and line-level test coverage.
  • A faster and more reliable toolchain and IDE: significant compilation and evaluation performance improvements, package-wide linting, dry-run formatting, and richer LSP features.

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.

❤️ Special Thanks​

We would like to extend our heartfelt thanks to all community contributors who participated in the iteration from version v0.12 to v0.13. The following list is in no particular order.

@Peefy, @zong-zhe, @liangyuanpeng, @johngmyers, @priyansh-saxena1, @jfharden, @aliazlan4, @vlada-dudr, @turner-hemmer, @Arpit529Srivastava, @DCchoudhury15, @jschoone, @ytsarev, @f4z3r, @rtainaan, @31puneet, @Viscous106, @56steve, @neo0007777

📚 Key Updates​

🔧 Core Features​

Language​

  • KCL supports ES6-style shorthand entries in config and schema instance literals. A bare identifier is equivalent to a key = key entry and can be mixed with ordinary entries, e.g., { name, age = 18 } is equivalent to { name = name, age = 18 }.
  • Lambda expressions support braces around the argument list, which allows arguments to be written on multiple lines. When braces are used, a return type must be provided.
func = lambda {
x: int,
y: int = 5
} -> int {
x + y
}
  • Multi-line (triple-quoted) strings are automatically dedented: the common leading whitespace of all non-empty lines is stripped, so embedded text can be indented naturally with the surrounding code.
s = """
foo
bar
""" # "foo\nbar\n"
  • The != operator now supports lists, dicts and schemas in addition to primitive types, e.g. {} != {k = "v"} and [0] != [1].
  • Quantifier expressions (all/any/filter/map) support selector expressions as the iteration target, including safe navigation selectors, so nested collections can be iterated directly, e.g. all y in data?.items { y > 0 }.
  • The YAML output can opt into multi-line block-scalar strings via the new multiline_string encode option, and YAML block-scalar trailing newlines are preserved.
  • Fixed math.floor to return an integer instead of a float.
  • Fixed string formatting to apply width, alignment and fill specifiers to string values, e.g. "{:*^10}".format("hi") yields "****hi****".
  • Fixed a series of evaluator issues around lazy scope caching, schema attribute overrides, mixin replay, forward references and config entries shadowing enclosing schema attributes, making evaluation results more stable and predictable.

Toolchain​

  • kcl lint ./...: the lint command now supports the ./... pattern to lint all KCL packages under the current or a given directory, one package per directory, like go build ./....
  • kcl fmt --dry-run: report the files that require formatting without modifying them, which is convenient for CI checks. The formatter also honors .editorconfig indentation settings, keeps inline trailing comments on the same line, and leaves the source unchanged when parsing fails.
  • kcl test provides line-level coverage: the test API collects per-file line coverage information for test runs.
  • Bundle a KCL program into a single file for easy distribution and execution.
  • Performance: this release includes a large set of performance improvements — a faster hash map for compiler indexes, small-string optimization for config keys, monotonic AST indices instead of UUIDs, cached path canonicalization and package resolution during loading, memoized fully-qualified-name lookups with incremental updates, and skipping unused package compilation passes. Compilation and evaluation are observably faster on medium and large projects.
  • Release artifacts now cover more platforms, including Linux glibc 2.17 and musl (Alpine Linux) builds.

IDE​

  • The KCL language server can run unit tests by clicking a CodeLens above each test function.
  • The language server can auto-update dependencies through the kcl mod toolchain and reacts to kcl.mod/kcl.yaml modification events.
  • The language server walks up the directory tree to find the kcl.mod/kcl.yaml/kcl.work workspace root, respects .gitignore in the workspace file watcher, and speeds up import completion.
  • Fixed inherited attribute lookup on schema resolution, wrong import completions, and missing schema type recovery in the language server.

API​

  • Source Map v3 output: kcl run --sourcemap <file> writes a Source Map v3 document alongside the generated YAML, so downstream tooling can resolve generated lines back to the originating .k file, line and column.
  • Schema type API extensions: the KclType schema type now carries index signature and function type information, and a __kcl_info_meta__ marker is emitted for attributes decorated with @info(type="attr").
  • New GetSchemaTypeMappingUnderPath RPC: returns schema type mappings keyed by package name. Different from GetSchemaTypeMapping, schemas imported from external dependency packages are keyed under their own package name instead of being flattened into __main__.
  • The C API honors the error_format option on the error envelope, supporting machine-readable diagnostic output formats (pretty, short, arcanist, sarif).
  • ExecProgramArgs supports running with only k_code_list, and unrequested format encoders are skipped when --format is set.

📦️ Standard Libraries and Third-Party Libraries​

Standard Libraries​

  • New builtin function reduce that applies a reducer function cumulatively to the items of a list.
reduce(lambda acc: int, item: int -> int { acc * item }, [2, 3, 4])  # 24
  • New json module function merge implementing RFC 7396 JSON Merge Patch. A None/Undefined value in the patch removes the key, dicts are merged recursively, and other values replace the original value.
import json

result = json.merge({a = 1, b = {c = 2}}, {b = {c = None, d = 3}})
# {"a": 1, "b": {"d": 3}}
  • New file module function readbase64 that reads a file as raw bytes and returns the contents encoded as a base64 string, which is binary-safe for images and other non-UTF-8 files.
  • New net module function is_IPv6, and to_IP16 was renamed to to_IP6 with correct IPv4-mapped IPv6 conversion.
  • datetime.now accepts an optional ticks argument to format an arbitrary epoch (seconds since the Unix epoch) instead of the current time, and datetime date validation is enhanced.
  • Fixed net.to_IP4/to_IP6 parsing issues and clarified the UUID version in the crypto module documentation.

Third-Party Libraries​

  • The k8s package received patch version updates across 1.14 - 1.31 and fixed apimachinery import aliases.
  • external-secrets was upgraded to 2.9.0.
  • Crossplane providers were updated, including crossplane_provider_keycloak v2.24.1, crossplane-provider-kubernetes v1.2.1, crossplane-provider-openstack v0.10.0 and crossplane-provider-http v1.0.14 with cluster/namespaced structures.
  • git-promoter was updated to 0.36.0.

☸️ Ecosystem Integration​

📖 Documentation Updates​

  • The language specification documents the config entry shorthand, the lambda argument braces, the multi-line string dedenting, the != semantics on lists, dicts and schemas, and the selector expression quantifier targets.
  • The system package reference documents the new reduce, json.merge, file.readbase64, net.is_IPv6, net.to_IP6 and datetime.now(ticks) functions.
  • The multi-language API reference is synchronized with the v0.13.0 protobuf service definition, including GetSchemaTypeMappingUnderPath and the test coverage messages, and the Go API reference is regenerated.
  • The CLI reference documents the new --dry-run flag of kcl fmt, the ./... pattern of kcl lint, and the refreshed flags and examples of kcl run and kcl vet.

🌐 Other Resources​

🔥 Check out the KCL Community and join us 🔥

For more resources, refer to:

· 5 min read

Introduction​

The KCL team is pleased to announce that KCL v0.11.0 is now available! This release has brought two key updates to everyone

  • Enhance the coding experience and efficiency with a more performant, feature-rich, and less error-prone KCL language, toolchain, and IDE.
  • A more comprehensive and diverse set of standard libraries, third-party libraries, and community ecosystem integrations, covering different application scenarios and requirements.

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.

❤️ Special Thanks​

We would like to extend our heartfelt thanks to all community contributors who participated in the iteration from version v0.10 to v0.11. The following list is in no particular order.

@adamwg, @steeling, @dennybaa, @liangyuanpeng, @NishantBansal2003, @mayrf, @eminaktas, @Gmin2, @tvandinther, @diefans, @nkabir, @suin, @Chewie, @lwz23, @eminaktas,@steeling, @bozaro, @cakemanny, @Yufeireal, @andrzejgorski, @yonas, @dansrogers, @SkySingh04, @jellllly420, @slashexx, @xnull, @diefans, @zflat, @vfarcic, @spastorclovr, @patpicos, @mproffitt, @fraenkel, @irizzant, @vfarcic, @patpicos, @mproffitt, @fraenkel, @Clint, @Christopher Haar, @ron18219, @Zack Zhang, @Alexander Fuchs, @Smaine Kahlouch, @Yvan da Silva, @Jakob Maležič, @Ryan Rueth, @Christopher Haar, @kesser, @Justin B, @Evgeny Shepelyuk, @Smaine Kahlouch, @KennyZ, @Mark Altmann (Wompi), @Peter Boat, @Hai Wu, @Evgeny Shepelyuk, @anshuman singh, @Carl-Fredrik, @Larry Gadallah, @Kevin Sztern, @Nick Atzert, @Tobias Kässer, @Mike, @john thompson, @Sky Singh, @suin, @Tom van Dinther, @Stefano Borrelli, @Valer Orlovsky, @Jacob Colvin, @Sjuul Janssen, @Vyacheslav Terdunov, @Yury Tsarev

📚 Key Updates​

🔧 Core Features​

Language​

  • KCL supports Alpine Linux(musl) platform.
  • KCL refactored the implementation of the Parser and reorganized the parse process of import dependencies.
  • KCL optimized the type parsing of ** expressions in schema attributes.
  • KCL fixed the problem that lambda expressions do not work when nested calls.
  • KCL fixed the memory leak problem of schema mixin parse.
  • KCL fixed the type promotion in function call expressions in assignment statements with type declarations.
  • KCL fixed the error of lambda functions calling attr in mixin

Toolchain​

  • Package management tool version selection algorithm is released. In v0.11.0, the KCL package management tool supports the selection of different version numbers of the same tripartite library that appears in the dependency graph. The KCL package management tool refers to the mvs algorithm of go mod.

To ensure as much compatibility as possible, package management tools currently prefer to select the latest version that appears in the dependency diagram rather than the latest version that has already been released.

In version v0.11.0, version selection is turned off by default. You can control whether version selection is turned on by setting the environment variable export KPM_FEATURE_GATES='SupportMVS=true'.

  • Package management tool added a new local tripartite library cache. In v0.11.0, KCL package management tool implemented a new local tripartite library cache, and the new storage cache structure improved the performance of downloading git repositories by 88% on average.

In v0.11.0, the new cache structure is turned off by default, and the new local tripartite library cache is controlled by setting the environment variable export KPM_FEATURE_GATES=' SupportNewStorage=true'.

  • Fix kcl fmt formatting error for code comments.
  • Fix kcl fmt error in handling line continuation and comment combinations.

IDE​

  • KCL IntelliJ plugin released 0.4.0, supporting LSP4IJ.
  • IDE can complete schemas defined in the worksace but not imported , and automatically insert the import statements of the package. complete
  • IDE adds type hints for key in the Config block. hint
  • IDE hover provides schema attribute default value information. hover
  • IDE fixed the failure of Windows path issues.
  • IDE fixed the failure of compound assignment operation statements.
  • IDE distinguished the highlighting of the any from keyword and type.
  • IDE fixed the failure of formatting code in the IntelliJ plugin.
  • Optimized the parser part of the IDE compilation process.
  • IDE fixed inconsistent hints for function parameters.
  • Optimized hint information and added the feature of double-clicking to insert hints into the code.

API​

  • Added kcl_run_with_log_message API
  • Added kcl_exec_program capi
  • Added kcl_version api for wasm

📦️ Standard Libraries and Third-Party Libraries​

Standard Libraries​

  • KCL new standard libraries filesha512 and fileblake3。
import crypto

sha_filesha512 = crypto.filesha512("test.txt")
sha_fileblake3 = crypto.fileblake3("test.txt")
  • Fixes an issue that ignore_private=False parameter does not take effect in manifests.yaml_stream.

Third-Party Libraries​

  • k8s updated to 1.31.2
  • Fixed the import alias problem in the k8s package.
  • helloworld updated to 0.1.4
  • gateway updated to 0.3.2
  • kubevirt updated to 0.3.0
  • cert-manager updated to 0.3.0
  • Added edp-keycloak-operator
  • Added sealed-secrets
  • Added DeploymentStrategy model in konfig

☸️ Ecosystem Integration​

Multi-Language Plugins​

  • KCL Plugin supports development through Rust.
  • Add more test cases for the KCL Plugin.

📖 Documentation Updates​

  • Fixed errors in sample code for argocd kcl plugin configuration
  • Added FAQ document about plugin.
  • Added more sample documents about system packages.
  • Added FAQ document about json_merge_patch.
  • Added FAQ document about isnullish function.
  • Added sample code about oam app inheritance.
  • Fixed Windows installation script.
  • Fixed some typos and broken links in the document.
  • Updated the documentation of KCL IntelliJ plugin.

🌐 Other Resources​

🔥 Check out the KCL Community and join us 🔥

For more resources, refer to: