Skip to main content

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

Project description

Move FCG Analyzer

PyPI version

一个用于分析 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.9.tar.gz (375.9 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.9-cp312-cp312-musllinux_1_1_x86_64.whl (226.3 kB view details)

Uploaded CPython 3.12musllinux: musl 1.1+ x86-64

move_fcg_analyzer-1.0.9-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (221.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

move_fcg_analyzer-1.0.9-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.9-cp311-cp311-musllinux_1_1_x86_64.whl (226.7 kB view details)

Uploaded CPython 3.11musllinux: musl 1.1+ x86-64

move_fcg_analyzer-1.0.9-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (221.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

move_fcg_analyzer-1.0.9-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.9-cp310-cp310-musllinux_1_1_x86_64.whl (225.8 kB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

move_fcg_analyzer-1.0.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (221.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

move_fcg_analyzer-1.0.9-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.9-cp39-cp39-musllinux_1_1_x86_64.whl (225.6 kB view details)

Uploaded CPython 3.9musllinux: musl 1.1+ x86-64

move_fcg_analyzer-1.0.9-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (221.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

move_fcg_analyzer-1.0.9-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.9-cp38-cp38-musllinux_1_1_x86_64.whl (225.6 kB view details)

Uploaded CPython 3.8musllinux: musl 1.1+ x86-64

move_fcg_analyzer-1.0.9-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (221.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.8macOS 11.0+ ARM64

move_fcg_analyzer-1.0.9-cp38-cp38-macosx_10_9_x86_64.whl (196.5 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for move_fcg_analyzer-1.0.9.tar.gz
Algorithm Hash digest
SHA256 75c946aed6df771a089cf3f9b34df84a93d3356f198ddbb2340d6ba0998d3b34
MD5 7026fd62388673c29d0a773667fb57d5
BLAKE2b-256 1722305d7621f567772eda7d44f3b2b2db2a255f9ce08d447d874939e83ce5b8

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp312-cp312-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 10370c27e334e26015db0128d1a8b117f8f21862a6406ea10bb4efc99e2fbacb
MD5 b6939c778daa68b84f3b325c89ee869c
BLAKE2b-256 56f57f0b9bd4e497317c37ea5dd1ba91fabe112f01a0a0ece46b2087d009a7c9

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55d716dd3f3bca4cd12a142198bf498c1161940f893d8170a41072eff71dba11
MD5 00d06f30f44c7078a009d5ab7873901d
BLAKE2b-256 f50d76620bcd854b1afa617e7385474f1232279d4e65b3edb97e123a9d96ea9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 56020255261e5a8d186b663dc55e88054e4c4efd43587ef6ef0a8a5f00272e7b
MD5 1a2d486a0505d060179998251df29e69
BLAKE2b-256 0992ec0789aacd115a44bb4e1539b2a319190715eac7301480a81232ba0d9c52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 95e9e392202293533b10a16357b6fc44e28a8972dd3778befbd0ed8b741b1ada
MD5 7eadce00508af808c7bc367e75d68583
BLAKE2b-256 de74b12778b12b51cc3e7e0e0271ff171f921d9618568c49395233f4ff00cfe0

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 9ddd245e0fbeeb8786fb24dd52cc2666d27d2b61ea48f997f8444a443d672dde
MD5 35d4678a3829a6940c7d9aded99bd1d6
BLAKE2b-256 0da62441e23eb49493461f8c7642f64d3a752223e9877ba97ae02faf3e9c5ff3

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 132c8cb56d390df7d2e2e27a8581d5ba41ec4de53d694895ea30c4149745bd06
MD5 d27a04999611094cc2654b558d12a6e6
BLAKE2b-256 d50558a6959bb30a84ad3e32ef57e037b09bb6fd3774157a78364c0aebd98c03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60036d80ceb96206f2d85bbf20ad97bde38ee2fa57964cefa9f274737ab37595
MD5 fcf92328b727fa0ce5e1dc05b4a18271
BLAKE2b-256 11bc530dd3543ae63ab0edb513a4cf6eebdaddd8d7059f833b865c34f91df6d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7aee48d4f185a4a955bb1b9b9bc28b1bd5939ae030e0a73bd081735aa7bcec52
MD5 b48e643476f3987ee693400f62e4ac45
BLAKE2b-256 bc4a7e1703407e9af2e01cd7539c1956063bbac783edc83dfea6d2c7b4451d9e

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c8feac630350550f16d6eb3c0ac164ae9eec5109ff5eecb447432a3a98b3d77c
MD5 579f28b18ea6596903888aba83a9ba6e
BLAKE2b-256 201228f67be1a157d7c78073ffcdfef5c72ef7bf465acde7545bf950e9e3badc

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae8db333fa580297ce3c0e0cb59fc745355bf5101c706728d3519d76da55da1b
MD5 86bdb3df3911afd1dbc8e6c3a2632b72
BLAKE2b-256 c208473d30c32e6742aad113795eeb24470a1c6ded14288bbce96cd99d6838d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8490d93d7160360eb6a651b192bea326351b3e1ab2977746825379fcb25d9cc5
MD5 44d6e901ee9959e99847615f41323f70
BLAKE2b-256 7bf2fac22fc2a78e6e8d80db1ada90a39900da26d0141e84d84e24b891e07c3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c701a709958fca64254a09f6fcb7eabc590d392522c43c2a839caedac1bc2cbe
MD5 f4c30f26b3478725a34ea830f5760845
BLAKE2b-256 b895e5cb450605f405c9820b8c100a7a8612f05914ea599848a8d6491f07e264

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 86444e117c78f86d1aff365bdf1a278a6a5d6936fd5518043bbc0c9da5e3cad5
MD5 167b458b10c5f94754027c8fd4c15e9a
BLAKE2b-256 2563ae51a363e4d7e8ba128f6563df3026cb3a7dad837c67c067364f0ee0d6fc

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03bd71bab8a666eac93c08495f9ce0d9abfecfcc6cd3aea22ec9410ee63c5209
MD5 9344c4b1d2bcbfda02850ee3bdeb4c71
BLAKE2b-256 d98a81220ec154b21571d64d0149f2bb455a6dd3d9fcc9afc6d0a3b07ef0e8ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d9df5447d57840b9908ee3f2c77c6cabbd62175232730b9f9d1c8cc2e540da2
MD5 484001b4a4f2cb915b629d3aeeb78427
BLAKE2b-256 dd8761c926c1481e20dfdf6d4cd69d2018f86429e4a38bcef2a7950661793f52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 78bbfe31ef42692b907c0841e6aec9e262ed6bd74da07d6ee15b755ef0d4064d
MD5 aeadbbd73f1db9d393185732641e8ea7
BLAKE2b-256 de16e45305210d310c2a0749ac602e9af7a5a3c08b7b34edeedf616013083804

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp38-cp38-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 340f41943bc481496d4ce65db469be7bfcf86a07716cf274a509cf2bc165b46c
MD5 72bd3d56defa6015418f8b640fe1882e
BLAKE2b-256 4b7f78081308d62fb628d6d851d87f687bbbadb052216aa517e41688d3dbc9be

See more details on using hashes here.

File details

Details for the file move_fcg_analyzer-1.0.9-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6dab38d1df844d7485f4710f87600fac209410e5db3bbc2b1af239b41415186c
MD5 8c8e91f9c490835406cf41635c48be37
BLAKE2b-256 1ce91636ff50c39b2f52c9607f611abd5f58e8c7aaded86d70d2d69e1bbe5e19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1243452b6f956dcfd308422671284eb40431dbe3b61757f1190e8df1037f251d
MD5 4e28611ef05c81510d97231f2b99161a
BLAKE2b-256 6be5066bfbcabc81b3b33c3b6bc09727b4ed9e2bbaa63129199848dddf2c0296

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for move_fcg_analyzer-1.0.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d9a5022829a2729bd01c5ab861a75b25b101799668c30a95004c2ac3078aa5fa
MD5 d5027755c6927b1022fbca2c0d30571d
BLAKE2b-256 06e8d53b4a453d375063733d7fff016220a8372243e36ad064bbab9c0ab006de

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