diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa964cd4..1e396038 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,27 +42,6 @@ jobs: - name: Go code test run: go test ./... - python-test: - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Git checkout - uses: actions/checkout@v2 - - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - name: Install dependencies - working-directory: python - run: | - python3 -m pip install -r ./scripts/requirements.txt - python3 -m pip install pytest - python3 -m pip install setuptools wheel twine - - name: Python code test - working-directory: python - run: python3 -m pytest - java-test: permissions: actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows diff --git a/.github/workflows/python-test.yaml b/.github/workflows/python-test.yaml new file mode 100644 index 00000000..53efa5da --- /dev/null +++ b/.github/workflows/python-test.yaml @@ -0,0 +1,116 @@ +# This file is autogenerated by maturin v1.5.1 +# To update, run +# +# maturin generate-ci github +# +name: python-test + +on: + push: + branches: + - main + - master + tags: + - '*' + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: PyO3/maturin-action@v1 + with: + working-directory: "python" + command: sdist + args: -o dist + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: python/dist + + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [ x86_64, aarch64 ] + steps: + - uses: actions/checkout@v4 + - uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + manylinux: auto + working-directory: "python" + command: build + args: --release -o dist --find-interpreter + env: + # Workaround ring 0.17 build issue + CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8" + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: python/dist + + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: PyO3/maturin-action@v1 + with: + working-directory: "python" + command: build + args: --release -o dist --find-interpreter + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: python/dist + + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: PyO3/maturin-action@v1 + with: + working-directory: "python" + command: build + target: universal2-apple-darwin + args: --release -o dist --find-interpreter + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: python/dist + + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + permissions: + contents: read + id-token: write + needs: [ macos, linux, windows ] + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: python/dist + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: "contains(github.ref, '-')" + with: + repository-url: https://test.pypi.org/legacy/ + skip-existing: true + packages-dir: python/dist + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: "!contains(github.ref, '-')" + with: + skip-existing: true + packages-dir: python/dist diff --git a/.github/workflows/release_python.yaml b/.github/workflows/release_python.yaml deleted file mode 100644 index 4d740c85..00000000 --- a/.github/workflows/release_python.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: Release Python -on: - push: - tags: - - "v*" -permissions: - contents: write -jobs: - python-release: - runs-on: ubuntu-latest - steps: - - name: Git checkout - uses: actions/checkout@v2 - - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - name: Install dependencies - working-directory: python - run: | - python3 -m pip install -r ./scripts/requirements.txt - python3 -m pip install pytest - python3 -m pip install setuptools wheel twine - - name: Python code test - working-directory: python - run: python3 -m pytest - - name: Upload pypi - working-directory: python - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: make dist diff --git a/.gitignore b/.gitignore index c5d47ac5..83e4f087 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ zz_* *.so *.dll *.d -*.lock *.ll *.ll.lock _a.out.* diff --git a/python/.gitignore b/python/.gitignore index 787414d1..1f5b221e 100644 --- a/python/.gitignore +++ b/python/.gitignore @@ -2,6 +2,7 @@ .vs/ .vscode/ .idea/ +venv # kcl files .pytest_cache diff --git a/python/Cargo.toml b/python/Cargo.toml new file mode 100644 index 00000000..719c5bde --- /dev/null +++ b/python/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "kcl-python-lib" +version = "0.8.4" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +crate-type = ["cdylib"] + +[dependencies] +pyo3 = "0.20.1" +kcl-lang = {path = "../"} diff --git a/python/README.md b/python/README.md index c9c502b8..9f109363 100644 --- a/python/README.md +++ b/python/README.md @@ -1 +1,33 @@ # KCL Artifact Library for Python + +## Developing + +Setup virtualenv: + +```shell +python3 -m venv venv +``` + +Activate venv: + +```shell +source venv/bin/activate +``` + +Install maturin: + +```shell +cargo install maturin +``` + +Build bindings: + +```shell +maturin develop +``` + +Test + +```shell +python3 -m pytest +``` diff --git a/python/kcl_lib/__init__.py b/python/kcl_lib/__init__.py index e69de29b..8aab720c 100644 --- a/python/kcl_lib/__init__.py +++ b/python/kcl_lib/__init__.py @@ -0,0 +1 @@ +from ._kcl_lib import * diff --git a/python/kcl_lib/api/service.py b/python/kcl_lib/api/service.py index 7c360ba6..2d9ec470 100644 --- a/python/kcl_lib/api/service.py +++ b/python/kcl_lib/api/service.py @@ -2,14 +2,7 @@ import tempfile import threading import os -from kcl_lib.bootstrap import ( - KCLVM_CLI_INSTALL_PATH_ENV_VAR, - KCLVM_CLI_BIN_PATH_ENV_VAR, - KCLVM_CLI_USE_TEST_ENV_VAR, - lib_full_name, - install_kclvm, -) -from kcl_lib.bootstrap.artifact import lib_path, LIB_ROOT +import kcl_lib from .spec_pb2 import * from ctypes import c_char_p, c_void_p from google.protobuf import message as _message @@ -31,123 +24,84 @@ class API: ``` """ - def __init__(self): - self.caller = Caller() - def ping(self, args: Ping_Args) -> Ping_Result: - return self.caller.call("KclvmService.Ping", args) + return self.call("KclvmService.Ping", args) def parse_program(self, args: ParseProgram_Args) -> ParseProgram_Result: - return self.caller.call("KclvmService.ParseProgram", args) + return self.call("KclvmService.ParseProgram", args) def exec_program(self, args: ExecProgram_Args) -> ExecProgram_Result: - return self.caller.call("KclvmService.ExecProgram", args) + return self.call("KclvmService.ExecProgram", args) def build_program(self, args: BuildProgram_Args) -> BuildProgram_Result: - return self.caller.call("KclvmService.BuildProgram", args) + return self.call("KclvmService.BuildProgram", args) def exec_artifact(self, args: ExecArtifact_Args) -> ExecProgram_Result: - return self.caller.call("KclvmService.ExecArtifact", args) + return self.call("KclvmService.ExecArtifact", args) def parse_file(self, args: ParseFile_Args) -> ParseFile_Result: - return self.caller.call("KclvmService.ParseFile", args) + return self.call("KclvmService.ParseFile", args) def parse_program(self, args: ParseProgram_Args) -> ParseProgram_Result: - return self.caller.call("KclvmService.ParseProgram", args) + return self.call("KclvmService.ParseProgram", args) def load_package(self, args: LoadPackage_Args) -> LoadPackage_Result: - return self.caller.call("KclvmService.LoadPackage", args) + return self.call("KclvmService.LoadPackage", args) + + def list_options(self, args: ParseProgram_Args) -> ListOptions_Result: + return self.call("KclvmService.ListOptions", args) + + def list_variables(self, args: ListVariables_Args) -> ListVariables_Result: + return self.call("KclvmService.ListVariables", args) def format_code(self, args: FormatCode_Args) -> FormatCode_Result: - return self.caller.call("KclvmService.FormatCode", args) + return self.call("KclvmService.FormatCode", args) def format_path(self, args: FormatPath_Args) -> FormatPath_Result: - return self.caller.call("KclvmService.FormatPath", args) + return self.call("KclvmService.FormatPath", args) def lint_path(self, args: LintPath_Args) -> LintPath_Result: - return self.caller.call("KclvmService.LintPath", args) + return self.call("KclvmService.LintPath", args) def override_file(self, args: OverrideFile_Args) -> OverrideFile_Result: - return self.caller.call("KclvmService.OverrideFile", args) + return self.call("KclvmService.OverrideFile", args) def get_full_schema_type( self, args: GetFullSchemaType_Args, ) -> GetSchemaType_Result: - return self.caller.call("KclvmService.GetFullSchemaType", args) + return self.call("KclvmService.GetFullSchemaType", args) def validate_code(self, args: ValidateCode_Args) -> ValidateCode_Result: - return self.caller.call("KclvmService.ValidateCode", args) + return self.call("KclvmService.ValidateCode", args) def load_settings_files( self, args: LoadSettingsFiles_Args, ) -> LoadSettingsFiles_Result: - return self.caller.call("KclvmService.LoadSettingsFiles", args) + return self.call("KclvmService.LoadSettingsFiles", args) def rename(self, args: Rename_Args) -> Rename_Result: - return self.caller.call("KclvmService.Rename", args) + return self.call("KclvmService.Rename", args) def rename_code(self, args: RenameCode_Args) -> RenameCode_Result: - return self.caller.call("KclvmService.RenameCode", args) + return self.call("KclvmService.RenameCode", args) def test(self, args: Test_Args) -> Test_Result: - return self.caller.call("KclvmService.Test", args) + return self.call("KclvmService.Test", args) # Helper method to perform the call - def call(self, function_name: str, args): - return self.caller.call(function_name, args) - - -class Caller: - def __init__(self): - self._dir = tempfile.TemporaryDirectory() - env_path = os.environ.get(KCLVM_CLI_BIN_PATH_ENV_VAR) - env_install_path = os.environ.get(KCLVM_CLI_INSTALL_PATH_ENV_VAR) - env_use_test = os.environ.get(KCLVM_CLI_USE_TEST_ENV_VAR) - if env_path: - self.lib = ctypes.CDLL(os.path.join(env_path, lib_full_name())) - elif env_install_path: - install_kclvm(env_install_path) - self.lib = ctypes.CDLL( - os.path.join(env_install_path, "bin", lib_full_name()) - ) - # Default test cases - elif env_use_test: - # Install temp path. - install_kclvm(self._dir.name) - self.lib = ctypes.CDLL(self._dir.name + "/bin/" + lib_full_name()) - else: - # The release lib is located at "kcl_lib/bin/" - lib_path = LIB_ROOT.joinpath("bin") - os.environ[KCLVM_CLI_BIN_PATH_ENV_VAR] = str(lib_path) - self.lib = ctypes.CDLL(str(lib_path.joinpath(lib_full_name()))) - # Assuming the shared library exposes a function `kclvm_service_new` - self.lib.kclvm_service_new.argtypes = [ctypes.c_uint64] - self.lib.kclvm_service_new.restype = ctypes.c_void_p - self.handler = self.lib.kclvm_service_new(0) - - self.mutex = threading.Lock() - def call(self, name: str, args): - with self.mutex: - # Serialize arguments using pickle or json - args_serialized = args.SerializeToString() - - # Assuming the library exposes a service call function - self.lib.kclvm_service_call.argtypes = [c_void_p, c_char_p, c_char_p] - self.lib.kclvm_service_call.restype = c_char_p - - # Call the service function and get the result - result_ptr = self.lib.kclvm_service_call( - self.handler, name.encode("utf-8"), args_serialized - ) - result = ctypes.cast(result_ptr, ctypes.c_char_p).value - if result.startswith(b"ERROR"): - raise Exception(str(result)) - msg = self.create_method_resp_message(name) - msg.ParseFromString(result) - return msg + # Serialize arguments using pickle or json + args_serialized = args.SerializeToString() + + # Call the service function and get the result + result = kcl_lib.call(name.encode("utf-8"), args_serialized) + if result.startswith(b"ERROR"): + raise Exception(str(result)) + msg = self.create_method_resp_message(name) + msg.ParseFromString(result) + return msg def create_method_req_message(self, method: str) -> _message.Message: if method in ["Ping", "KclvmService.Ping"]: @@ -162,6 +116,12 @@ def create_method_req_message(self, method: str) -> _message.Message: return ParseFile_Args() if method in ["ParseProgram", "KclvmService.ParseProgram"]: return ParseProgram_Args() + if method in ["LoadPackage", "KclvmService.LoadPackage"]: + return LoadPackage_Args() + if method in ["ListOptions", "KclvmService.ListOptions"]: + return ParseProgram_Args() + if method in ["ListVariables", "KclvmService.ListVariables"]: + return ListVariables_Args() if method in ["FormatCode", "KclvmService.FormatCode"]: return FormatCode_Args() if method in ["FormatPath", "KclvmService.FormatPath"]: @@ -201,6 +161,12 @@ def create_method_resp_message(self, method: str) -> _message.Message: return ParseFile_Result() if method in ["ParseProgram", "KclvmService.ParseProgram"]: return ParseProgram_Result() + if method in ["LoadPackage", "KclvmService.LoadPackage"]: + return LoadPackage_Result() + if method in ["ListOptions", "KclvmService.ListOptions"]: + return ListOptions_Result() + if method in ["ListVariables", "KclvmService.ListVariables"]: + return ListVariables_Result() if method in ["FormatCode", "KclvmService.FormatCode"]: return FormatCode_Result() if method in ["FormatPath", "KclvmService.FormatPath"]: @@ -226,9 +192,3 @@ def create_method_resp_message(self, method: str) -> _message.Message: if method in ["Test", "KclvmService.Test"]: return Test_Result() raise Exception(f"unknown method: {method}") - - # def __del__(self): - # # Assuming the shared library exposes a function `kclvm_service_delete` - # self.lib.kclvm_service_delete.argtypes = [c_void_p] - # self.lib.kclvm_service_delete(self.handler) - # self._dir.cleanup() diff --git a/python/kcl_lib/api/spec_pb2.py b/python/kcl_lib/api/spec_pb2.py index 874de735..ffcba314 100644 --- a/python/kcl_lib/api/spec_pb2.py +++ b/python/kcl_lib/api/spec_pb2.py @@ -7,200 +7,209 @@ from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder + # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nspec.proto\x12\x0b\x63om.kcl.api\"8\n\x12\x43mdExternalPkgSpec\x12\x10\n\x08pkg_name\x18\x01 \x01(\t\x12\x10\n\x08pkg_path\x18\x02 \x01(\t\")\n\nCmdArgSpec\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"[\n\x0f\x43mdOverrideSpec\x12\x0f\n\x07pkgpath\x18\x01 \x01(\t\x12\x12\n\nfield_path\x18\x02 \x01(\t\x12\x13\n\x0b\x66ield_value\x18\x03 \x01(\t\x12\x0e\n\x06\x61\x63tion\x18\x04 \x01(\t\"L\n\x05\x45rror\x12\r\n\x05level\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12&\n\x08messages\x18\x03 \x03(\x0b\x32\x14.com.kcl.api.Message\":\n\x07Message\x12\x0b\n\x03msg\x18\x01 \x01(\t\x12\"\n\x03pos\x18\x02 \x01(\x0b\x32\x15.com.kcl.api.Position\"\x1a\n\tPing_Args\x12\r\n\x05value\x18\x01 \x01(\t\"\x1c\n\x0bPing_Result\x12\r\n\x05value\x18\x01 \x01(\t\"\x11\n\x0fListMethod_Args\"-\n\x11ListMethod_Result\x12\x18\n\x10method_name_list\x18\x01 \x03(\t\"f\n\x0eParseFile_Args\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t\x12\x36\n\rexternal_pkgs\x18\x03 \x03(\x0b\x32\x1f.com.kcl.api.CmdExternalPkgSpec\"V\n\x10ParseFile_Result\x12\x10\n\x08\x61st_json\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x65ps\x18\x02 \x03(\t\x12\"\n\x06\x65rrors\x18\x03 \x03(\x0b\x32\x12.com.kcl.api.Error\"k\n\x11ParseProgram_Args\x12\r\n\x05paths\x18\x01 \x03(\t\x12\x0f\n\x07sources\x18\x02 \x03(\t\x12\x36\n\rexternal_pkgs\x18\x03 \x03(\x0b\x32\x1f.com.kcl.api.CmdExternalPkgSpec\"Z\n\x13ParseProgram_Result\x12\x10\n\x08\x61st_json\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12\"\n\x06\x65rrors\x18\x03 \x03(\x0b\x32\x12.com.kcl.api.Error\"\x89\x01\n\x10LoadPackage_Args\x12\x32\n\nparse_args\x18\x01 \x01(\x0b\x32\x1e.com.kcl.api.ParseProgram_Args\x12\x13\n\x0bresolve_ast\x18\x02 \x01(\x08\x12\x14\n\x0cload_builtin\x18\x03 \x01(\x08\x12\x16\n\x0ewith_ast_index\x18\x04 \x01(\x08\"\xf7\x07\n\x12LoadPackage_Result\x12\x0f\n\x07program\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12(\n\x0cparse_errors\x18\x03 \x03(\x0b\x32\x12.com.kcl.api.Error\x12\'\n\x0btype_errors\x18\x04 \x03(\x0b\x32\x12.com.kcl.api.Error\x12;\n\x06scopes\x18\x05 \x03(\x0b\x32+.com.kcl.api.LoadPackage_Result.ScopesEntry\x12=\n\x07symbols\x18\x06 \x03(\x0b\x32,.com.kcl.api.LoadPackage_Result.SymbolsEntry\x12K\n\x0fnode_symbol_map\x18\x07 \x03(\x0b\x32\x32.com.kcl.api.LoadPackage_Result.NodeSymbolMapEntry\x12K\n\x0fsymbol_node_map\x18\x08 \x03(\x0b\x32\x32.com.kcl.api.LoadPackage_Result.SymbolNodeMapEntry\x12\\\n\x18\x66ully_qualified_name_map\x18\t \x03(\x0b\x32:.com.kcl.api.LoadPackage_Result.FullyQualifiedNameMapEntry\x12G\n\rpkg_scope_map\x18\n \x03(\x0b\x32\x30.com.kcl.api.LoadPackage_Result.PkgScopeMapEntry\x1a\x41\n\x0bScopesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.com.kcl.api.Scope:\x02\x38\x01\x1a\x43\n\x0cSymbolsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.com.kcl.api.Symbol:\x02\x38\x01\x1aN\n\x12NodeSymbolMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex:\x02\x38\x01\x1a\x34\n\x12SymbolNodeMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1aV\n\x1a\x46ullyQualifiedNameMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex:\x02\x38\x01\x1aK\n\x10PkgScopeMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.com.kcl.api.ScopeIndex:\x02\x38\x01\">\n\x12ListOptions_Result\x12(\n\x07options\x18\x02 \x03(\x0b\x32\x17.com.kcl.api.OptionHelp\"_\n\nOptionHelp\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x10\n\x08required\x18\x03 \x01(\x08\x12\x15\n\rdefault_value\x18\x04 \x01(\t\x12\x0c\n\x04help\x18\x05 \x01(\t\"\xc4\x01\n\x06Symbol\x12 \n\x02ty\x18\x01 \x01(\x0b\x32\x14.com.kcl.api.KclType\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\'\n\x05owner\x18\x03 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex\x12%\n\x03\x64\x65\x66\x18\x04 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex\x12\'\n\x05\x61ttrs\x18\x05 \x03(\x0b\x32\x18.com.kcl.api.SymbolIndex\x12\x11\n\tis_global\x18\x06 \x01(\x08\"\xba\x01\n\x05Scope\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\'\n\x06parent\x18\x02 \x01(\x0b\x32\x17.com.kcl.api.ScopeIndex\x12\'\n\x05owner\x18\x03 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex\x12)\n\x08\x63hildren\x18\x04 \x03(\x0b\x32\x17.com.kcl.api.ScopeIndex\x12&\n\x04\x64\x65\x66s\x18\x05 \x03(\x0b\x32\x18.com.kcl.api.SymbolIndex\"1\n\x0bSymbolIndex\x12\t\n\x01i\x18\x01 \x01(\x04\x12\t\n\x01g\x18\x02 \x01(\x04\x12\x0c\n\x04kind\x18\x03 \x01(\t\"0\n\nScopeIndex\x12\t\n\x01i\x18\x01 \x01(\x04\x12\t\n\x01g\x18\x02 \x01(\x04\x12\x0c\n\x04kind\x18\x03 \x01(\t\"\xf7\x03\n\x10\x45xecProgram_Args\x12\x10\n\x08work_dir\x18\x01 \x01(\t\x12\x17\n\x0fk_filename_list\x18\x02 \x03(\t\x12\x13\n\x0bk_code_list\x18\x03 \x03(\t\x12%\n\x04\x61rgs\x18\x04 \x03(\x0b\x32\x17.com.kcl.api.CmdArgSpec\x12/\n\toverrides\x18\x05 \x03(\x0b\x32\x1c.com.kcl.api.CmdOverrideSpec\x12\x1b\n\x13\x64isable_yaml_result\x18\x06 \x01(\x08\x12\x1a\n\x12print_override_ast\x18\x07 \x01(\x08\x12\x1a\n\x12strict_range_check\x18\x08 \x01(\x08\x12\x14\n\x0c\x64isable_none\x18\t \x01(\x08\x12\x0f\n\x07verbose\x18\n \x01(\x05\x12\r\n\x05\x64\x65\x62ug\x18\x0b \x01(\x05\x12\x11\n\tsort_keys\x18\x0c \x01(\x08\x12\x36\n\rexternal_pkgs\x18\r \x03(\x0b\x32\x1f.com.kcl.api.CmdExternalPkgSpec\x12 \n\x18include_schema_type_path\x18\x0e \x01(\x08\x12\x14\n\x0c\x63ompile_only\x18\x0f \x01(\x08\x12\x13\n\x0bshow_hidden\x18\x10 \x01(\x08\x12\x15\n\rpath_selector\x18\x11 \x03(\t\x12\x11\n\tfast_eval\x18\x12 \x01(\x08\"h\n\x12\x45xecProgram_Result\x12\x13\n\x0bjson_result\x18\x01 \x01(\t\x12\x13\n\x0byaml_result\x18\x02 \x01(\t\x12\x13\n\x0blog_message\x18\x03 \x01(\t\x12\x13\n\x0b\x65rr_message\x18\x04 \x01(\t\"U\n\x11\x42uildProgram_Args\x12\x30\n\texec_args\x18\x01 \x01(\x0b\x32\x1d.com.kcl.api.ExecProgram_Args\x12\x0e\n\x06output\x18\x02 \x01(\t\"#\n\x13\x42uildProgram_Result\x12\x0c\n\x04path\x18\x01 \x01(\t\"S\n\x11\x45xecArtifact_Args\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x30\n\texec_args\x18\x02 \x01(\x0b\x32\x1d.com.kcl.api.ExecProgram_Args\"\'\n\x10ResetPlugin_Args\x12\x13\n\x0bplugin_root\x18\x01 \x01(\t\"\x14\n\x12ResetPlugin_Result\"!\n\x0f\x46ormatCode_Args\x12\x0e\n\x06source\x18\x01 \x01(\t\"&\n\x11\x46ormatCode_Result\x12\x11\n\tformatted\x18\x01 \x01(\x0c\"\x1f\n\x0f\x46ormatPath_Args\x12\x0c\n\x04path\x18\x01 \x01(\t\"*\n\x11\x46ormatPath_Result\x12\x15\n\rchanged_paths\x18\x01 \x03(\t\"\x1e\n\rLintPath_Args\x12\r\n\x05paths\x18\x01 \x03(\t\"\"\n\x0fLintPath_Result\x12\x0f\n\x07results\x18\x01 \x03(\t\"F\n\x11OverrideFile_Args\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\r\n\x05specs\x18\x02 \x03(\t\x12\x14\n\x0cimport_paths\x18\x03 \x03(\t\"%\n\x13OverrideFile_Result\x12\x0e\n\x06result\x18\x01 \x01(\x08\"1\n\x12ListVariables_Args\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\r\n\x05specs\x18\x02 \x03(\t\"\xbf\x01\n\x14ListVariables_Result\x12\x43\n\tvariables\x18\x01 \x03(\x0b\x32\x30.com.kcl.api.ListVariables_Result.VariablesEntry\x12\x19\n\x11unsupported_codes\x18\x02 \x03(\t\x1aG\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.com.kcl.api.Variable:\x02\x38\x01\"\x19\n\x08Variable\x12\r\n\x05value\x18\x01 \x01(\t\"_\n\x16GetFullSchemaType_Args\x12\x30\n\texec_args\x18\x01 \x01(\x0b\x32\x1d.com.kcl.api.ExecProgram_Args\x12\x13\n\x0bschema_name\x18\x02 \x01(\t\"E\n\x12GetSchemaType_Args\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12\x13\n\x0bschema_name\x18\x03 \x01(\t\"F\n\x14GetSchemaType_Result\x12.\n\x10schema_type_list\x18\x01 \x03(\x0b\x32\x14.com.kcl.api.KclType\"L\n\x19GetSchemaTypeMapping_Args\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12\x13\n\x0bschema_name\x18\x03 \x01(\t\"\xcb\x01\n\x1bGetSchemaTypeMapping_Result\x12\\\n\x13schema_type_mapping\x18\x01 \x03(\x0b\x32?.com.kcl.api.GetSchemaTypeMapping_Result.SchemaTypeMappingEntry\x1aN\n\x16SchemaTypeMappingEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.com.kcl.api.KclType:\x02\x38\x01\"\x87\x01\n\x11ValidateCode_Args\x12\x10\n\x08\x64\x61tafile\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\x12\x0c\n\x04\x66ile\x18\x03 \x01(\t\x12\x0c\n\x04\x63ode\x18\x04 \x01(\t\x12\x0e\n\x06schema\x18\x05 \x01(\t\x12\x16\n\x0e\x61ttribute_name\x18\x06 \x01(\t\x12\x0e\n\x06\x66ormat\x18\x07 \x01(\t\";\n\x13ValidateCode_Result\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x13\n\x0b\x65rr_message\x18\x02 \x01(\t\":\n\x08Position\x12\x0c\n\x04line\x18\x01 \x01(\x03\x12\x0e\n\x06\x63olumn\x18\x02 \x01(\x03\x12\x10\n\x08\x66ilename\x18\x03 \x01(\t\"i\n\x11ListDepFiles_Args\x12\x10\n\x08work_dir\x18\x01 \x01(\t\x12\x14\n\x0cuse_abs_path\x18\x02 \x01(\x08\x12\x13\n\x0binclude_all\x18\x03 \x01(\x08\x12\x17\n\x0fuse_fast_parser\x18\x04 \x01(\x08\"F\n\x13ListDepFiles_Result\x12\x0f\n\x07pkgroot\x18\x01 \x01(\t\x12\x0f\n\x07pkgpath\x18\x02 \x01(\t\x12\r\n\x05\x66iles\x18\x03 \x03(\t\"9\n\x16LoadSettingsFiles_Args\x12\x10\n\x08work_dir\x18\x01 \x01(\t\x12\r\n\x05\x66iles\x18\x02 \x03(\t\"{\n\x18LoadSettingsFiles_Result\x12/\n\x0fkcl_cli_configs\x18\x01 \x01(\x0b\x32\x16.com.kcl.api.CliConfig\x12.\n\x0bkcl_options\x18\x02 \x03(\x0b\x32\x19.com.kcl.api.KeyValuePair\"\x83\x02\n\tCliConfig\x12\r\n\x05\x66iles\x18\x01 \x03(\t\x12\x0e\n\x06output\x18\x02 \x01(\t\x12\x11\n\toverrides\x18\x03 \x03(\t\x12\x15\n\rpath_selector\x18\x04 \x03(\t\x12\x1a\n\x12strict_range_check\x18\x05 \x01(\x08\x12\x14\n\x0c\x64isable_none\x18\x06 \x01(\x08\x12\x0f\n\x07verbose\x18\x07 \x01(\x03\x12\r\n\x05\x64\x65\x62ug\x18\x08 \x01(\x08\x12\x11\n\tsort_keys\x18\t \x01(\x08\x12\x13\n\x0bshow_hidden\x18\n \x01(\x08\x12 \n\x18include_schema_type_path\x18\x0b \x01(\x08\x12\x11\n\tfast_eval\x18\x0c \x01(\x08\"*\n\x0cKeyValuePair\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"^\n\x0bRename_Args\x12\x14\n\x0cpackage_root\x18\x01 \x01(\t\x12\x13\n\x0bsymbol_path\x18\x02 \x01(\t\x12\x12\n\nfile_paths\x18\x03 \x03(\t\x12\x10\n\x08new_name\x18\x04 \x01(\t\"&\n\rRename_Result\x12\x15\n\rchanged_files\x18\x01 \x03(\t\"\xc7\x01\n\x0fRenameCode_Args\x12\x14\n\x0cpackage_root\x18\x01 \x01(\t\x12\x13\n\x0bsymbol_path\x18\x02 \x01(\t\x12\x43\n\x0csource_codes\x18\x03 \x03(\x0b\x32-.com.kcl.api.RenameCode_Args.SourceCodesEntry\x12\x10\n\x08new_name\x18\x04 \x01(\t\x1a\x32\n\x10SourceCodesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x91\x01\n\x11RenameCode_Result\x12G\n\rchanged_codes\x18\x01 \x03(\x0b\x32\x30.com.kcl.api.RenameCode_Result.ChangedCodesEntry\x1a\x33\n\x11\x43hangedCodesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"v\n\tTest_Args\x12\x30\n\texec_args\x18\x01 \x01(\x0b\x32\x1d.com.kcl.api.ExecProgram_Args\x12\x10\n\x08pkg_list\x18\x02 \x03(\t\x12\x12\n\nrun_regexp\x18\x03 \x01(\t\x12\x11\n\tfail_fast\x18\x04 \x01(\x08\"6\n\x0bTest_Result\x12\'\n\x04info\x18\x02 \x03(\x0b\x32\x19.com.kcl.api.TestCaseInfo\"R\n\x0cTestCaseInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x65rror\x18\x02 \x01(\t\x12\x10\n\x08\x64uration\x18\x03 \x01(\x04\x12\x13\n\x0blog_message\x18\x04 \x01(\t\"\xc8\x04\n\x07KclType\x12\x0c\n\x04type\x18\x01 \x01(\t\x12)\n\x0bunion_types\x18\x02 \x03(\x0b\x32\x14.com.kcl.api.KclType\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x03 \x01(\t\x12\x13\n\x0bschema_name\x18\x04 \x01(\t\x12\x12\n\nschema_doc\x18\x05 \x01(\t\x12\x38\n\nproperties\x18\x06 \x03(\x0b\x32$.com.kcl.api.KclType.PropertiesEntry\x12\x10\n\x08required\x18\x07 \x03(\t\x12!\n\x03key\x18\x08 \x01(\x0b\x32\x14.com.kcl.api.KclType\x12\"\n\x04item\x18\t \x01(\x0b\x32\x14.com.kcl.api.KclType\x12\x0c\n\x04line\x18\n \x01(\x05\x12*\n\ndecorators\x18\x0b \x03(\x0b\x32\x16.com.kcl.api.Decorator\x12\x10\n\x08\x66ilename\x18\x0c \x01(\t\x12\x10\n\x08pkg_path\x18\r \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x0e \x01(\t\x12\x34\n\x08\x65xamples\x18\x0f \x03(\x0b\x32\".com.kcl.api.KclType.ExamplesEntry\x1aG\n\x0fPropertiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.com.kcl.api.KclType:\x02\x38\x01\x1a\x45\n\rExamplesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.com.kcl.api.Example:\x02\x38\x01\"\x95\x01\n\tDecorator\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\targuments\x18\x02 \x03(\t\x12\x36\n\x08keywords\x18\x03 \x03(\x0b\x32$.com.kcl.api.Decorator.KeywordsEntry\x1a/\n\rKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\">\n\x07\x45xample\x12\x0f\n\x07summary\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t2\x96\x01\n\x0e\x42uiltinService\x12\x38\n\x04Ping\x12\x16.com.kcl.api.Ping_Args\x1a\x18.com.kcl.api.Ping_Result\x12J\n\nListMethod\x12\x1c.com.kcl.api.ListMethod_Args\x1a\x1e.com.kcl.api.ListMethod_Result2\xe0\r\n\x0cKclvmService\x12\x38\n\x04Ping\x12\x16.com.kcl.api.Ping_Args\x1a\x18.com.kcl.api.Ping_Result\x12M\n\x0b\x45xecProgram\x12\x1d.com.kcl.api.ExecProgram_Args\x1a\x1f.com.kcl.api.ExecProgram_Result\x12P\n\x0c\x42uildProgram\x12\x1e.com.kcl.api.BuildProgram_Args\x1a .com.kcl.api.BuildProgram_Result\x12O\n\x0c\x45xecArtifact\x12\x1e.com.kcl.api.ExecArtifact_Args\x1a\x1f.com.kcl.api.ExecProgram_Result\x12G\n\tParseFile\x12\x1b.com.kcl.api.ParseFile_Args\x1a\x1d.com.kcl.api.ParseFile_Result\x12P\n\x0cParseProgram\x12\x1e.com.kcl.api.ParseProgram_Args\x1a .com.kcl.api.ParseProgram_Result\x12M\n\x0bLoadPackage\x12\x1d.com.kcl.api.LoadPackage_Args\x1a\x1f.com.kcl.api.LoadPackage_Result\x12N\n\x0bListOptions\x12\x1e.com.kcl.api.ParseProgram_Args\x1a\x1f.com.kcl.api.ListOptions_Result\x12S\n\rListVariables\x12\x1f.com.kcl.api.ListVariables_Args\x1a!.com.kcl.api.ListVariables_Result\x12J\n\nFormatCode\x12\x1c.com.kcl.api.FormatCode_Args\x1a\x1e.com.kcl.api.FormatCode_Result\x12J\n\nFormatPath\x12\x1c.com.kcl.api.FormatPath_Args\x1a\x1e.com.kcl.api.FormatPath_Result\x12\x44\n\x08LintPath\x12\x1a.com.kcl.api.LintPath_Args\x1a\x1c.com.kcl.api.LintPath_Result\x12P\n\x0cOverrideFile\x12\x1e.com.kcl.api.OverrideFile_Args\x1a .com.kcl.api.OverrideFile_Result\x12S\n\rGetSchemaType\x12\x1f.com.kcl.api.GetSchemaType_Args\x1a!.com.kcl.api.GetSchemaType_Result\x12[\n\x11GetFullSchemaType\x12#.com.kcl.api.GetFullSchemaType_Args\x1a!.com.kcl.api.GetSchemaType_Result\x12h\n\x14GetSchemaTypeMapping\x12&.com.kcl.api.GetSchemaTypeMapping_Args\x1a(.com.kcl.api.GetSchemaTypeMapping_Result\x12P\n\x0cValidateCode\x12\x1e.com.kcl.api.ValidateCode_Args\x1a .com.kcl.api.ValidateCode_Result\x12P\n\x0cListDepFiles\x12\x1e.com.kcl.api.ListDepFiles_Args\x1a .com.kcl.api.ListDepFiles_Result\x12_\n\x11LoadSettingsFiles\x12#.com.kcl.api.LoadSettingsFiles_Args\x1a%.com.kcl.api.LoadSettingsFiles_Result\x12>\n\x06Rename\x12\x18.com.kcl.api.Rename_Args\x1a\x1a.com.kcl.api.Rename_Result\x12J\n\nRenameCode\x12\x1c.com.kcl.api.RenameCode_Args\x1a\x1e.com.kcl.api.RenameCode_Result\x12\x38\n\x04Test\x12\x16.com.kcl.api.Test_Args\x1a\x18.com.kcl.api.Test_Resultb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n\nspec.proto\x12\x0b\x63om.kcl.api"8\n\x12\x43mdExternalPkgSpec\x12\x10\n\x08pkg_name\x18\x01 \x01(\t\x12\x10\n\x08pkg_path\x18\x02 \x01(\t")\n\nCmdArgSpec\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"[\n\x0f\x43mdOverrideSpec\x12\x0f\n\x07pkgpath\x18\x01 \x01(\t\x12\x12\n\nfield_path\x18\x02 \x01(\t\x12\x13\n\x0b\x66ield_value\x18\x03 \x01(\t\x12\x0e\n\x06\x61\x63tion\x18\x04 \x01(\t"L\n\x05\x45rror\x12\r\n\x05level\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12&\n\x08messages\x18\x03 \x03(\x0b\x32\x14.com.kcl.api.Message":\n\x07Message\x12\x0b\n\x03msg\x18\x01 \x01(\t\x12"\n\x03pos\x18\x02 \x01(\x0b\x32\x15.com.kcl.api.Position"\x1a\n\tPing_Args\x12\r\n\x05value\x18\x01 \x01(\t"\x1c\n\x0bPing_Result\x12\r\n\x05value\x18\x01 \x01(\t"\x11\n\x0fListMethod_Args"-\n\x11ListMethod_Result\x12\x18\n\x10method_name_list\x18\x01 \x03(\t"f\n\x0eParseFile_Args\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t\x12\x36\n\rexternal_pkgs\x18\x03 \x03(\x0b\x32\x1f.com.kcl.api.CmdExternalPkgSpec"V\n\x10ParseFile_Result\x12\x10\n\x08\x61st_json\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x65ps\x18\x02 \x03(\t\x12"\n\x06\x65rrors\x18\x03 \x03(\x0b\x32\x12.com.kcl.api.Error"k\n\x11ParseProgram_Args\x12\r\n\x05paths\x18\x01 \x03(\t\x12\x0f\n\x07sources\x18\x02 \x03(\t\x12\x36\n\rexternal_pkgs\x18\x03 \x03(\x0b\x32\x1f.com.kcl.api.CmdExternalPkgSpec"Z\n\x13ParseProgram_Result\x12\x10\n\x08\x61st_json\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12"\n\x06\x65rrors\x18\x03 \x03(\x0b\x32\x12.com.kcl.api.Error"\x89\x01\n\x10LoadPackage_Args\x12\x32\n\nparse_args\x18\x01 \x01(\x0b\x32\x1e.com.kcl.api.ParseProgram_Args\x12\x13\n\x0bresolve_ast\x18\x02 \x01(\x08\x12\x14\n\x0cload_builtin\x18\x03 \x01(\x08\x12\x16\n\x0ewith_ast_index\x18\x04 \x01(\x08"\xf7\x07\n\x12LoadPackage_Result\x12\x0f\n\x07program\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12(\n\x0cparse_errors\x18\x03 \x03(\x0b\x32\x12.com.kcl.api.Error\x12\'\n\x0btype_errors\x18\x04 \x03(\x0b\x32\x12.com.kcl.api.Error\x12;\n\x06scopes\x18\x05 \x03(\x0b\x32+.com.kcl.api.LoadPackage_Result.ScopesEntry\x12=\n\x07symbols\x18\x06 \x03(\x0b\x32,.com.kcl.api.LoadPackage_Result.SymbolsEntry\x12K\n\x0fnode_symbol_map\x18\x07 \x03(\x0b\x32\x32.com.kcl.api.LoadPackage_Result.NodeSymbolMapEntry\x12K\n\x0fsymbol_node_map\x18\x08 \x03(\x0b\x32\x32.com.kcl.api.LoadPackage_Result.SymbolNodeMapEntry\x12\\\n\x18\x66ully_qualified_name_map\x18\t \x03(\x0b\x32:.com.kcl.api.LoadPackage_Result.FullyQualifiedNameMapEntry\x12G\n\rpkg_scope_map\x18\n \x03(\x0b\x32\x30.com.kcl.api.LoadPackage_Result.PkgScopeMapEntry\x1a\x41\n\x0bScopesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12!\n\x05value\x18\x02 \x01(\x0b\x32\x12.com.kcl.api.Scope:\x02\x38\x01\x1a\x43\n\x0cSymbolsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12"\n\x05value\x18\x02 \x01(\x0b\x32\x13.com.kcl.api.Symbol:\x02\x38\x01\x1aN\n\x12NodeSymbolMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex:\x02\x38\x01\x1a\x34\n\x12SymbolNodeMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1aV\n\x1a\x46ullyQualifiedNameMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\'\n\x05value\x18\x02 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex:\x02\x38\x01\x1aK\n\x10PkgScopeMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.com.kcl.api.ScopeIndex:\x02\x38\x01">\n\x12ListOptions_Result\x12(\n\x07options\x18\x02 \x03(\x0b\x32\x17.com.kcl.api.OptionHelp"_\n\nOptionHelp\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x10\n\x08required\x18\x03 \x01(\x08\x12\x15\n\rdefault_value\x18\x04 \x01(\t\x12\x0c\n\x04help\x18\x05 \x01(\t"\xc4\x01\n\x06Symbol\x12 \n\x02ty\x18\x01 \x01(\x0b\x32\x14.com.kcl.api.KclType\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\'\n\x05owner\x18\x03 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex\x12%\n\x03\x64\x65\x66\x18\x04 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex\x12\'\n\x05\x61ttrs\x18\x05 \x03(\x0b\x32\x18.com.kcl.api.SymbolIndex\x12\x11\n\tis_global\x18\x06 \x01(\x08"\xba\x01\n\x05Scope\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\'\n\x06parent\x18\x02 \x01(\x0b\x32\x17.com.kcl.api.ScopeIndex\x12\'\n\x05owner\x18\x03 \x01(\x0b\x32\x18.com.kcl.api.SymbolIndex\x12)\n\x08\x63hildren\x18\x04 \x03(\x0b\x32\x17.com.kcl.api.ScopeIndex\x12&\n\x04\x64\x65\x66s\x18\x05 \x03(\x0b\x32\x18.com.kcl.api.SymbolIndex"1\n\x0bSymbolIndex\x12\t\n\x01i\x18\x01 \x01(\x04\x12\t\n\x01g\x18\x02 \x01(\x04\x12\x0c\n\x04kind\x18\x03 \x01(\t"0\n\nScopeIndex\x12\t\n\x01i\x18\x01 \x01(\x04\x12\t\n\x01g\x18\x02 \x01(\x04\x12\x0c\n\x04kind\x18\x03 \x01(\t"\xf7\x03\n\x10\x45xecProgram_Args\x12\x10\n\x08work_dir\x18\x01 \x01(\t\x12\x17\n\x0fk_filename_list\x18\x02 \x03(\t\x12\x13\n\x0bk_code_list\x18\x03 \x03(\t\x12%\n\x04\x61rgs\x18\x04 \x03(\x0b\x32\x17.com.kcl.api.CmdArgSpec\x12/\n\toverrides\x18\x05 \x03(\x0b\x32\x1c.com.kcl.api.CmdOverrideSpec\x12\x1b\n\x13\x64isable_yaml_result\x18\x06 \x01(\x08\x12\x1a\n\x12print_override_ast\x18\x07 \x01(\x08\x12\x1a\n\x12strict_range_check\x18\x08 \x01(\x08\x12\x14\n\x0c\x64isable_none\x18\t \x01(\x08\x12\x0f\n\x07verbose\x18\n \x01(\x05\x12\r\n\x05\x64\x65\x62ug\x18\x0b \x01(\x05\x12\x11\n\tsort_keys\x18\x0c \x01(\x08\x12\x36\n\rexternal_pkgs\x18\r \x03(\x0b\x32\x1f.com.kcl.api.CmdExternalPkgSpec\x12 \n\x18include_schema_type_path\x18\x0e \x01(\x08\x12\x14\n\x0c\x63ompile_only\x18\x0f \x01(\x08\x12\x13\n\x0bshow_hidden\x18\x10 \x01(\x08\x12\x15\n\rpath_selector\x18\x11 \x03(\t\x12\x11\n\tfast_eval\x18\x12 \x01(\x08"h\n\x12\x45xecProgram_Result\x12\x13\n\x0bjson_result\x18\x01 \x01(\t\x12\x13\n\x0byaml_result\x18\x02 \x01(\t\x12\x13\n\x0blog_message\x18\x03 \x01(\t\x12\x13\n\x0b\x65rr_message\x18\x04 \x01(\t"U\n\x11\x42uildProgram_Args\x12\x30\n\texec_args\x18\x01 \x01(\x0b\x32\x1d.com.kcl.api.ExecProgram_Args\x12\x0e\n\x06output\x18\x02 \x01(\t"#\n\x13\x42uildProgram_Result\x12\x0c\n\x04path\x18\x01 \x01(\t"S\n\x11\x45xecArtifact_Args\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x30\n\texec_args\x18\x02 \x01(\x0b\x32\x1d.com.kcl.api.ExecProgram_Args"\'\n\x10ResetPlugin_Args\x12\x13\n\x0bplugin_root\x18\x01 \x01(\t"\x14\n\x12ResetPlugin_Result"!\n\x0f\x46ormatCode_Args\x12\x0e\n\x06source\x18\x01 \x01(\t"&\n\x11\x46ormatCode_Result\x12\x11\n\tformatted\x18\x01 \x01(\x0c"\x1f\n\x0f\x46ormatPath_Args\x12\x0c\n\x04path\x18\x01 \x01(\t"*\n\x11\x46ormatPath_Result\x12\x15\n\rchanged_paths\x18\x01 \x03(\t"\x1e\n\rLintPath_Args\x12\r\n\x05paths\x18\x01 \x03(\t""\n\x0fLintPath_Result\x12\x0f\n\x07results\x18\x01 \x03(\t"F\n\x11OverrideFile_Args\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\r\n\x05specs\x18\x02 \x03(\t\x12\x14\n\x0cimport_paths\x18\x03 \x03(\t"%\n\x13OverrideFile_Result\x12\x0e\n\x06result\x18\x01 \x01(\x08"1\n\x12ListVariables_Args\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\r\n\x05specs\x18\x02 \x03(\t"\xbf\x01\n\x14ListVariables_Result\x12\x43\n\tvariables\x18\x01 \x03(\x0b\x32\x30.com.kcl.api.ListVariables_Result.VariablesEntry\x12\x19\n\x11unsupported_codes\x18\x02 \x03(\t\x1aG\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.com.kcl.api.Variable:\x02\x38\x01"\x19\n\x08Variable\x12\r\n\x05value\x18\x01 \x01(\t"_\n\x16GetFullSchemaType_Args\x12\x30\n\texec_args\x18\x01 \x01(\x0b\x32\x1d.com.kcl.api.ExecProgram_Args\x12\x13\n\x0bschema_name\x18\x02 \x01(\t"E\n\x12GetSchemaType_Args\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12\x13\n\x0bschema_name\x18\x03 \x01(\t"F\n\x14GetSchemaType_Result\x12.\n\x10schema_type_list\x18\x01 \x03(\x0b\x32\x14.com.kcl.api.KclType"L\n\x19GetSchemaTypeMapping_Args\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\t\x12\x13\n\x0bschema_name\x18\x03 \x01(\t"\xcb\x01\n\x1bGetSchemaTypeMapping_Result\x12\\\n\x13schema_type_mapping\x18\x01 \x03(\x0b\x32?.com.kcl.api.GetSchemaTypeMapping_Result.SchemaTypeMappingEntry\x1aN\n\x16SchemaTypeMappingEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.com.kcl.api.KclType:\x02\x38\x01"\x87\x01\n\x11ValidateCode_Args\x12\x10\n\x08\x64\x61tafile\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\x12\x0c\n\x04\x66ile\x18\x03 \x01(\t\x12\x0c\n\x04\x63ode\x18\x04 \x01(\t\x12\x0e\n\x06schema\x18\x05 \x01(\t\x12\x16\n\x0e\x61ttribute_name\x18\x06 \x01(\t\x12\x0e\n\x06\x66ormat\x18\x07 \x01(\t";\n\x13ValidateCode_Result\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x13\n\x0b\x65rr_message\x18\x02 \x01(\t":\n\x08Position\x12\x0c\n\x04line\x18\x01 \x01(\x03\x12\x0e\n\x06\x63olumn\x18\x02 \x01(\x03\x12\x10\n\x08\x66ilename\x18\x03 \x01(\t"i\n\x11ListDepFiles_Args\x12\x10\n\x08work_dir\x18\x01 \x01(\t\x12\x14\n\x0cuse_abs_path\x18\x02 \x01(\x08\x12\x13\n\x0binclude_all\x18\x03 \x01(\x08\x12\x17\n\x0fuse_fast_parser\x18\x04 \x01(\x08"F\n\x13ListDepFiles_Result\x12\x0f\n\x07pkgroot\x18\x01 \x01(\t\x12\x0f\n\x07pkgpath\x18\x02 \x01(\t\x12\r\n\x05\x66iles\x18\x03 \x03(\t"9\n\x16LoadSettingsFiles_Args\x12\x10\n\x08work_dir\x18\x01 \x01(\t\x12\r\n\x05\x66iles\x18\x02 \x03(\t"{\n\x18LoadSettingsFiles_Result\x12/\n\x0fkcl_cli_configs\x18\x01 \x01(\x0b\x32\x16.com.kcl.api.CliConfig\x12.\n\x0bkcl_options\x18\x02 \x03(\x0b\x32\x19.com.kcl.api.KeyValuePair"\x83\x02\n\tCliConfig\x12\r\n\x05\x66iles\x18\x01 \x03(\t\x12\x0e\n\x06output\x18\x02 \x01(\t\x12\x11\n\toverrides\x18\x03 \x03(\t\x12\x15\n\rpath_selector\x18\x04 \x03(\t\x12\x1a\n\x12strict_range_check\x18\x05 \x01(\x08\x12\x14\n\x0c\x64isable_none\x18\x06 \x01(\x08\x12\x0f\n\x07verbose\x18\x07 \x01(\x03\x12\r\n\x05\x64\x65\x62ug\x18\x08 \x01(\x08\x12\x11\n\tsort_keys\x18\t \x01(\x08\x12\x13\n\x0bshow_hidden\x18\n \x01(\x08\x12 \n\x18include_schema_type_path\x18\x0b \x01(\x08\x12\x11\n\tfast_eval\x18\x0c \x01(\x08"*\n\x0cKeyValuePair\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"^\n\x0bRename_Args\x12\x14\n\x0cpackage_root\x18\x01 \x01(\t\x12\x13\n\x0bsymbol_path\x18\x02 \x01(\t\x12\x12\n\nfile_paths\x18\x03 \x03(\t\x12\x10\n\x08new_name\x18\x04 \x01(\t"&\n\rRename_Result\x12\x15\n\rchanged_files\x18\x01 \x03(\t"\xc7\x01\n\x0fRenameCode_Args\x12\x14\n\x0cpackage_root\x18\x01 \x01(\t\x12\x13\n\x0bsymbol_path\x18\x02 \x01(\t\x12\x43\n\x0csource_codes\x18\x03 \x03(\x0b\x32-.com.kcl.api.RenameCode_Args.SourceCodesEntry\x12\x10\n\x08new_name\x18\x04 \x01(\t\x1a\x32\n\x10SourceCodesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x91\x01\n\x11RenameCode_Result\x12G\n\rchanged_codes\x18\x01 \x03(\x0b\x32\x30.com.kcl.api.RenameCode_Result.ChangedCodesEntry\x1a\x33\n\x11\x43hangedCodesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"v\n\tTest_Args\x12\x30\n\texec_args\x18\x01 \x01(\x0b\x32\x1d.com.kcl.api.ExecProgram_Args\x12\x10\n\x08pkg_list\x18\x02 \x03(\t\x12\x12\n\nrun_regexp\x18\x03 \x01(\t\x12\x11\n\tfail_fast\x18\x04 \x01(\x08"6\n\x0bTest_Result\x12\'\n\x04info\x18\x02 \x03(\x0b\x32\x19.com.kcl.api.TestCaseInfo"R\n\x0cTestCaseInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x65rror\x18\x02 \x01(\t\x12\x10\n\x08\x64uration\x18\x03 \x01(\x04\x12\x13\n\x0blog_message\x18\x04 \x01(\t"\xc8\x04\n\x07KclType\x12\x0c\n\x04type\x18\x01 \x01(\t\x12)\n\x0bunion_types\x18\x02 \x03(\x0b\x32\x14.com.kcl.api.KclType\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x03 \x01(\t\x12\x13\n\x0bschema_name\x18\x04 \x01(\t\x12\x12\n\nschema_doc\x18\x05 \x01(\t\x12\x38\n\nproperties\x18\x06 \x03(\x0b\x32$.com.kcl.api.KclType.PropertiesEntry\x12\x10\n\x08required\x18\x07 \x03(\t\x12!\n\x03key\x18\x08 \x01(\x0b\x32\x14.com.kcl.api.KclType\x12"\n\x04item\x18\t \x01(\x0b\x32\x14.com.kcl.api.KclType\x12\x0c\n\x04line\x18\n \x01(\x05\x12*\n\ndecorators\x18\x0b \x03(\x0b\x32\x16.com.kcl.api.Decorator\x12\x10\n\x08\x66ilename\x18\x0c \x01(\t\x12\x10\n\x08pkg_path\x18\r \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x0e \x01(\t\x12\x34\n\x08\x65xamples\x18\x0f \x03(\x0b\x32".com.kcl.api.KclType.ExamplesEntry\x1aG\n\x0fPropertiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.com.kcl.api.KclType:\x02\x38\x01\x1a\x45\n\rExamplesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.com.kcl.api.Example:\x02\x38\x01"\x95\x01\n\tDecorator\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\targuments\x18\x02 \x03(\t\x12\x36\n\x08keywords\x18\x03 \x03(\x0b\x32$.com.kcl.api.Decorator.KeywordsEntry\x1a/\n\rKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01">\n\x07\x45xample\x12\x0f\n\x07summary\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t2\x96\x01\n\x0e\x42uiltinService\x12\x38\n\x04Ping\x12\x16.com.kcl.api.Ping_Args\x1a\x18.com.kcl.api.Ping_Result\x12J\n\nListMethod\x12\x1c.com.kcl.api.ListMethod_Args\x1a\x1e.com.kcl.api.ListMethod_Result2\xe0\r\n\x0cKclvmService\x12\x38\n\x04Ping\x12\x16.com.kcl.api.Ping_Args\x1a\x18.com.kcl.api.Ping_Result\x12M\n\x0b\x45xecProgram\x12\x1d.com.kcl.api.ExecProgram_Args\x1a\x1f.com.kcl.api.ExecProgram_Result\x12P\n\x0c\x42uildProgram\x12\x1e.com.kcl.api.BuildProgram_Args\x1a .com.kcl.api.BuildProgram_Result\x12O\n\x0c\x45xecArtifact\x12\x1e.com.kcl.api.ExecArtifact_Args\x1a\x1f.com.kcl.api.ExecProgram_Result\x12G\n\tParseFile\x12\x1b.com.kcl.api.ParseFile_Args\x1a\x1d.com.kcl.api.ParseFile_Result\x12P\n\x0cParseProgram\x12\x1e.com.kcl.api.ParseProgram_Args\x1a .com.kcl.api.ParseProgram_Result\x12M\n\x0bLoadPackage\x12\x1d.com.kcl.api.LoadPackage_Args\x1a\x1f.com.kcl.api.LoadPackage_Result\x12N\n\x0bListOptions\x12\x1e.com.kcl.api.ParseProgram_Args\x1a\x1f.com.kcl.api.ListOptions_Result\x12S\n\rListVariables\x12\x1f.com.kcl.api.ListVariables_Args\x1a!.com.kcl.api.ListVariables_Result\x12J\n\nFormatCode\x12\x1c.com.kcl.api.FormatCode_Args\x1a\x1e.com.kcl.api.FormatCode_Result\x12J\n\nFormatPath\x12\x1c.com.kcl.api.FormatPath_Args\x1a\x1e.com.kcl.api.FormatPath_Result\x12\x44\n\x08LintPath\x12\x1a.com.kcl.api.LintPath_Args\x1a\x1c.com.kcl.api.LintPath_Result\x12P\n\x0cOverrideFile\x12\x1e.com.kcl.api.OverrideFile_Args\x1a .com.kcl.api.OverrideFile_Result\x12S\n\rGetSchemaType\x12\x1f.com.kcl.api.GetSchemaType_Args\x1a!.com.kcl.api.GetSchemaType_Result\x12[\n\x11GetFullSchemaType\x12#.com.kcl.api.GetFullSchemaType_Args\x1a!.com.kcl.api.GetSchemaType_Result\x12h\n\x14GetSchemaTypeMapping\x12&.com.kcl.api.GetSchemaTypeMapping_Args\x1a(.com.kcl.api.GetSchemaTypeMapping_Result\x12P\n\x0cValidateCode\x12\x1e.com.kcl.api.ValidateCode_Args\x1a .com.kcl.api.ValidateCode_Result\x12P\n\x0cListDepFiles\x12\x1e.com.kcl.api.ListDepFiles_Args\x1a .com.kcl.api.ListDepFiles_Result\x12_\n\x11LoadSettingsFiles\x12#.com.kcl.api.LoadSettingsFiles_Args\x1a%.com.kcl.api.LoadSettingsFiles_Result\x12>\n\x06Rename\x12\x18.com.kcl.api.Rename_Args\x1a\x1a.com.kcl.api.Rename_Result\x12J\n\nRenameCode\x12\x1c.com.kcl.api.RenameCode_Args\x1a\x1e.com.kcl.api.RenameCode_Result\x12\x38\n\x04Test\x12\x16.com.kcl.api.Test_Args\x1a\x18.com.kcl.api.Test_Resultb\x06proto3' +) _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'spec_pb2', _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "spec_pb2", _globals) if _descriptor._USE_C_DESCRIPTORS == False: - DESCRIPTOR._options = None - _globals['_LOADPACKAGE_RESULT_SCOPESENTRY']._options = None - _globals['_LOADPACKAGE_RESULT_SCOPESENTRY']._serialized_options = b'8\001' - _globals['_LOADPACKAGE_RESULT_SYMBOLSENTRY']._options = None - _globals['_LOADPACKAGE_RESULT_SYMBOLSENTRY']._serialized_options = b'8\001' - _globals['_LOADPACKAGE_RESULT_NODESYMBOLMAPENTRY']._options = None - _globals['_LOADPACKAGE_RESULT_NODESYMBOLMAPENTRY']._serialized_options = b'8\001' - _globals['_LOADPACKAGE_RESULT_SYMBOLNODEMAPENTRY']._options = None - _globals['_LOADPACKAGE_RESULT_SYMBOLNODEMAPENTRY']._serialized_options = b'8\001' - _globals['_LOADPACKAGE_RESULT_FULLYQUALIFIEDNAMEMAPENTRY']._options = None - _globals['_LOADPACKAGE_RESULT_FULLYQUALIFIEDNAMEMAPENTRY']._serialized_options = b'8\001' - _globals['_LOADPACKAGE_RESULT_PKGSCOPEMAPENTRY']._options = None - _globals['_LOADPACKAGE_RESULT_PKGSCOPEMAPENTRY']._serialized_options = b'8\001' - _globals['_LISTVARIABLES_RESULT_VARIABLESENTRY']._options = None - _globals['_LISTVARIABLES_RESULT_VARIABLESENTRY']._serialized_options = b'8\001' - _globals['_GETSCHEMATYPEMAPPING_RESULT_SCHEMATYPEMAPPINGENTRY']._options = None - _globals['_GETSCHEMATYPEMAPPING_RESULT_SCHEMATYPEMAPPINGENTRY']._serialized_options = b'8\001' - _globals['_RENAMECODE_ARGS_SOURCECODESENTRY']._options = None - _globals['_RENAMECODE_ARGS_SOURCECODESENTRY']._serialized_options = b'8\001' - _globals['_RENAMECODE_RESULT_CHANGEDCODESENTRY']._options = None - _globals['_RENAMECODE_RESULT_CHANGEDCODESENTRY']._serialized_options = b'8\001' - _globals['_KCLTYPE_PROPERTIESENTRY']._options = None - _globals['_KCLTYPE_PROPERTIESENTRY']._serialized_options = b'8\001' - _globals['_KCLTYPE_EXAMPLESENTRY']._options = None - _globals['_KCLTYPE_EXAMPLESENTRY']._serialized_options = b'8\001' - _globals['_DECORATOR_KEYWORDSENTRY']._options = None - _globals['_DECORATOR_KEYWORDSENTRY']._serialized_options = b'8\001' - _globals['_CMDEXTERNALPKGSPEC']._serialized_start=27 - _globals['_CMDEXTERNALPKGSPEC']._serialized_end=83 - _globals['_CMDARGSPEC']._serialized_start=85 - _globals['_CMDARGSPEC']._serialized_end=126 - _globals['_CMDOVERRIDESPEC']._serialized_start=128 - _globals['_CMDOVERRIDESPEC']._serialized_end=219 - _globals['_ERROR']._serialized_start=221 - _globals['_ERROR']._serialized_end=297 - _globals['_MESSAGE']._serialized_start=299 - _globals['_MESSAGE']._serialized_end=357 - _globals['_PING_ARGS']._serialized_start=359 - _globals['_PING_ARGS']._serialized_end=385 - _globals['_PING_RESULT']._serialized_start=387 - _globals['_PING_RESULT']._serialized_end=415 - _globals['_LISTMETHOD_ARGS']._serialized_start=417 - _globals['_LISTMETHOD_ARGS']._serialized_end=434 - _globals['_LISTMETHOD_RESULT']._serialized_start=436 - _globals['_LISTMETHOD_RESULT']._serialized_end=481 - _globals['_PARSEFILE_ARGS']._serialized_start=483 - _globals['_PARSEFILE_ARGS']._serialized_end=585 - _globals['_PARSEFILE_RESULT']._serialized_start=587 - _globals['_PARSEFILE_RESULT']._serialized_end=673 - _globals['_PARSEPROGRAM_ARGS']._serialized_start=675 - _globals['_PARSEPROGRAM_ARGS']._serialized_end=782 - _globals['_PARSEPROGRAM_RESULT']._serialized_start=784 - _globals['_PARSEPROGRAM_RESULT']._serialized_end=874 - _globals['_LOADPACKAGE_ARGS']._serialized_start=877 - _globals['_LOADPACKAGE_ARGS']._serialized_end=1014 - _globals['_LOADPACKAGE_RESULT']._serialized_start=1017 - _globals['_LOADPACKAGE_RESULT']._serialized_end=2032 - _globals['_LOADPACKAGE_RESULT_SCOPESENTRY']._serialized_start=1599 - _globals['_LOADPACKAGE_RESULT_SCOPESENTRY']._serialized_end=1664 - _globals['_LOADPACKAGE_RESULT_SYMBOLSENTRY']._serialized_start=1666 - _globals['_LOADPACKAGE_RESULT_SYMBOLSENTRY']._serialized_end=1733 - _globals['_LOADPACKAGE_RESULT_NODESYMBOLMAPENTRY']._serialized_start=1735 - _globals['_LOADPACKAGE_RESULT_NODESYMBOLMAPENTRY']._serialized_end=1813 - _globals['_LOADPACKAGE_RESULT_SYMBOLNODEMAPENTRY']._serialized_start=1815 - _globals['_LOADPACKAGE_RESULT_SYMBOLNODEMAPENTRY']._serialized_end=1867 - _globals['_LOADPACKAGE_RESULT_FULLYQUALIFIEDNAMEMAPENTRY']._serialized_start=1869 - _globals['_LOADPACKAGE_RESULT_FULLYQUALIFIEDNAMEMAPENTRY']._serialized_end=1955 - _globals['_LOADPACKAGE_RESULT_PKGSCOPEMAPENTRY']._serialized_start=1957 - _globals['_LOADPACKAGE_RESULT_PKGSCOPEMAPENTRY']._serialized_end=2032 - _globals['_LISTOPTIONS_RESULT']._serialized_start=2034 - _globals['_LISTOPTIONS_RESULT']._serialized_end=2096 - _globals['_OPTIONHELP']._serialized_start=2098 - _globals['_OPTIONHELP']._serialized_end=2193 - _globals['_SYMBOL']._serialized_start=2196 - _globals['_SYMBOL']._serialized_end=2392 - _globals['_SCOPE']._serialized_start=2395 - _globals['_SCOPE']._serialized_end=2581 - _globals['_SYMBOLINDEX']._serialized_start=2583 - _globals['_SYMBOLINDEX']._serialized_end=2632 - _globals['_SCOPEINDEX']._serialized_start=2634 - _globals['_SCOPEINDEX']._serialized_end=2682 - _globals['_EXECPROGRAM_ARGS']._serialized_start=2685 - _globals['_EXECPROGRAM_ARGS']._serialized_end=3188 - _globals['_EXECPROGRAM_RESULT']._serialized_start=3190 - _globals['_EXECPROGRAM_RESULT']._serialized_end=3294 - _globals['_BUILDPROGRAM_ARGS']._serialized_start=3296 - _globals['_BUILDPROGRAM_ARGS']._serialized_end=3381 - _globals['_BUILDPROGRAM_RESULT']._serialized_start=3383 - _globals['_BUILDPROGRAM_RESULT']._serialized_end=3418 - _globals['_EXECARTIFACT_ARGS']._serialized_start=3420 - _globals['_EXECARTIFACT_ARGS']._serialized_end=3503 - _globals['_RESETPLUGIN_ARGS']._serialized_start=3505 - _globals['_RESETPLUGIN_ARGS']._serialized_end=3544 - _globals['_RESETPLUGIN_RESULT']._serialized_start=3546 - _globals['_RESETPLUGIN_RESULT']._serialized_end=3566 - _globals['_FORMATCODE_ARGS']._serialized_start=3568 - _globals['_FORMATCODE_ARGS']._serialized_end=3601 - _globals['_FORMATCODE_RESULT']._serialized_start=3603 - _globals['_FORMATCODE_RESULT']._serialized_end=3641 - _globals['_FORMATPATH_ARGS']._serialized_start=3643 - _globals['_FORMATPATH_ARGS']._serialized_end=3674 - _globals['_FORMATPATH_RESULT']._serialized_start=3676 - _globals['_FORMATPATH_RESULT']._serialized_end=3718 - _globals['_LINTPATH_ARGS']._serialized_start=3720 - _globals['_LINTPATH_ARGS']._serialized_end=3750 - _globals['_LINTPATH_RESULT']._serialized_start=3752 - _globals['_LINTPATH_RESULT']._serialized_end=3786 - _globals['_OVERRIDEFILE_ARGS']._serialized_start=3788 - _globals['_OVERRIDEFILE_ARGS']._serialized_end=3858 - _globals['_OVERRIDEFILE_RESULT']._serialized_start=3860 - _globals['_OVERRIDEFILE_RESULT']._serialized_end=3897 - _globals['_LISTVARIABLES_ARGS']._serialized_start=3899 - _globals['_LISTVARIABLES_ARGS']._serialized_end=3948 - _globals['_LISTVARIABLES_RESULT']._serialized_start=3951 - _globals['_LISTVARIABLES_RESULT']._serialized_end=4142 - _globals['_LISTVARIABLES_RESULT_VARIABLESENTRY']._serialized_start=4071 - _globals['_LISTVARIABLES_RESULT_VARIABLESENTRY']._serialized_end=4142 - _globals['_VARIABLE']._serialized_start=4144 - _globals['_VARIABLE']._serialized_end=4169 - _globals['_GETFULLSCHEMATYPE_ARGS']._serialized_start=4171 - _globals['_GETFULLSCHEMATYPE_ARGS']._serialized_end=4266 - _globals['_GETSCHEMATYPE_ARGS']._serialized_start=4268 - _globals['_GETSCHEMATYPE_ARGS']._serialized_end=4337 - _globals['_GETSCHEMATYPE_RESULT']._serialized_start=4339 - _globals['_GETSCHEMATYPE_RESULT']._serialized_end=4409 - _globals['_GETSCHEMATYPEMAPPING_ARGS']._serialized_start=4411 - _globals['_GETSCHEMATYPEMAPPING_ARGS']._serialized_end=4487 - _globals['_GETSCHEMATYPEMAPPING_RESULT']._serialized_start=4490 - _globals['_GETSCHEMATYPEMAPPING_RESULT']._serialized_end=4693 - _globals['_GETSCHEMATYPEMAPPING_RESULT_SCHEMATYPEMAPPINGENTRY']._serialized_start=4615 - _globals['_GETSCHEMATYPEMAPPING_RESULT_SCHEMATYPEMAPPINGENTRY']._serialized_end=4693 - _globals['_VALIDATECODE_ARGS']._serialized_start=4696 - _globals['_VALIDATECODE_ARGS']._serialized_end=4831 - _globals['_VALIDATECODE_RESULT']._serialized_start=4833 - _globals['_VALIDATECODE_RESULT']._serialized_end=4892 - _globals['_POSITION']._serialized_start=4894 - _globals['_POSITION']._serialized_end=4952 - _globals['_LISTDEPFILES_ARGS']._serialized_start=4954 - _globals['_LISTDEPFILES_ARGS']._serialized_end=5059 - _globals['_LISTDEPFILES_RESULT']._serialized_start=5061 - _globals['_LISTDEPFILES_RESULT']._serialized_end=5131 - _globals['_LOADSETTINGSFILES_ARGS']._serialized_start=5133 - _globals['_LOADSETTINGSFILES_ARGS']._serialized_end=5190 - _globals['_LOADSETTINGSFILES_RESULT']._serialized_start=5192 - _globals['_LOADSETTINGSFILES_RESULT']._serialized_end=5315 - _globals['_CLICONFIG']._serialized_start=5318 - _globals['_CLICONFIG']._serialized_end=5577 - _globals['_KEYVALUEPAIR']._serialized_start=5579 - _globals['_KEYVALUEPAIR']._serialized_end=5621 - _globals['_RENAME_ARGS']._serialized_start=5623 - _globals['_RENAME_ARGS']._serialized_end=5717 - _globals['_RENAME_RESULT']._serialized_start=5719 - _globals['_RENAME_RESULT']._serialized_end=5757 - _globals['_RENAMECODE_ARGS']._serialized_start=5760 - _globals['_RENAMECODE_ARGS']._serialized_end=5959 - _globals['_RENAMECODE_ARGS_SOURCECODESENTRY']._serialized_start=5909 - _globals['_RENAMECODE_ARGS_SOURCECODESENTRY']._serialized_end=5959 - _globals['_RENAMECODE_RESULT']._serialized_start=5962 - _globals['_RENAMECODE_RESULT']._serialized_end=6107 - _globals['_RENAMECODE_RESULT_CHANGEDCODESENTRY']._serialized_start=6056 - _globals['_RENAMECODE_RESULT_CHANGEDCODESENTRY']._serialized_end=6107 - _globals['_TEST_ARGS']._serialized_start=6109 - _globals['_TEST_ARGS']._serialized_end=6227 - _globals['_TEST_RESULT']._serialized_start=6229 - _globals['_TEST_RESULT']._serialized_end=6283 - _globals['_TESTCASEINFO']._serialized_start=6285 - _globals['_TESTCASEINFO']._serialized_end=6367 - _globals['_KCLTYPE']._serialized_start=6370 - _globals['_KCLTYPE']._serialized_end=6954 - _globals['_KCLTYPE_PROPERTIESENTRY']._serialized_start=6812 - _globals['_KCLTYPE_PROPERTIESENTRY']._serialized_end=6883 - _globals['_KCLTYPE_EXAMPLESENTRY']._serialized_start=6885 - _globals['_KCLTYPE_EXAMPLESENTRY']._serialized_end=6954 - _globals['_DECORATOR']._serialized_start=6957 - _globals['_DECORATOR']._serialized_end=7106 - _globals['_DECORATOR_KEYWORDSENTRY']._serialized_start=7059 - _globals['_DECORATOR_KEYWORDSENTRY']._serialized_end=7106 - _globals['_EXAMPLE']._serialized_start=7108 - _globals['_EXAMPLE']._serialized_end=7170 - _globals['_BUILTINSERVICE']._serialized_start=7173 - _globals['_BUILTINSERVICE']._serialized_end=7323 - _globals['_KCLVMSERVICE']._serialized_start=7326 - _globals['_KCLVMSERVICE']._serialized_end=9086 + DESCRIPTOR._options = None + _globals["_LOADPACKAGE_RESULT_SCOPESENTRY"]._options = None + _globals["_LOADPACKAGE_RESULT_SCOPESENTRY"]._serialized_options = b"8\001" + _globals["_LOADPACKAGE_RESULT_SYMBOLSENTRY"]._options = None + _globals["_LOADPACKAGE_RESULT_SYMBOLSENTRY"]._serialized_options = b"8\001" + _globals["_LOADPACKAGE_RESULT_NODESYMBOLMAPENTRY"]._options = None + _globals["_LOADPACKAGE_RESULT_NODESYMBOLMAPENTRY"]._serialized_options = b"8\001" + _globals["_LOADPACKAGE_RESULT_SYMBOLNODEMAPENTRY"]._options = None + _globals["_LOADPACKAGE_RESULT_SYMBOLNODEMAPENTRY"]._serialized_options = b"8\001" + _globals["_LOADPACKAGE_RESULT_FULLYQUALIFIEDNAMEMAPENTRY"]._options = None + _globals["_LOADPACKAGE_RESULT_FULLYQUALIFIEDNAMEMAPENTRY"]._serialized_options = ( + b"8\001" + ) + _globals["_LOADPACKAGE_RESULT_PKGSCOPEMAPENTRY"]._options = None + _globals["_LOADPACKAGE_RESULT_PKGSCOPEMAPENTRY"]._serialized_options = b"8\001" + _globals["_LISTVARIABLES_RESULT_VARIABLESENTRY"]._options = None + _globals["_LISTVARIABLES_RESULT_VARIABLESENTRY"]._serialized_options = b"8\001" + _globals["_GETSCHEMATYPEMAPPING_RESULT_SCHEMATYPEMAPPINGENTRY"]._options = None + _globals[ + "_GETSCHEMATYPEMAPPING_RESULT_SCHEMATYPEMAPPINGENTRY" + ]._serialized_options = b"8\001" + _globals["_RENAMECODE_ARGS_SOURCECODESENTRY"]._options = None + _globals["_RENAMECODE_ARGS_SOURCECODESENTRY"]._serialized_options = b"8\001" + _globals["_RENAMECODE_RESULT_CHANGEDCODESENTRY"]._options = None + _globals["_RENAMECODE_RESULT_CHANGEDCODESENTRY"]._serialized_options = b"8\001" + _globals["_KCLTYPE_PROPERTIESENTRY"]._options = None + _globals["_KCLTYPE_PROPERTIESENTRY"]._serialized_options = b"8\001" + _globals["_KCLTYPE_EXAMPLESENTRY"]._options = None + _globals["_KCLTYPE_EXAMPLESENTRY"]._serialized_options = b"8\001" + _globals["_DECORATOR_KEYWORDSENTRY"]._options = None + _globals["_DECORATOR_KEYWORDSENTRY"]._serialized_options = b"8\001" + _globals["_CMDEXTERNALPKGSPEC"]._serialized_start = 27 + _globals["_CMDEXTERNALPKGSPEC"]._serialized_end = 83 + _globals["_CMDARGSPEC"]._serialized_start = 85 + _globals["_CMDARGSPEC"]._serialized_end = 126 + _globals["_CMDOVERRIDESPEC"]._serialized_start = 128 + _globals["_CMDOVERRIDESPEC"]._serialized_end = 219 + _globals["_ERROR"]._serialized_start = 221 + _globals["_ERROR"]._serialized_end = 297 + _globals["_MESSAGE"]._serialized_start = 299 + _globals["_MESSAGE"]._serialized_end = 357 + _globals["_PING_ARGS"]._serialized_start = 359 + _globals["_PING_ARGS"]._serialized_end = 385 + _globals["_PING_RESULT"]._serialized_start = 387 + _globals["_PING_RESULT"]._serialized_end = 415 + _globals["_LISTMETHOD_ARGS"]._serialized_start = 417 + _globals["_LISTMETHOD_ARGS"]._serialized_end = 434 + _globals["_LISTMETHOD_RESULT"]._serialized_start = 436 + _globals["_LISTMETHOD_RESULT"]._serialized_end = 481 + _globals["_PARSEFILE_ARGS"]._serialized_start = 483 + _globals["_PARSEFILE_ARGS"]._serialized_end = 585 + _globals["_PARSEFILE_RESULT"]._serialized_start = 587 + _globals["_PARSEFILE_RESULT"]._serialized_end = 673 + _globals["_PARSEPROGRAM_ARGS"]._serialized_start = 675 + _globals["_PARSEPROGRAM_ARGS"]._serialized_end = 782 + _globals["_PARSEPROGRAM_RESULT"]._serialized_start = 784 + _globals["_PARSEPROGRAM_RESULT"]._serialized_end = 874 + _globals["_LOADPACKAGE_ARGS"]._serialized_start = 877 + _globals["_LOADPACKAGE_ARGS"]._serialized_end = 1014 + _globals["_LOADPACKAGE_RESULT"]._serialized_start = 1017 + _globals["_LOADPACKAGE_RESULT"]._serialized_end = 2032 + _globals["_LOADPACKAGE_RESULT_SCOPESENTRY"]._serialized_start = 1599 + _globals["_LOADPACKAGE_RESULT_SCOPESENTRY"]._serialized_end = 1664 + _globals["_LOADPACKAGE_RESULT_SYMBOLSENTRY"]._serialized_start = 1666 + _globals["_LOADPACKAGE_RESULT_SYMBOLSENTRY"]._serialized_end = 1733 + _globals["_LOADPACKAGE_RESULT_NODESYMBOLMAPENTRY"]._serialized_start = 1735 + _globals["_LOADPACKAGE_RESULT_NODESYMBOLMAPENTRY"]._serialized_end = 1813 + _globals["_LOADPACKAGE_RESULT_SYMBOLNODEMAPENTRY"]._serialized_start = 1815 + _globals["_LOADPACKAGE_RESULT_SYMBOLNODEMAPENTRY"]._serialized_end = 1867 + _globals["_LOADPACKAGE_RESULT_FULLYQUALIFIEDNAMEMAPENTRY"]._serialized_start = 1869 + _globals["_LOADPACKAGE_RESULT_FULLYQUALIFIEDNAMEMAPENTRY"]._serialized_end = 1955 + _globals["_LOADPACKAGE_RESULT_PKGSCOPEMAPENTRY"]._serialized_start = 1957 + _globals["_LOADPACKAGE_RESULT_PKGSCOPEMAPENTRY"]._serialized_end = 2032 + _globals["_LISTOPTIONS_RESULT"]._serialized_start = 2034 + _globals["_LISTOPTIONS_RESULT"]._serialized_end = 2096 + _globals["_OPTIONHELP"]._serialized_start = 2098 + _globals["_OPTIONHELP"]._serialized_end = 2193 + _globals["_SYMBOL"]._serialized_start = 2196 + _globals["_SYMBOL"]._serialized_end = 2392 + _globals["_SCOPE"]._serialized_start = 2395 + _globals["_SCOPE"]._serialized_end = 2581 + _globals["_SYMBOLINDEX"]._serialized_start = 2583 + _globals["_SYMBOLINDEX"]._serialized_end = 2632 + _globals["_SCOPEINDEX"]._serialized_start = 2634 + _globals["_SCOPEINDEX"]._serialized_end = 2682 + _globals["_EXECPROGRAM_ARGS"]._serialized_start = 2685 + _globals["_EXECPROGRAM_ARGS"]._serialized_end = 3188 + _globals["_EXECPROGRAM_RESULT"]._serialized_start = 3190 + _globals["_EXECPROGRAM_RESULT"]._serialized_end = 3294 + _globals["_BUILDPROGRAM_ARGS"]._serialized_start = 3296 + _globals["_BUILDPROGRAM_ARGS"]._serialized_end = 3381 + _globals["_BUILDPROGRAM_RESULT"]._serialized_start = 3383 + _globals["_BUILDPROGRAM_RESULT"]._serialized_end = 3418 + _globals["_EXECARTIFACT_ARGS"]._serialized_start = 3420 + _globals["_EXECARTIFACT_ARGS"]._serialized_end = 3503 + _globals["_RESETPLUGIN_ARGS"]._serialized_start = 3505 + _globals["_RESETPLUGIN_ARGS"]._serialized_end = 3544 + _globals["_RESETPLUGIN_RESULT"]._serialized_start = 3546 + _globals["_RESETPLUGIN_RESULT"]._serialized_end = 3566 + _globals["_FORMATCODE_ARGS"]._serialized_start = 3568 + _globals["_FORMATCODE_ARGS"]._serialized_end = 3601 + _globals["_FORMATCODE_RESULT"]._serialized_start = 3603 + _globals["_FORMATCODE_RESULT"]._serialized_end = 3641 + _globals["_FORMATPATH_ARGS"]._serialized_start = 3643 + _globals["_FORMATPATH_ARGS"]._serialized_end = 3674 + _globals["_FORMATPATH_RESULT"]._serialized_start = 3676 + _globals["_FORMATPATH_RESULT"]._serialized_end = 3718 + _globals["_LINTPATH_ARGS"]._serialized_start = 3720 + _globals["_LINTPATH_ARGS"]._serialized_end = 3750 + _globals["_LINTPATH_RESULT"]._serialized_start = 3752 + _globals["_LINTPATH_RESULT"]._serialized_end = 3786 + _globals["_OVERRIDEFILE_ARGS"]._serialized_start = 3788 + _globals["_OVERRIDEFILE_ARGS"]._serialized_end = 3858 + _globals["_OVERRIDEFILE_RESULT"]._serialized_start = 3860 + _globals["_OVERRIDEFILE_RESULT"]._serialized_end = 3897 + _globals["_LISTVARIABLES_ARGS"]._serialized_start = 3899 + _globals["_LISTVARIABLES_ARGS"]._serialized_end = 3948 + _globals["_LISTVARIABLES_RESULT"]._serialized_start = 3951 + _globals["_LISTVARIABLES_RESULT"]._serialized_end = 4142 + _globals["_LISTVARIABLES_RESULT_VARIABLESENTRY"]._serialized_start = 4071 + _globals["_LISTVARIABLES_RESULT_VARIABLESENTRY"]._serialized_end = 4142 + _globals["_VARIABLE"]._serialized_start = 4144 + _globals["_VARIABLE"]._serialized_end = 4169 + _globals["_GETFULLSCHEMATYPE_ARGS"]._serialized_start = 4171 + _globals["_GETFULLSCHEMATYPE_ARGS"]._serialized_end = 4266 + _globals["_GETSCHEMATYPE_ARGS"]._serialized_start = 4268 + _globals["_GETSCHEMATYPE_ARGS"]._serialized_end = 4337 + _globals["_GETSCHEMATYPE_RESULT"]._serialized_start = 4339 + _globals["_GETSCHEMATYPE_RESULT"]._serialized_end = 4409 + _globals["_GETSCHEMATYPEMAPPING_ARGS"]._serialized_start = 4411 + _globals["_GETSCHEMATYPEMAPPING_ARGS"]._serialized_end = 4487 + _globals["_GETSCHEMATYPEMAPPING_RESULT"]._serialized_start = 4490 + _globals["_GETSCHEMATYPEMAPPING_RESULT"]._serialized_end = 4693 + _globals[ + "_GETSCHEMATYPEMAPPING_RESULT_SCHEMATYPEMAPPINGENTRY" + ]._serialized_start = 4615 + _globals["_GETSCHEMATYPEMAPPING_RESULT_SCHEMATYPEMAPPINGENTRY"]._serialized_end = ( + 4693 + ) + _globals["_VALIDATECODE_ARGS"]._serialized_start = 4696 + _globals["_VALIDATECODE_ARGS"]._serialized_end = 4831 + _globals["_VALIDATECODE_RESULT"]._serialized_start = 4833 + _globals["_VALIDATECODE_RESULT"]._serialized_end = 4892 + _globals["_POSITION"]._serialized_start = 4894 + _globals["_POSITION"]._serialized_end = 4952 + _globals["_LISTDEPFILES_ARGS"]._serialized_start = 4954 + _globals["_LISTDEPFILES_ARGS"]._serialized_end = 5059 + _globals["_LISTDEPFILES_RESULT"]._serialized_start = 5061 + _globals["_LISTDEPFILES_RESULT"]._serialized_end = 5131 + _globals["_LOADSETTINGSFILES_ARGS"]._serialized_start = 5133 + _globals["_LOADSETTINGSFILES_ARGS"]._serialized_end = 5190 + _globals["_LOADSETTINGSFILES_RESULT"]._serialized_start = 5192 + _globals["_LOADSETTINGSFILES_RESULT"]._serialized_end = 5315 + _globals["_CLICONFIG"]._serialized_start = 5318 + _globals["_CLICONFIG"]._serialized_end = 5577 + _globals["_KEYVALUEPAIR"]._serialized_start = 5579 + _globals["_KEYVALUEPAIR"]._serialized_end = 5621 + _globals["_RENAME_ARGS"]._serialized_start = 5623 + _globals["_RENAME_ARGS"]._serialized_end = 5717 + _globals["_RENAME_RESULT"]._serialized_start = 5719 + _globals["_RENAME_RESULT"]._serialized_end = 5757 + _globals["_RENAMECODE_ARGS"]._serialized_start = 5760 + _globals["_RENAMECODE_ARGS"]._serialized_end = 5959 + _globals["_RENAMECODE_ARGS_SOURCECODESENTRY"]._serialized_start = 5909 + _globals["_RENAMECODE_ARGS_SOURCECODESENTRY"]._serialized_end = 5959 + _globals["_RENAMECODE_RESULT"]._serialized_start = 5962 + _globals["_RENAMECODE_RESULT"]._serialized_end = 6107 + _globals["_RENAMECODE_RESULT_CHANGEDCODESENTRY"]._serialized_start = 6056 + _globals["_RENAMECODE_RESULT_CHANGEDCODESENTRY"]._serialized_end = 6107 + _globals["_TEST_ARGS"]._serialized_start = 6109 + _globals["_TEST_ARGS"]._serialized_end = 6227 + _globals["_TEST_RESULT"]._serialized_start = 6229 + _globals["_TEST_RESULT"]._serialized_end = 6283 + _globals["_TESTCASEINFO"]._serialized_start = 6285 + _globals["_TESTCASEINFO"]._serialized_end = 6367 + _globals["_KCLTYPE"]._serialized_start = 6370 + _globals["_KCLTYPE"]._serialized_end = 6954 + _globals["_KCLTYPE_PROPERTIESENTRY"]._serialized_start = 6812 + _globals["_KCLTYPE_PROPERTIESENTRY"]._serialized_end = 6883 + _globals["_KCLTYPE_EXAMPLESENTRY"]._serialized_start = 6885 + _globals["_KCLTYPE_EXAMPLESENTRY"]._serialized_end = 6954 + _globals["_DECORATOR"]._serialized_start = 6957 + _globals["_DECORATOR"]._serialized_end = 7106 + _globals["_DECORATOR_KEYWORDSENTRY"]._serialized_start = 7059 + _globals["_DECORATOR_KEYWORDSENTRY"]._serialized_end = 7106 + _globals["_EXAMPLE"]._serialized_start = 7108 + _globals["_EXAMPLE"]._serialized_end = 7170 + _globals["_BUILTINSERVICE"]._serialized_start = 7173 + _globals["_BUILTINSERVICE"]._serialized_end = 7323 + _globals["_KCLVMSERVICE"]._serialized_start = 7326 + _globals["_KCLVMSERVICE"]._serialized_end = 9086 # @@protoc_insertion_point(module_scope) diff --git a/python/kcl_lib/bootstrap/__init__.py b/python/kcl_lib/bootstrap/__init__.py deleted file mode 100644 index 54336d5b..00000000 --- a/python/kcl_lib/bootstrap/__init__.py +++ /dev/null @@ -1,74 +0,0 @@ -import os -import sys -import platform -from pathlib import Path - -KCLVM_VERSION = "0.8.4" # You should replace this with actual version -KCLVM_CLI_BIN_PATH_ENV_VAR = "KCLVM_CLI_BIN_PATH" -KCLVM_CLI_INSTALL_PATH_ENV_VAR = "KCLVM_CLI_INSTALL_PATH" -KCLVM_CLI_USE_TEST_ENV_VAR = "KCLVM_CLI_USE_TEST" -LIB_NAME = "kclvm_cli_cdylib" - - -def lib_full_name(): - if sys.platform == "darwin": - return f"lib{LIB_NAME}.dylib" - elif sys.platform == "win32": - return f"{LIB_NAME}.dll" - else: - return f"lib{LIB_NAME}.so" - - -def write_lib(lib_dir, lib_full_name, content, version_matched): - lib_full_path = lib_dir / lib_full_name - if lib_full_path.exists() and version_matched: - return - lib_dir.mkdir(parents=True, exist_ok=True) - with lib_full_path.open("wb") as lib_file: - lib_file.write(content) - - -def install_lib(lib_dir, lib_name, version_matched): - # You would implement the cli_lib and export_lib functions based on your specific case - from .artifact import cli_lib - - if sys.platform == "win32": - from .artifact import export_lib - - write_lib(lib_dir, f"{lib_name}.dll", cli_lib(), version_matched) - write_lib(lib_dir, f"{lib_name}.lib", export_lib(), version_matched) - else: - write_lib(lib_dir, lib_full_name(), cli_lib(), version_matched) - - -def get_version(): - return f"{KCLVM_VERSION}-{sys.platform}-{platform.machine()}" - - -def check_version(kclvm_version_dir): - kclvm_version_path = kclvm_version_dir / "kclvm.version" - if not kclvm_version_path.exists(): - kclvm_version_dir.mkdir(parents=True, exist_ok=True) - with kclvm_version_path.open("w") as version_file: - version_file.write(get_version()) - return False - with kclvm_version_path.open("r") as version_file: - version = version_file.read().strip() - return get_version() == version - - -def install_kclvm(install_root): - install_root = Path(install_root).resolve() - bin_path = install_root / "bin" - version_matched = check_version(bin_path) - install_lib(bin_path, LIB_NAME, version_matched) - if not version_matched: - kclvm_version_path = bin_path / "kclvm.version" - with kclvm_version_path.open("w") as file: - file.write(get_version()) - - path_env = os.environ.get("PATH", "") - bin_path_str = str(bin_path) - new_path_env = f"{path_env}{os.pathsep}{bin_path_str}" - os.environ["PATH"] = new_path_env - os.environ[KCLVM_CLI_BIN_PATH_ENV_VAR] = bin_path_str diff --git a/python/kcl_lib/bootstrap/artifact.py b/python/kcl_lib/bootstrap/artifact.py deleted file mode 100644 index ea3245cb..00000000 --- a/python/kcl_lib/bootstrap/artifact.py +++ /dev/null @@ -1,95 +0,0 @@ -import platform -import sys -import pathlib -import os - -_lib_root = os.environ.get("KCL_LIB_ROOT") -if _lib_root: - LIB_ROOT = pathlib.Path(_lib_root) -else: - # Test Lib ROOT - TEST_LIB_ROOT = pathlib.Path(__file__).parent.parent.parent.parent - LIB_ROOT = TEST_LIB_ROOT - if not TEST_LIB_ROOT.joinpath("lib").exists(): - LIB_ROOT = pathlib.Path(__file__).parent.parent - - -def is_amd64_arch(): - return platform.machine() in ["x86_64", "amd64", "AMD64"] - - -if sys.platform == "darwin": - - def cli_lib(): - if is_amd64_arch(): - with open( - f"{LIB_ROOT}/lib/darwin-amd64/libkclvm_cli_cdylib.dylib", "rb" - ) as f: - DARWIN_AMD64_CLI_LIB = f.read() - else: - with open( - f"{LIB_ROOT}/lib/darwin-arm64/libkclvm_cli_cdylib.dylib", "rb" - ) as f: - DARWIN_ARM64_CLI_LIB = f.read() - return DARWIN_AMD64_CLI_LIB if is_amd64_arch() else DARWIN_ARM64_CLI_LIB - - def lib_path() -> str: - if is_amd64_arch(): - return str(LIB_ROOT.joinpath("lib").joinpath("darwin-amd64")) - return str(LIB_ROOT.joinpath("lib").joinpath("darwin-arm64")) - - def lib_name() -> str: - return "libkclvm_cli_cdylib.dylib" - -elif sys.platform.startswith("linux"): - - def cli_lib(): - if is_amd64_arch(): - with open(f"{LIB_ROOT}/lib/linux-amd64/libkclvm_cli_cdylib.so", "rb") as f: - LINUX_AMD64_CLI_LIB = f.read() - else: - with open(f"{LIB_ROOT}/lib/linux-arm64/libkclvm_cli_cdylib.so", "rb") as f: - LINUX_ARM64_CLI_LIB = f.read() - return LINUX_AMD64_CLI_LIB if is_amd64_arch() else LINUX_ARM64_CLI_LIB - - def lib_path() -> str: - if is_amd64_arch(): - return str(LIB_ROOT.joinpath("lib").joinpath("linux-amd64")) - return str(LIB_ROOT.joinpath("lib").joinpath("linux-arm64")) - - def lib_name() -> str: - return "libkclvm_cli_cdylib.so" - -elif sys.platform == "win32": - - def cli_lib(): - if is_amd64_arch(): - with open(f"{LIB_ROOT}/lib/windows-amd64/kclvm_cli_cdylib.dll", "rb") as f: - WINDOWS_AMD64_CLI_LIB = f.read() - else: - with open(f"{LIB_ROOT}/lib/windows-arm64/kclvm_cli_cdylib.dll", "rb") as f: - WINDOWS_ARM64_CLI_LIB = f.read() - return WINDOWS_AMD64_CLI_LIB if is_amd64_arch() else WINDOWS_ARM64_CLI_LIB - - def export_lib(): - if is_amd64_arch(): - with open(f"{LIB_ROOT}/lib/windows-amd64/kclvm_cli_cdylib.lib", "rb") as f: - WINDOWS_AMD64_EXPORT_LIB = f.read() - else: - with open(f"{LIB_ROOT}/lib/windows-arm64/kclvm_cli_cdylib.lib", "rb") as f: - WINDOWS_ARM64_EXPORT_LIB = f.read() - return WINDOWS_AMD64_EXPORT_LIB if is_amd64_arch() else WINDOWS_ARM64_EXPORT_LIB - - def lib_path() -> str: - if is_amd64_arch(): - return str(LIB_ROOT.joinpath("lib").joinpath("windows-amd64")) - return str(LIB_ROOT.joinpath("lib").joinpath("windows-arm64")) - - def lib_name() -> str: - return "kclvm_cli_cdylib.dll" - - def export_lib_name() -> str: - return "kclvm_cli_cdylib.lib" - -else: - raise f"Unsupported platform {sys.platform}, expected win32, linux or darwin platform" diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 00000000..17b0dd8a --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,37 @@ +[build-system] +requires = ["maturin>=1.5,<2.0"] +build-backend = "maturin" + +[project] +name = "kcl_lib" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Rust", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +dynamic = ["version"] +description = "KCL Programming Language Python Lib" +license = { text = "Apache-2.0" } + +dependencies = [ + "protobuf>=4.25.3" +] + +[tool.maturin] +features = ["pyo3/extension-module"] +module-name = "kcl_lib._kcl_lib" +python-source = "." + +[project.optional-dependencies] +docs = ["pdoc"] +lint = ["ruff"] +test = ["pytest"] + +[project.urls] +Documentation = "https://kcl-lang.io" +Homepage = "https://kcl-lang.io" +Repository = "https://github.com/kcl-lang/kcl" + +[tool.ruff.lint] +ignore = ["F403", "F405"] diff --git a/python/scripts/requirements.txt b/python/scripts/requirements.txt deleted file mode 100644 index 9a6fae8c..00000000 --- a/python/scripts/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -protobuf==4.25.3 diff --git a/python/src/lib.rs b/python/src/lib.rs new file mode 100644 index 00000000..144a1ed9 --- /dev/null +++ b/python/src/lib.rs @@ -0,0 +1,15 @@ +use pyo3::exceptions::PyException; +use pyo3::prelude::*; + +/// Formats the sum of two numbers as string. +#[pyfunction] +fn call<'a>(name: &'a [u8], args: &'a [u8]) -> PyResult<&'a [u8]> { + kcl_lang::call(name, args).map_err(|e| PyErr::new::(e.to_string())) +} + +/// A Python module implemented in Rust. +#[pymodule] +fn _kcl_lib(_py: Python, m: &PyModule) -> PyResult<()> { + m.add_function(wrap_pyfunction!(call, m)?)?; + Ok(()) +} diff --git a/python/tests/exec_test.py b/python/tests/exec_test.py index 1e45aedd..0dc58788 100644 --- a/python/tests/exec_test.py +++ b/python/tests/exec_test.py @@ -1,15 +1,35 @@ -import os -import kcl_lib.bootstrap as bootstrap - -os.environ[bootstrap.KCLVM_CLI_USE_TEST_ENV_VAR] = "ok" +import kcl_lib.api as api +TEST_FILE = "./tests/test_data/schema.k" def test_exec_api(): import kcl_lib.api as api # Call the `exec_program` method with appropriate arguments - args = api.ExecProgram_Args(k_filename_list=["./tests/test_data/schema.k"]) + args = api.ExecProgram_Args(k_filename_list=[TEST_FILE]) # Usage api = api.API() result = api.exec_program(args) - print(result.yaml_result) + assert result.yaml_result == "app:\n replicas: 2" + + +def test_load_package_api(): + import kcl_lib.api as api + + # Call the `exec_program` method with appropriate arguments + args = api.LoadPackage_Args(parse_args=api.ParseProgram_Args(paths=[TEST_FILE]), resolve_ast=True) + # Usage + api = api.API() + result = api.load_package(args) + assert list(result.symbols.values())[0].ty.schema_name == "AppConfig" + + +def test_list_variable_api(): + import kcl_lib.api as api + + # Call the `exec_program` method with appropriate arguments + args = api.ListVariables_Args(file=TEST_FILE) + # Usage + api = api.API() + result = api.list_variables(args) + assert result.variables["app"].value == "AppConfig {replicas: 2}" diff --git a/src/lib.rs b/src/lib.rs index 3263c000..d1e12d1d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,7 +41,7 @@ pub fn call<'a>(name: &'a [u8], args: &'a [u8]) -> Result<&'a [u8]> { let args = CString::new(args)?; let call = CString::new(name)?; let serv = kclvm_service_new(0); - kclvm_service_call(serv, call.as_ptr(), args.as_ptr()) as *mut i8 + kclvm_service_call(serv, call.as_ptr(), args.as_ptr()) }; let result = unsafe { CStr::from_ptr(result_ptr) }; Ok(result.to_bytes())