Skip to main content

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

Project description

Move FCG Analyzer

PyPI version PyPI Publish Test Build

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

功能

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

安装

从 PyPI 安装(推荐)

pip install move-fcg-analyzer

安装后即可直接使用,无需手动构建。

系统要求

  • Python: 3.8 或更高版本
  • Node.js: 18 或更高版本(运行时需要)

从源码构建(开发者)

如果你需要从源码构建:

1. 安装依赖

npm install

2. 构建 TypeScript Indexer

npm run build:indexer

使用

命令行接口(CLI)

安装后可以直接使用 move-fcg-analyzer 命令:

move-fcg-analyzer <project_path> <function_name>

示例:

move-fcg-analyzer ./test/caas-framework grant_read_authorization

或者使用 Python 模块方式:

python -m move_fcg_analyzer <project_path> <function_name>

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"])  # 查看函数调用关系
print(result["function"])  # 查看函数签名
print(result["parameter"])  # 查看函数参数

完整示例:

from move_fcg_analyzer import MoveFunctionAnalyzer
import json

analyzer = MoveFunctionAnalyzer()
result = analyzer.analyze_raw("./test/caas-framework", "grant_read_authorization")

# 打印格式化的 JSON 输出
print(json.dumps(result, indent=2))

# 访问特定字段
print(f"Module: {result['contract']}")
print(f"Function: {result['function']}")
print(f"Location: {result['location']['file']}:{result['location']['start_line']}")
print(f"Calls {len(result['calls'])} functions")

输出格式

{
  "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 Distribution

move_fcg_analyzer-1.0.8.tar.gz (372.7 kB view details)

Uploaded Source

Built Distributions

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

move_fcg_analyzer-1.0.8-cp312-cp312-manylinux_2_28_x86_64.whl (227.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

move_fcg_analyzer-1.0.8-cp312-cp312-macosx_11_0_arm64.whl (203.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

move_fcg_analyzer-1.0.8-cp312-cp312-macosx_10_13_x86_64.whl (196.8 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

move_fcg_analyzer-1.0.8-cp311-cp311-manylinux_2_28_x86_64.whl (228.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

move_fcg_analyzer-1.0.8-cp311-cp311-macosx_11_0_arm64.whl (203.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

move_fcg_analyzer-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl (196.8 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

move_fcg_analyzer-1.0.8-cp310-cp310-manylinux_2_28_x86_64.whl (227.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

move_fcg_analyzer-1.0.8-cp310-cp310-macosx_11_0_arm64.whl (203.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

move_fcg_analyzer-1.0.8-cp310-cp310-macosx_10_9_x86_64.whl (196.8 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

move_fcg_analyzer-1.0.8-cp39-cp39-manylinux_2_28_x86_64.whl (227.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

move_fcg_analyzer-1.0.8-cp39-cp39-macosx_11_0_arm64.whl (203.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

move_fcg_analyzer-1.0.8-cp39-cp39-macosx_10_9_x86_64.whl (196.8 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

move_fcg_analyzer-1.0.8-cp38-cp38-manylinux_2_28_x86_64.whl (227.2 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

move_fcg_analyzer-1.0.8-cp38-cp38-macosx_11_0_arm64.whl (203.0 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

move_fcg_analyzer-1.0.8-cp38-cp38-macosx_10_9_x86_64.whl (196.6 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file move_fcg_analyzer-1.0.8.tar.gz.

File metadata

  • Download URL: move_fcg_analyzer-1.0.8.tar.gz
  • Upload date:
  • Size: 372.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for move_fcg_analyzer-1.0.8.tar.gz
Algorithm Hash digest
SHA256 0ab64b3064c661d84b01c95512c4f5470f7626cf8f7b0afbd7e62253272305a4
MD5 6ed280fd037184b0fbee300fa42ff5a1
BLAKE2b-256 cfa3add765d3b53aa9d235c7ed7e4eb23d78e5138acbf0c0c4bfbbb2562b285e

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2b7d96e1a1ecd23fa78332319a94eebddaabe6a685911b35e6e3daa7141a574e
MD5 a80800f31d5ec42ac265cd778f99f8f9
BLAKE2b-256 86cf6ef4862f597a2fa8dc714157585ef1ea64ee436bea8152b657dadd28a553

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0bc381ce2c75f735de802c4f3cb7984466d58fef092b4ea94483ec4760dbea0
MD5 f7e4c749feeab03cc3a0431d5143617e
BLAKE2b-256 3c24f2ff862246f81c46a65f87e150ff0bcd5f6c60bdd607e6a21e492cc2e249

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 537fc2b92c0a1b63074d8677ce62c29fced8d02a36514a753be76728f4fd9451
MD5 468d97e9ac8286f108a47c72a93c68ea
BLAKE2b-256 ad02e90e29a87dad0cad47304c388d8874f6c9b9ee75f7789b316587d1484edf

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 39176047138a363bb6691643c73bfb4748bd7465f66949dfe832d0b9013f6a86
MD5 1f5dca1cbced085d6f5c428965f5c72f
BLAKE2b-256 581e605c89dbd40f4ae3bebae3432d9cbff78df2809e6fe9c682eda8bd06c114

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4097a1c1786d5e47e96ae4d937cc76e9d4c2f7ffa6a028f3c567f90523b3c38d
MD5 8a476ef654cea62a43e0cd0c056e0f72
BLAKE2b-256 6083d6b43989ebde5d87d58964568dc1a91d6189789892a1818f5a4b7d703bf0

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 55d57f80267348a86afb528b0cf5024e58b108128a87e7c431286acaf8c2cadb
MD5 ee21e4ed450fd83e38f95fd2fdca44c6
BLAKE2b-256 639a790389e470a4afff3785cae681d2c6ded8294a612de7e0d36f8a82109c43

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 97c124b48048708361b5b1edcb26a975417086ffbf2d67b7a5cf950e13ab06c7
MD5 f89e3dcd9af3e9f4b3f1c189d9808901
BLAKE2b-256 1cebc14bafc6c17a54f4f7cb04754d26dc51ca840b4f1e884eaaace274279fc8

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 130d6789ab391c62a0c93776c1bcf2b94cf7b535b6fe03bef9aab6901b43fbe3
MD5 3c46f4cf3ef205559e3dfdefe05b6310
BLAKE2b-256 b535cb0dac748b27a1bf294bcc7e96c7bec951417eb90858446705ffc78d8800

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 06e7f294cf2c973a9d8b74f200bc42ce54e01b5a69911e37d0e06fc7841d3569
MD5 4a1b5039459947217fbd95ab87d33bdf
BLAKE2b-256 4a230377b3a2f36111cf600078251976413e8126e4804382d0ea9a6e365aea59

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 99364d1a2de3eff7f043a9509c906d7219c2a7d0bc8c531cdcd395a0bb4f26c6
MD5 9389367b36a367614de86a4405ed4b18
BLAKE2b-256 404296b2b3db8b502f8f6fbd69f435f11371dce86508173d2bcfbf6143385956

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8cf6e3585744015edc727ca46cef2ce53dfe7bd271109a8c09170f99d416e11b
MD5 8bb86ce632dc2bb6033b87d7ff7264bd
BLAKE2b-256 1c256600722d32154c7330d567a015456abd77ce576c9e7d039643bf385e225c

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ed76d9db6b6e4d3fe4863006a27640e5e4629373787ed0521568c5f5073ef169
MD5 68b7c54fdf1957faae192e4069c09cb8
BLAKE2b-256 60118793c09904d789a7379540f7974037210cc3d92900a0aa03003640d2d6ea

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b4d6e087fc7fa3de9a6c2367b8971a40707557df692db4e80bc98a2d5acf4acf
MD5 3cb94863450667a2a3f10f79436d1d39
BLAKE2b-256 30678e2d06a620d8b4b4aa63ec012b398dc74fb4dbeffe5195e2c198f863e8d0

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7d6738dbda3a984c40bc67b8fec0fd0093dd7d866a0f58df063608501ae50344
MD5 06418aec44e7b1d4ea11bb803699bf55
BLAKE2b-256 bb0ff2505e427967e3997eb7cd7f9c8091905bb4dd760799e85cd5969dc07212

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.8-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2e9ac11f1160a2770089cc4f32b20ee12b324885b53d0502333e321d929de653
MD5 18ca0ee44e7add56f77f287b8f643542
BLAKE2b-256 440ee2eeab77ca3ffd4f9922d8e644b2ca40fcdfa5ce2af8798b6780c0b79a95

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