kcl-lib 0.8.5__tar.gz → 0.8.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of kcl-lib might be problematic. Click here for more details.

Files changed (88) hide show
  1. kcl_lib-0.8.7/.github/workflows/java-test.yaml +226 -0
  2. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/.github/workflows/nodejs-test.yaml +8 -20
  3. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/.github/workflows/python-test.yaml +5 -0
  4. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/.github/workflows/rust-test.yaml +1 -1
  5. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/Cargo.toml +2 -2
  6. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/PKG-INFO +18 -1
  7. kcl_lib-0.8.7/README.md +142 -0
  8. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/install.go +1 -1
  9. kcl_lib-0.8.7/kcl_lib/api/spec_pb2.py +206 -0
  10. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/darwin-amd64/libkclvm_cli_cdylib.dylib +0 -0
  11. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/darwin-arm64/libkclvm_cli_cdylib.dylib +0 -0
  12. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/windows-amd64/kclvm_cli_cdylib.dll +0 -0
  13. kcl_lib-0.8.7/lib/windows-amd64/kclvm_cli_cdylib.lib +0 -0
  14. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/windows-arm64/kclvm_cli_cdylib.dll +0 -0
  15. kcl_lib-0.8.7/lib/windows-arm64/kclvm_cli_cdylib.lib +0 -0
  16. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/Cargo.lock +201 -182
  17. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/Cargo.toml +1 -1
  18. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/README.md +17 -0
  19. kcl_lib-0.8.7/python/kcl_lib/api/spec_pb2.py +206 -0
  20. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/spec/gpyrpc/spec.proto +3 -0
  21. kcl_lib-0.8.5/.github/workflows/java-test.yaml +0 -97
  22. kcl_lib-0.8.5/README.md +0 -87
  23. kcl_lib-0.8.5/kcl_lib/api/spec_pb2.py +0 -215
  24. kcl_lib-0.8.5/lib/windows-amd64/kclvm_cli_cdylib.lib +0 -0
  25. kcl_lib-0.8.5/lib/windows-arm64/kclvm_cli_cdylib.lib +0 -0
  26. kcl_lib-0.8.5/python/kcl_lib/api/spec_pb2.py +0 -215
  27. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/.github/workflows/cla.yml +0 -0
  28. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/.github/workflows/go-test.yaml +0 -0
  29. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/.gitignore +0 -0
  30. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/go.mod +0 -0
  31. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/install_lib_unix.go +0 -0
  32. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/install_lib_windows.go +0 -0
  33. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kcl_lib/__init__.py +0 -0
  34. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kcl_lib/api/__init__.py +0 -0
  35. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kcl_lib/api/service.py +0 -0
  36. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kclvm_cli_shared_lib_darwin_amd64.go +0 -0
  37. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kclvm_cli_shared_lib_darwin_arm64.go +0 -0
  38. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kclvm_cli_shared_lib_linux_amd64.go +0 -0
  39. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kclvm_cli_shared_lib_linux_arm64.go +0 -0
  40. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kclvm_cli_shared_lib_windows_amd64.go +0 -0
  41. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/kclvm_cli_shared_lib_windows_arm64.go +0 -0
  42. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/darwin-amd64/dummy.go +0 -0
  43. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/darwin-amd64/kclvm_cli +0 -0
  44. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/darwin-arm64/dummy.go +0 -0
  45. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/darwin-arm64/kclvm_cli +0 -0
  46. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/dummy.go +0 -0
  47. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/linux-amd64/dummy.go +0 -0
  48. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/linux-amd64/kclvm_cli +0 -0
  49. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/linux-arm64/dummy.go +0 -0
  50. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/linux-arm64/kclvm_cli +0 -0
  51. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/windows-amd64/dummy.go +0 -0
  52. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/windows-amd64/kclvm_cli.exe +0 -0
  53. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/windows-arm64/dummy.go +0 -0
  54. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/lib/windows-arm64/kclvm_cli.exe +0 -0
  55. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/pyproject.toml +0 -0
  56. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/.gitignore +0 -0
  57. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/Makefile +0 -0
  58. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/kcl_lib/__init__.py +0 -0
  59. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/kcl_lib/api/__init__.py +0 -0
  60. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/kcl_lib/api/service.py +0 -0
  61. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/src/lib.rs +0 -0
  62. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/tests/exec_test.py +0 -0
  63. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/python/tests/test_data/schema.k +0 -0
  64. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/spec/gpyrpc/Makefile +0 -0
  65. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/src/README.md +0 -0
  66. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/src/lib.rs +0 -0
  67. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/compile_recursive/kcl1/main.k +0 -0
  68. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/compile_recursive/kcl2/main.k +0 -0
  69. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/compile_recursive/main.k +0 -0
  70. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/get_schema_ty/aaa/kcl.mod +0 -0
  71. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/get_schema_ty/aaa/main.k +0 -0
  72. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/get_schema_ty/bbb/kcl.mod +0 -0
  73. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/get_schema_ty/bbb/main.k +0 -0
  74. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/get_schema_ty/ccc/kcl.mod +0 -0
  75. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/get_schema_ty/ccc/main.k +0 -0
  76. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/hello.k +0 -0
  77. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/hello_import.k +0 -0
  78. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/hello_with_print.k +0 -0
  79. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/rename/main.bak +0 -0
  80. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/rename_doc/main.bak +0 -0
  81. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/settings/kcl.yaml +0 -0
  82. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/test-lint-import.k +0 -0
  83. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/test-lint.k +0 -0
  84. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/test.k +0 -0
  85. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/testing/module/kcl.mod +0 -0
  86. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/testing/module/pkg/func.k +0 -0
  87. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/testdata/testing/module/pkg/func_test.k +0 -0
  88. {kcl_lib-0.8.5 → kcl_lib-0.8.7}/util.go +0 -0
@@ -0,0 +1,226 @@
1
+ name: java-test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ tags:
9
+ - '*'
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ paths:
14
+ - "java/**"
15
+ workflow_dispatch:
16
+
17
+ jobs:
18
+ test:
19
+ permissions:
20
+ actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
21
+ contents: read # for actions/checkout to fetch code
22
+ name: "${{ matrix.root-pom }} on JDK ${{ matrix.java }} for the classifier ${{ matrix.classifier }}"
23
+ strategy:
24
+ matrix:
25
+ include:
26
+ - os: ubuntu-latest
27
+ classifier: linux-aarch_64
28
+ java: 8
29
+ root-pom: 'pom.xml'
30
+ - os: windows-latest
31
+ classifier: windows-x86_64
32
+ java: 8
33
+ root-pom: 'pom.xml'
34
+ - os: macos-latest
35
+ classifier: osx-x86_64
36
+ java: 8
37
+ root-pom: 'pom.xml'
38
+ - os: macos-latest
39
+ classifier: osx-aarch_64
40
+ java: 8
41
+ root-pom: 'pom.xml'
42
+ runs-on: ${{ matrix.os }}
43
+ env:
44
+ ROOT_POM: ${{ matrix.root-pom }}
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+
48
+ - name: 'Set up JDK ${{ matrix.java }}'
49
+ uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
50
+ with:
51
+ java-version: ${{ matrix.java }}
52
+ distribution: 'zulu'
53
+ cache: 'maven'
54
+
55
+ - uses: actions/setup-python@v5
56
+ with:
57
+ python-version: '3.10'
58
+
59
+ - name: Install rust nightly toolchain
60
+ uses: actions-rs/toolchain@v1
61
+ with:
62
+ toolchain: 1.77
63
+ override: true
64
+ components: clippy, rustfmt
65
+
66
+ - name: Setup linux-aarch_64 rust target
67
+ if: "contains(matrix.classifier, 'linux-aarch_64')"
68
+ run: |
69
+ sudo apt-get update
70
+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
71
+ # Setup for cargo
72
+ echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
73
+
74
+ - name: 'Test'
75
+ shell: bash
76
+ working-directory: java
77
+ run: make test
78
+
79
+ - name: 'Build and Deploy'
80
+ shell: bash
81
+ working-directory: java
82
+ run: mvn clean package -DskipTests=true -Djni.classifier=${{ matrix.classifier }} -Dcargo-build.profile=release
83
+
84
+ - name: 'Upload artifact'
85
+ uses: actions/upload-artifact@v3
86
+ with:
87
+ name: kcl-lib-${{ matrix.classifier }}
88
+ path: |
89
+ java/target/classes/native
90
+
91
+ build-on-centos:
92
+ name: Build on CentOS 7
93
+ runs-on: ubuntu-latest
94
+ container:
95
+ image: "centos:7"
96
+
97
+ steps:
98
+ - name: Checkout
99
+ uses: actions/checkout@v3
100
+
101
+ - name: Prepare build environment
102
+ run: |
103
+ yum makecache
104
+ yum install -y wget
105
+ yum install -y make
106
+ yum install -y epel-release
107
+ yum install -y llvm clang llvm-devel
108
+ yum install gcc gcc-c++ glibc-static -y
109
+ cat /etc/os-release
110
+
111
+ - name: Install Python 3
112
+ run: |
113
+ yum install -y python3 python3-devel python3-pip
114
+
115
+ - name: Install Rust
116
+ run: |
117
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
118
+ mv $HOME/.cargo/bin/* /usr/bin/
119
+ rustc --version
120
+ cargo --version
121
+
122
+ - name: Install Java and Maven
123
+ run: |
124
+ yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel
125
+ wget https://repo.huaweicloud.com/apache/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz
126
+ tar -xzf apache-maven-*.tar.gz
127
+ mkdir p /opt/maven
128
+ mv apache-maven-* /opt/maven
129
+ ln -s /opt/maven/apache-maven-3.9.6/bin/mvn /usr/bin/mvn
130
+ mvn --version
131
+
132
+ - name: Verify installed versions
133
+ run: |
134
+ gcc --version
135
+ llvm-config --version
136
+ python3 --version
137
+ rustc --version
138
+ mvn --version
139
+ cat /etc/os-release
140
+
141
+ - name: 'Test'
142
+ shell: bash
143
+ working-directory: java
144
+ run: make test
145
+
146
+ - name: 'Build and Deploy'
147
+ shell: bash
148
+ working-directory: java
149
+ run: mvn clean package -DskipTests=true -Djni.classifier=linux-x86_64 -Dcargo-build.profile=release
150
+
151
+ - name: 'Upload artifact'
152
+ uses: actions/upload-artifact@v3
153
+ with:
154
+ name: kcl-lib-linux-x86_64
155
+ path: java/target/classes/native
156
+
157
+
158
+ deploy:
159
+ runs-on: ubuntu-latest
160
+ permissions:
161
+ contents: read
162
+ packages: write
163
+ if: "startsWith(github.ref, 'refs/tags/')"
164
+ needs: [ test, build-on-centos ]
165
+ steps:
166
+ - uses: actions/checkout@v4
167
+
168
+ - name: Set up JDK 8
169
+ uses: actions/setup-java@v4
170
+ with:
171
+ distribution: 'temurin'
172
+ java-version: '8'
173
+ server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
174
+ settings-path: ${{ github.workspace }} # location for the settings.xml file
175
+
176
+ - name: Download windows x86_64 lib
177
+ uses: actions/download-artifact@v3
178
+ with:
179
+ name: kcl-lib-windows-x86_64
180
+ path: java/native
181
+
182
+ - name: Download linux x86_64 lib
183
+ uses: actions/download-artifact@v3
184
+ with:
185
+ name: kcl-lib-linux-x86_64
186
+ path: java/native
187
+
188
+ - name: Download linux aarch_64 lib
189
+ uses: actions/download-artifact@v3
190
+ with:
191
+ name: kcl-lib-linux-aarch_64
192
+ path: java/native
193
+
194
+ - name: Download darwin x86_64 lib
195
+ uses: actions/download-artifact@v3
196
+ with:
197
+ name: kcl-lib-osx-x86_64
198
+ path: java/native
199
+
200
+ - name: Download darwin aarch_64 lib
201
+ uses: actions/download-artifact@v3
202
+ with:
203
+ name: kcl-lib-osx-aarch_64
204
+ path: java/native
205
+
206
+ - name: Package Java artifact
207
+ working-directory: java
208
+ run: |
209
+ mvn clean package -DskipTests=true
210
+
211
+ - name: Upload artifact
212
+ uses: actions/upload-artifact@v3
213
+ with:
214
+ name: kcl-lib
215
+ path: java/target/*.jar
216
+
217
+ - name: Deploy to Github Packages
218
+ working-directory: java
219
+ run: |
220
+ mvn clean package deploy \
221
+ -DskipTests=true \
222
+ -Dcargo-build.profile=release \
223
+ -DserverId=github \
224
+ -s $GITHUB_WORKSPACE/settings.xml
225
+ env:
226
+ GITHUB_TOKEN: ${{ github.token }}
@@ -11,6 +11,10 @@ on:
11
11
  tags:
12
12
  - '*'
13
13
  pull_request:
14
+ branches:
15
+ - main
16
+ paths:
17
+ - "nodejs/**"
14
18
  workflow_dispatch:
15
19
 
16
20
  jobs:
@@ -62,6 +66,7 @@ jobs:
62
66
 
63
67
  linux:
64
68
  runs-on: ubuntu-latest
69
+ if: "startsWith(github.ref, 'refs/tags/')"
65
70
  strategy:
66
71
  matrix:
67
72
  settings:
@@ -90,20 +95,6 @@ jobs:
90
95
  cd nodejs
91
96
  # change owner to current user
92
97
  sudo chown -R 1001:121 *.node
93
- - target: aarch64-unknown-linux-musl
94
- build: |
95
- docker run \
96
- -v .:/build \
97
- -e NAPI_TARGET=aarch64-unknown-linux-musl \
98
- -w /build/nodejs \
99
- ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine \
100
- bash -c "set -e &&
101
- rustup target add aarch64-unknown-linux-musl &&
102
- pnpm build --target aarch64-unknown-linux-musl &&
103
- /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node"
104
- cd nodejs
105
- # change owner to current user
106
- sudo chown -R 1001:121 *.node
107
98
 
108
99
  # Notes: this defaults only apply on run tasks.
109
100
  defaults:
@@ -138,6 +129,7 @@ jobs:
138
129
 
139
130
  windows:
140
131
  runs-on: windows-latest
132
+ if: "startsWith(github.ref, 'refs/tags/')"
141
133
  strategy:
142
134
  matrix:
143
135
  settings:
@@ -180,6 +172,7 @@ jobs:
180
172
 
181
173
  macos:
182
174
  runs-on: macos-latest
175
+ if: "startsWith(github.ref, 'refs/tags/')"
183
176
  strategy:
184
177
  matrix:
185
178
  settings:
@@ -269,13 +262,8 @@ jobs:
269
262
  run: ls -R ./npm
270
263
  shell: bash
271
264
 
272
- - name: Publish Dry Run
273
- # Since this command will not exit with non-zero code when file missing,
274
- # we need to check the output manually.
275
- run: |
276
- npm publish --access public --provenance --dry-run
277
-
278
265
  - name: Publish
266
+ if: "startsWith(github.ref, 'refs/tags/')"
279
267
  run: |
280
268
  echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
281
269
  npm publish --access public --provenance
@@ -13,6 +13,10 @@ on:
13
13
  tags:
14
14
  - '*'
15
15
  pull_request:
16
+ branches:
17
+ - main
18
+ paths:
19
+ - "python/**"
16
20
  workflow_dispatch:
17
21
 
18
22
  permissions:
@@ -91,6 +95,7 @@ jobs:
91
95
  release:
92
96
  name: Release
93
97
  runs-on: ubuntu-latest
98
+ if: "startsWith(github.ref, 'refs/tags/')"
94
99
  permissions:
95
100
  contents: read
96
101
  id-token: write
@@ -25,7 +25,7 @@ jobs:
25
25
  - name: Install rust nightly toolchain
26
26
  uses: actions-rs/toolchain@v1
27
27
  with:
28
- toolchain: 1.74
28
+ toolchain: 1.77
29
29
  override: true
30
30
  components: clippy, rustfmt
31
31
  - name: Rust code test
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "kcl-lang"
3
- version = "0.8.5"
3
+ version = "0.8.7"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
  documentation = "kcl-lang.io"
@@ -11,4 +11,4 @@ license = "Apache-2.0"
11
11
 
12
12
  [dependencies]
13
13
  anyhow = "1"
14
- kclvm-api = { git = "https://github.com/kcl-lang/kcl", version = "0.8.5" }
14
+ kclvm-api = { git = "https://github.com/kcl-lang/kcl", version = "0.8.7" }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kcl_lib
3
- Version: 0.8.5
3
+ Version: 0.8.7
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -21,6 +21,23 @@ Project-URL: Repository, https://github.com/kcl-lang/kcl
21
21
 
22
22
  # KCL Artifact Library for Python
23
23
 
24
+ ## Installation
25
+
26
+ ```shell
27
+ python3 -m pip install kcl-lib
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ```python
33
+ import kcl_lib.api as api
34
+
35
+ args = api.ExecProgram_Args(k_filename_list=["./tests/test_data/schema.k"])
36
+ api = api.API()
37
+ result = api.exec_program(args)
38
+ print(result.yaml_result)
39
+ ```
40
+
24
41
  ## Developing
25
42
 
26
43
  Setup virtualenv:
@@ -0,0 +1,142 @@
1
+ # KCL Artifact Library for SDKs
2
+
3
+ This repo mainly includes the binding of the low-level API and spec of the [KCL language core](https://github.com/kcl-lang/kcl), and the SDKs of various languages are based on this to encapsulate higher-level APIs.
4
+
5
+ ## Bindings
6
+
7
+ ### Rust
8
+
9
+ ```shell
10
+ cargo add --git https://github.com/kcl-lang/lib
11
+ ```
12
+
13
+ Write the Code
14
+
15
+ ```rust
16
+ use kcl_lang::*;
17
+ use anyhow::Result;
18
+
19
+ fn main() -> Result<()> {
20
+ let api = API::default();
21
+ let args = &ExecProgramArgs {
22
+ k_filename_list: vec!["main.k".to_string()],
23
+ k_code_list: vec!["a = 1".to_string()],
24
+ ..Default::default()
25
+ };
26
+ let exec_result = api.exec_program(args)?;
27
+ println!("{}", exec_result.yaml_result);
28
+ Ok(())
29
+ }
30
+ ```
31
+
32
+ ### Go
33
+
34
+ ```shell
35
+ go get kcl-lang.io/lib
36
+ ```
37
+
38
+ Write the Code
39
+
40
+ ```go
41
+ package main
42
+
43
+ import (
44
+ "kcl-lang.io/lib"
45
+ )
46
+
47
+ func main() {
48
+ path = "path/to/install/lib"
49
+ _ := lib.InstallKclvm(path)
50
+ }
51
+ ```
52
+
53
+ ### Java
54
+
55
+ Refer to [this](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages) to configure your Maven; set up your GitHub account and Token in the `settings.xml`.
56
+
57
+ #### Maven
58
+
59
+ In your project's pom.xml, configure our repository as follows:
60
+
61
+ ```xml
62
+ <repositories>
63
+ <repository>
64
+ <id>github</id>
65
+ <url>https://maven.pkg.github.com/kcl-lang/*</url>
66
+ <snapshots>
67
+ <enabled>true</enabled>
68
+ </snapshots>
69
+ </repository>
70
+ </repositories>
71
+ ```
72
+
73
+ This way you'll be able to import the above dependency to use the SDK.
74
+
75
+ ```xml
76
+ <dependency>
77
+ <groupId>com.kcl</groupId>
78
+ <artifactId>kcl-lib</artifactId>
79
+ <version>0.8.7</version>
80
+ </dependency>
81
+ ```
82
+
83
+ Write the code
84
+
85
+ ```java
86
+ import com.kcl.api.API;
87
+ import com.kcl.api.Spec.ExecProgram_Args;
88
+ import com.kcl.api.Spec.ExecProgram_Result;
89
+
90
+ public class ExecProgramTest {
91
+ public static void main(String[] args) throws Exception {
92
+ API api = new API();
93
+ ExecProgram_Result result = api
94
+ .execProgram(ExecProgram_Args.newBuilder().addKFilenameList("path/to/kcl.k").build());
95
+ System.out.println(result.getYamlResult());
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### Python
101
+
102
+ ```shell
103
+ python3 -m pip install kcl-lib
104
+ ```
105
+
106
+ Write the code
107
+
108
+ ```python
109
+ import kcl_lib.api as api
110
+
111
+ args = api.ExecProgram_Args(k_filename_list=["./tests/test_data/schema.k"])
112
+ api = api.API()
113
+ result = api.exec_program(args)
114
+ print(result.yaml_result)
115
+ ```
116
+
117
+ ### Node.js
118
+
119
+ ```shell
120
+ npm install kcl-lib
121
+ ```
122
+
123
+ Write the code
124
+
125
+ ```ts
126
+ import { execProgram, ExecProgramArgs } from 'kcl-lib'
127
+
128
+ function main() {
129
+ const result = execProgram(new ExecProgramArgs(['__test__/test_data/schema.k']))
130
+ console.log(result.yamlResult)
131
+ }
132
+
133
+ main();
134
+ ```
135
+
136
+ ## Documents
137
+
138
+ See [here](https://www.kcl-lang.io/docs/reference/xlang-api/overview)
139
+
140
+ ## License
141
+
142
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Flib.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Flib?ref=badge_large)
@@ -8,7 +8,7 @@ import (
8
8
  "runtime"
9
9
  )
10
10
 
11
- const KCLVM_VERSION = "v0.8.5"
11
+ const KCLVM_VERSION = "v0.8.7"
12
12
 
13
13
  func findPath(name string) string {
14
14
  if path, err := exec.LookPath(name); err == nil {