Skip to main content

Move 项目索引与函数调用图分析的轻量 Python 库

Project description

Move FCG Analyzer

一个用于分析 Move 项目的静态分析工具,支持函数调用图(Function Call Graph)分析,可以提取函数信息、调用关系、参数等。

功能

  • 提取函数签名、参数、返回类型
  • 提取函数源代码和位置信息
  • 准确提取函数调用关系(calls)
  • 支持模块限定的函数查询
  • 输出标准 JSON 格式
  • 跨平台支持(macOS ARM64、Linux x86_64)

安装

从 PyPI 安装(推荐)

pip install move-fcg-analyzer

从源码构建

1. 安装依赖

npm install

2. 构建 TypeScript Indexer

npm run build:indexer

3. 构建平台特定的 wheel 包

macOS (ARM64):

./build-scripts/build-macos.sh

Linux (x86_64):

./build-scripts/build-linux.sh

生成的 wheel 文件将保存在 dist/ 目录中。

使用

Python API

from move_fcg_analyzer import MoveFunctionAnalyzer

analyzer = MoveFunctionAnalyzer()
result = analyzer.analyze_raw("./project_path", "function_name")

# result 包含 contract, function, source, location, parameter, calls 等字段
print(result["calls"])  # 查看函数调用关系

命令行

python3 -m move_fcg_analyzer <project_path> <function_name>

示例:

python3 -m move_fcg_analyzer ./test/caas-framework grant_read_authorization

输出格式

{
  "contract": "module_name",
  "function": "function_signature",
  "source": "function_source_code",
  "location": {
    "file": "/path/to/file.move",
    "start_line": 134,
    "end_line": 204
  },
  "parameter": [
    {"name": "param_name", "type": "param_type"}
  ],
  "calls": [
    {
      "file": "/path/to/called/function.move",
      "function": "called_function_name",
      "module": "called_module_name"
    }
  ]
}

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

move_fcg_analyzer-1.1.1-py3-none-manylinux_2_28_x86_64.whl (21.7 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

move_fcg_analyzer-1.1.1-1-py3-none-macosx_11_0_arm64.whl (38.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file move_fcg_analyzer-1.1.1-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.1.1-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7f8bd5f72628cf383a784ffd06476924b38338f2fd48a3cb373a732dee88d944
MD5 83e67c827738efe29d4ab0d73483ce71
BLAKE2b-256 ae2576e4b194c7f4ab4563d38e8ce16dc86d196b81415359877a7bf4293f15d3

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.1.1-1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.1.1-1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca109ab508d52b5ad96075d6d5ee121e22751240f50cad75b131fd964884d261
MD5 d1d544f835251d2b77a3de2d2fa4ad3c
BLAKE2b-256 d44c3d0be967816bc36a93930a953a9f83371b22836c5c2c6b075952b38d188f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page