Skip to content

Commit 54ec98e

Browse files
committed
docs: update python and java docs
Signed-off-by: peefy <[email protected]>
1 parent 84cbc5b commit 54ec98e

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

java/README.md

+47
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# KCL Artifact Library for Java
22

3+
## Installation
4+
5+
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`.
6+
7+
### Maven
8+
9+
In your project's pom.xml, configure our repository as follows:
10+
11+
```xml
12+
<repositories>
13+
<repository>
14+
<id>github</id>
15+
<url>https://maven.pkg.github.com/kcl-lang/*</url>
16+
<snapshots>
17+
<enabled>true</enabled>
18+
</snapshots>
19+
</repository>
20+
</repositories>
21+
```
22+
23+
This way you'll be able to import the above dependency to use the SDK.
24+
25+
```xml
26+
<dependency>
27+
<groupId>com.kcl</groupId>
28+
<artifactId>kcl-lib</artifactId>
29+
<version>0.8.6</version>
30+
</dependency>
31+
```
32+
33+
Write the code
34+
35+
```java
36+
import com.kcl.api.API;
37+
import com.kcl.api.Spec.ExecProgram_Args;
38+
import com.kcl.api.Spec.ExecProgram_Result;
39+
40+
public class ExecProgramTest {
41+
public static void main(String[] args) throws Exception {
42+
API api = new API();
43+
ExecProgram_Result result = api
44+
.execProgram(ExecProgram_Args.newBuilder().addKFilenameList("path/to/kcl.k").build());
45+
System.out.println(result.getYamlResult());
46+
}
47+
}
48+
```
49+
350
## Developing
451

552
- Install `Java 8+`

python/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# KCL Artifact Library for Python
22

3+
## Installation
4+
5+
```shell
6+
python3 -m pip install kcl-lib
7+
```
8+
9+
## Quick Start
10+
11+
```python
12+
import kcl_lib.api as api
13+
14+
args = api.ExecProgram_Args(k_filename_list=["./tests/test_data/schema.k"])
15+
api = api.API()
16+
result = api.exec_program(args)
17+
print(result.yaml_result)
18+
```
19+
320
## Developing
421

522
Setup virtualenv:

0 commit comments

Comments
 (0)