Skip to content

Commit f6b831b

Browse files
committed
Initial project
1 parent 68d5103 commit f6b831b

File tree

4,349 files changed

+220140
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,349 files changed

+220140
-1
lines changed

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[antflake8]
2+
max-line-length = 120
3+
select = C,E,F,W,B,B950
4+
extend-ignore = F403, F405, E203, E501, W503
5+
exclude = *_pb2.py, lark_token.py

.github/ISSUE_TEMPLATE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
- With issues:
2+
- Use the search tool before opening a new issue.
3+
- Please provide source code and commit sha if you found a bug.
4+
- Review existing issues and provide feedback or react to them.
5+
6+
## Description
7+
8+
<!-- Description of a problem -->
9+
10+
## How to reproduce
11+
12+
<!-- The smallest possible code example to show the problem that can be compiled, like -->
13+
14+
TODO
15+
16+
## Expectations
17+
18+
<!-- Your expectation result of 'curl' command, like -->
19+
20+
TODO
21+
22+
## Actual result
23+
24+
<!-- Actual result showing the problem -->
25+
26+
TODO
27+
28+
## Environment
29+
30+
- KCLVM version:
31+
- Operating system:

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- With pull requests:
2+
- Open your pull request against `main`
3+
- Your pull request should have no more than two commits, if not you should squash them.
4+
- It should pass all tests in the available continuous integration systems such as GitHub Actions.
5+
- You should add/modify tests to cover your proposed code changes.
6+
- If your pull request contains a new feature, please document it on the README.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: KCLVM-actions
2+
on: [push]
3+
jobs:
4+
test-unit:
5+
name: Test
6+
runs-on: ubuntu-latest
7+
container:
8+
image: kusionstack/kclvm-builder
9+
steps:
10+
- name: Check out code
11+
uses: actions/checkout@v3
12+
# with:
13+
# submodules: 'true'
14+
- name: Build KCLVM
15+
run: make build
16+
shell: bash
17+
- name: Grammar test
18+
run: |
19+
chmod +x ./internal/kclvm_py/scripts/test_grammar.sh
20+
topdir=$(realpath $(dirname $0)) ./internal/kclvm_py/scripts/test_grammar.sh
21+
shell: bash
22+
- name: Internal python unit test
23+
run: |
24+
chmod +x ./internal/kclvm_py/scripts/test_unit.sh
25+
./internal/kclvm_py/scripts/test_unit.sh
26+
shell: bash
27+
# - name: Rust unit test
28+
# uses: actions-rs/toolchain@v1
29+
# with:
30+
# toolchain: stable
31+
# override: true
32+
# components: rustfmt, clippy
33+
# run: cd kclvm && make test
34+
# shell: bash

.gitignore

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/build/
2+
.vs/
3+
.vscode/
4+
.idea/
5+
6+
# kcl files
7+
.pytest_cache
8+
__pycache__
9+
__kclcache__/
10+
build-result/
11+
dist/
12+
kclvm.egg-info/
13+
.eggs/
14+
15+
# Mac OS X files
16+
.DS_Store
17+
18+
_python37_home_
19+
_site-packages
20+
21+
__kcl_test_main.k
22+
23+
# kclvm bundles
24+
/kclvm-*.zip
25+
/kcl-go*
26+
/_build_dist
27+
.kusion
28+
29+
/venv/
30+
31+
# Coverage
32+
.coverage
33+
.coverage.*
34+
/cover
35+
/scripts/cover
36+
37+
/result
38+
39+
coverage.xml
40+
TEST-kclvm.xml
41+
42+
/go-test-coverprofile.*
43+
44+
# Benchmark
45+
.benchmarks
46+
47+
# Code check
48+
.code_check
49+
50+
/_output
51+
52+
# Lark parser cache
53+
lark_parser.pickle
54+
55+
/vendor
56+
/_build*
57+
/__build*
58+
/_3rdparty
59+
60+
61+
# Rust
62+
*.o
63+
*.a
64+
*.so
65+
*.orig
66+
/target
67+
/*/target
68+
/*/*/target
69+
/**/target
70+
71+
/kclvm/vendor
72+
/scripts/docker/kclvm-builder/vendor*
73+
/scripts/docker/kclvm-builder/crates.io-index
74+
/scripts/docker/kclvm-builder-centos7/crates.io-index
75+
/scripts/docker/kclvm-builder-ubuntu/crates.io-index
76+
*.tar.gz
77+
_a.out.*
78+
_a.out_*.*
79+
# KCLVM cache
80+
.kclvm
81+
__main__.*

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "plugins"]
2+
path = plugins
3+
url = https://github.com/KusionStack/kcl-plugin

CONTRIBUTING.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# KCLVM Developing Guide
2+
3+
KCLVM follows a very standard Github development process, using Github tracker for issues and merging pull requests into master. If you would like to contribute something, or simply want to hack on the code this document should help you get started.
4+
5+
Before we accept a non-trivial patch or pull request we will need you to sign the Contributor License Agreement. Signing the contributor’s agreement does not grant anyone commits rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team and given the ability to merge pull requests.
6+
7+
## Install Dependencies
8+
9+
### macOS and OS X
10+
11+
+ `Python3.7+`
12+
+ `Go 1.16+`
13+
+ `Rust 2021 edition`
14+
15+
16+
```
17+
brew install [email protected]
18+
```
19+
20+
### Linux
21+
22+
+ `Go 1.16+`
23+
+ `Rust 2021 edition`
24+
+ `Python3 Building Dependencies`
25+
26+
For UNIX based systems, you can run:
27+
28+
```
29+
yum groupinstall -y "Development Tools"
30+
yum install -y gcc patch libffi-devel python-devel zlib-devel bzip2-devel ncurses-devel sqlite-devel
31+
yum install -y libpcap-devel xz-devel readline-devel tk-devel gdbm-devel db4-deve
32+
yum -y install yum-utils
33+
yum-builddep -y python3
34+
yum install -y zlib*
35+
yum install -y openssl-devel
36+
yum install -y glibc-static
37+
```
38+
39+
On Debian, Ubuntu, and other apt based systems, you can run:
40+
41+
```
42+
apt-get update
43+
44+
apt-get install -y git wget curl
45+
apt-get install -y make gcc patch
46+
apt-get install -y python-dev libffi-dev
47+
apt-get install -y zlib1g-dev ncurses-dev build-essential libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev
48+
```
49+
50+
### Docker
51+
52+
Use the image `kusionstack/kclvm-builder`, run:
53+
54+
```
55+
make sh-in-docker
56+
```
57+
58+
## Building and Testing
59+
60+
### Scripting
61+
62+
We provide a simple `run.sh` script to build and package with.
63+
64+
To build everything, run:
65+
66+
```
67+
./run.sh -a build
68+
```
69+
70+
Building includes two steps, which are `build-cpython` and `build-kclvm`. Alternatively, these steps can be invoked separately:
71+
72+
```
73+
./run.sh -a build-cpython
74+
./run.sh -a build-kclvm
75+
```
76+
77+
Building KCL requires local ssl module. Use -s $yourLocalSSL to specify custom ssl path:
78+
79+
```
80+
./run.sh -a build -s $your-local-ssl
81+
./run.sh -a build-cpython -s $your-local-ssl
82+
```
83+
84+
If -s option unset, default ssl path will be used:
85+
Darwin: `$(brew --prefix [email protected])`
86+
Linux: `/usr/lib64`
87+
88+
To use KCL, add the path `_build/dist/{os}/kclvm/bin` to the `PATH` environment variable. Here, `{os}` stands for the operating system, which can be `Darwin`, `centos`, `ubuntu` or other types.
89+
90+
Then, you can run:
91+
92+
```
93+
kcl hello.k
94+
```
95+
96+
To perform testing, run:
97+
98+
```
99+
./run.sh -a test
100+
```
101+
102+
Next, we can refer to [KCLVM README](./kclvm/README.md) for the next step of environment configuration and build the KCLVM rust code.
103+
104+
If we have changed any codes in the program, we can update kclvm binaries, run:
105+
106+
```
107+
./run.sh -a update-kclvm
108+
```
109+
110+
To build a tar file, run:
111+
112+
```
113+
./run.sh -a release
114+
```
115+
116+
## Using KCL
117+
118+
The specific user manual is as follows: [KCLVM User Manual](docs/cmd/README_KCLVM_USE.md)
119+
120+
## Code Structure
121+
122+
KCL has added the following files and directories:
123+
124+
+ `kclvm` - The KCL compiler code.
125+
+ `test` - All KCL test cases include regression tests and unit tests.
126+
+ `scripts` - The directory where additional scripts to build and test KCL resist.
127+
+ `run.sh` - The script to perform operations such as building and testing.
128+
+ `internal/kclvm_py` - KCLVM Python implementation, will be abandoned soon, please do not submit any code to it, it will be reorganized in the way of KCLVM Python SDK in the future.
129+
+ `docs` - KCL command line Documentation.
130+
+ `spec` - KCL model and API Specification.
131+
132+
During building and testing, the following directories can be generated:
133+
134+
+ `_build` - The directory to save building results including distributions.

0 commit comments

Comments
 (0)